Class: Readiness::Mailgun::Bounces
- Defined in:
- lib/support_readiness/mailgun/bounces.rb
Overview
Defines the class Bounces within the module Readiness::Mailgun.
Instance Attribute Summary collapse
Class Method Summary collapse
-
.delete!(client, bounce) ⇒ Boolean
Deletes a suppression within Mailgun.
-
.find(client, email) ⇒ Object
Locates a suppression within Mailgun.
-
.find!(client, email) ⇒ Object
Locates a suppression within Mailgun.
Instance Method Summary collapse
-
#initialize(object = {}) ⇒ Bounces
constructor
Creates a new Bounces instance.
Methods inherited from Client
auth_error, bad_request_error, convert_actions, convert_conditions, convert_standard_names_to_ids, convert_ticket_form_agent_conditions, convert_ticket_form_brands, convert_ticket_form_end_user_conditions, convert_ticket_form_names_to_ids, convert_view_names_to_ids, convert_view_restrictions, covert_ticket_form_field_ids, create_package!, erb_renderer, handle_request_error, not_found_error, not_processible_error, put_into_archive, recursively_deflate_directory, timestamp_filename, to_clean_json, to_clean_json_with_key, to_hash, to_nearly_clean_json, to_nearly_clean_json_with_key, to_param_string, write_entries
Constructor Details
#initialize(object = {}) ⇒ Bounces
Creates a new Readiness::Mailgun::Bounces instance
24 25 26 27 28 29 |
# File 'lib/support_readiness/mailgun/bounces.rb', line 24 def initialize(object = {}) @address = object['address'] @code = object['code'] @error = object['error'] @created_at = object['created_at'] end |
Instance Attribute Details
#address ⇒ Object
13 14 15 |
# File 'lib/support_readiness/mailgun/bounces.rb', line 13 def address @address end |
#code ⇒ Object
13 14 15 |
# File 'lib/support_readiness/mailgun/bounces.rb', line 13 def code @code end |
#created_at ⇒ Object
13 14 15 |
# File 'lib/support_readiness/mailgun/bounces.rb', line 13 def created_at @created_at end |
#error ⇒ Object
13 14 15 |
# File 'lib/support_readiness/mailgun/bounces.rb', line 13 def error @error end |
Class Method Details
.delete!(client, bounce) ⇒ Boolean
Deletes a suppression within Mailgun. This will exit on error
96 97 98 99 100 |
# File 'lib/support_readiness/mailgun/bounces.rb', line 96 def self.delete!(client, bounce) response = client.connection.delete "#{client.domain}/bounces/#{CGI.escape(bounce.address)}" handle_request_error(1, 'Mailgun', response.status, { action: 'delete', id: "#{client.domain}/bounces/#{CGI.escape(email)}" }) unless response.status == 200 true end |
.find(client, email) ⇒ Object
Locates a suppression within Mailgun. This will not exit on error (except Authentication errors)
49 50 51 52 53 |
# File 'lib/support_readiness/mailgun/bounces.rb', line 49 def self.find(client, email) response = client.connection.get "#{client.domain}/bounces/#{CGI.escape(email)}" handle_request_error(0, 'Mailgun', response.status, { action: 'get', id: "#{client.domain}/bounces/#{CGI.escape(email)}" }) unless response.status == 200 Bounces.new Oj.load(response.body) end |
.find!(client, email) ⇒ Object
Locates a suppression within Mailgun. This will exit on error
73 74 75 76 77 |
# File 'lib/support_readiness/mailgun/bounces.rb', line 73 def self.find!(client, email) response = client.connection.get "#{client.domain}/bounces/#{CGI.escape(email)}" handle_request_error(1, 'Mailgun', response.status, { action: 'get', id: "#{client.domain}/bounces/#{CGI.escape(email)}" }) unless response.status == 200 Bounces.new Oj.load(response.body) end |