Class: Sendgrid::Web::Unsubscribes
- Defined in:
- lib/sendgrid/web/unsubscribes.rb
Instance Method Summary collapse
-
#add(email: nil) ⇒ Sendgrid::Web::Response
Add email addresses to the Unsubscribe list.
-
#delete(start_date: nil, end_date: nil, email: nil) ⇒ Sendgrid::Web::Response
Delete an address from the Unsubscribe list.
-
#get(date: nil, days: nil, start_date: nil, end_date: nil, limit: nil, offset: nil) ⇒ Sendgrid::Web::Response
Retrieve a list of Unsubscribes with addresses and optionally with dates.
Methods inherited from Client
base_uri, config, #config, configure
Instance Method Details
#add(email: nil) ⇒ Sendgrid::Web::Response
Note:
email
is a required parameter.
Add email addresses to the Unsubscribe list.
60 61 62 63 64 65 66 67 68 |
# File 'lib/sendgrid/web/unsubscribes.rb', line 60 def add(email: nil) if email.nil? raise ArgumentError.new('Missing required `email` option') end res = connection.post( '/api/unsubscribes.add.json', default_params(email: email)) craft_response(res) end |
#delete(start_date: nil, end_date: nil, email: nil) ⇒ Sendgrid::Web::Response
Note:
If no parameters are provided the ENTIRE list will be removed.
Delete an address from the Unsubscribe list.
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/sendgrid/web/unsubscribes.rb', line 44 def delete( start_date: nil, end_date: nil, email: nil) res = connection.post( '/api/unsubscribes.delete.json', default_params( start_date: start_date, end_date: end_date, email: email)) craft_response(res) end |
#get(date: nil, days: nil, start_date: nil, end_date: nil, limit: nil, offset: nil) ⇒ Sendgrid::Web::Response
Note:
All parameters are optional.
Retrieve a list of Unsubscribes with addresses and optionally with dates.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/sendgrid/web/unsubscribes.rb', line 20 def get( date: nil, days: nil, start_date: nil, end_date: nil, limit: nil, offset: nil) res = connection.post( '/api/unsubscribes.get.json', default_params( date: date, days: days, start_date: start_date, end_date: end_date, limit: limit, offset: offset)) craft_response(res) end |