Class: SendGridWebApi::Modules::Block
- Defined in:
- lib/web_api/blocks.rb
Constant Summary collapse
- BLOCKS_URL =
"suppression/blocks"
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #base_url ⇒ Object
-
#count(options = {}) ⇒ Object
Deprecated: Count is no longer supported on SendGrid v3.
-
#delete(options = {}) ⇒ Object
This method will delete all blocks from the given email.
-
#get(options = {}) ⇒ Object
Retrieve all of your blocks.
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
#base_url ⇒ Object
5 6 7 |
# File 'lib/web_api/blocks.rb', line 5 def base_url "https://api.sendgrid.com/v3/" end |
#count(options = {}) ⇒ Object
Deprecated: Count is no longer supported on SendGrid v3. As an alternative, SendGrid recommends to query depending on time frames since ‘get` limit is 500.
26 27 28 29 |
# File 'lib/web_api/blocks.rb', line 26 def count = {} count = query_api(BLOCKS_URL, ()).count {count: count} end |
#delete(options = {}) ⇒ Object
This method will delete all blocks from the given email
18 19 20 21 22 |
# File 'lib/web_api/blocks.rb', line 18 def delete = {} delete_url = BLOCKS_URL+"/#{[:email]}" .delete(:email) query_delete_api(delete_url, ()) end |
#get(options = {}) ⇒ Object
Retrieve all of your blocks. A maximum of 500 blocks will be returned per query. You can use the offset and limit parameters to retrieve more or less than 500 results. You can use the start_time and end_time parameters to filter by time frames.
13 14 15 |
# File 'lib/web_api/blocks.rb', line 13 def get = {} query_api(BLOCKS_URL, ()) end |