Class: SendGridWebApi::Modules::Unsubscribe
- Defined in:
- lib/web_api/unsubscribes.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#add(options = {}) ⇒ Object
Add one or more email addresses to the global suppressions group.
- #base_url ⇒ Object
-
#delete(options = {}) ⇒ Object
This method will delete all unsubscribes from the given email.
-
#get(options = {}) ⇒ Object
Retrieve a list of all email address that are globally suppressed.
Methods included from SendGridWebApi::Modules
#apikey, #blocks, #bounces, #event_notification, #invalid_emails, #mail, #parse_email, #profile, #spam, #stats, #sub_user, #unsubscribes
Methods inherited from Base
#builder_options, #initialize, #make_request_url, #query_api, #query_delete_api, #query_patch_api, #query_post_api, #query_post_json_api, #session, #to_query
Constructor Details
This class inherits a constructor from SendGridWebApi::Base
Instance Method Details
#add(options = {}) ⇒ Object
Add one or more email addresses to the global suppressions group. Expects options => recipient_emails: [“[email protected]”]
17 18 19 20 |
# File 'lib/web_api/unsubscribes.rb', line 17 def add = {} unsubscribe_url = "asm/suppressions/global" query_post_json_api(unsubscribe_url, ()) end |
#base_url ⇒ Object
3 4 5 |
# File 'lib/web_api/unsubscribes.rb', line 3 def base_url "https://api.sendgrid.com/v3/" end |
#delete(options = {}) ⇒ Object
This method will delete all unsubscribes from the given email
23 24 25 26 27 28 29 |
# File 'lib/web_api/unsubscribes.rb', line 23 def delete = {} unsubscribe_url = "asm/suppressions/global" delete_url = unsubscribe_url + "/#{[:email]}" .delete(:email) query_delete_api(delete_url, ()) end |
#get(options = {}) ⇒ Object
Retrieve a list of all email address that are globally suppressed. You can use the offset and limit parameters to retrieve a custom number of results. You can use the start_time and end_time parameters to filter by time frames.
10 11 12 13 |
# File 'lib/web_api/unsubscribes.rb', line 10 def get = {} unsubscribe_url = "suppression/unsubscribes" query_api(unsubscribe_url, ()) end |