awwa / sendgrid4r

MIT License
25 stars 12 forks source link

post_recipient not implemented #18

Closed mikeypotter closed 8 years ago

mikeypotter commented 9 years ago

First off, great job on this module - thank you very much.

SendGrid.post_recipient(params: params) gives undefined method `post_recipient' for #SendGrid4r::Client:0x007fee833b2878

To get around this I've implemented post_recipients with just a single recipient. The documentation should either be updated or the code added to support the method.

Thanks again for a great module. Huge time saver.

awwa commented 8 years ago

Thanks for reporting. I will take a look shortly.

awwa commented 8 years ago

The post_recipient() has been removed from ver 1.2.0. https://github.com/awwa/sendgrid4r/commit/baa8b9d844d8f453ca1a99dfa68fe9e54ec1ac35 Because SendGrid has removed the single post endpoint.

Could you please use the post_recipients() with single item array argument?

I have removed the post_recipient() from the documentation.

secondstreetmedia commented 8 years ago

Hi,

It appears post_recipient() is still in the documentation.

#post_recipient_to_list Add a Single Recipient to a List.

recipient = {}
recipient['email'] = @email1
recipient['last_name'] = @last_name1
recipient['custom_field_name'] = 'pet'
recipient = @client.post_recipient(recipient)
client.post_recipient_to_list(list_id: list.id, recipient_id: recipient.id)

Also, because this, and RoR in general, is still relatively new to me, can you explain why client is an instance variable in:

recipient = @client.post_recipient(recipient)

but not so in:

client.post_recipient_to_list(list_id: list.id, recipient_id: recipient.id)

I'm assuming code above this would include:

require 'sendgrid4r'
client = SendGrid4r::Client.new(api_key: 'api_key')

Thanks!

awwa commented 8 years ago

Thanks. The documentation was not updated. I have updated them.

secondstreetmedia commented 8 years ago

Thanks!