sendgrid4r
sendgrid4r copied to clipboard
List reading issue
According to this example:
lists = client.get_lists
lists.each do |list|
puts list.id # => Fixnum
puts list.name # => 'new_list'
puts list.recipient_count # => Fixnum
I get error:
NoMethodError: undefined method `id' for #<Array:0x007fcbe4bbebf0>
Lists array looks like:
=> #<struct SendGrid4r::REST::MarketingCampaigns::Contacts::Lists::Lists lists=[#<struct SendGrid4r::REST::MarketingCampaigns::Contacts::Lists::List id=542087, name="buyers", recipient_count=0>, #<struct SendGrid4r::REST::MarketingCampaigns::Contacts::Lists::List id=542086, name="sellers", recipient_count=0>, #<struct SendGrid4r::REST::MarketingCampaigns::Contacts::Lists::List id=542088, name="subscribers", recipient_count=0>]>
Work only if:
lists[0].each do |list|
...