sendgrid4r icon indicating copy to clipboard operation
sendgrid4r copied to clipboard

List reading issue

Open alexey opened this issue 9 years ago • 2 comments

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>]>

alexey avatar Aug 30 '16 18:08 alexey

Work only if:

lists[0].each do |list|
...

alexey avatar Aug 30 '16 18:08 alexey

Hello @alexey, The document was incorrect. I fixed that.

lists.lists.each do |list|
...

awwa avatar Sep 12 '16 16:09 awwa