Class: DMCourier::Services::Mandrill
- Inherits:
-
Object
- Object
- DMCourier::Services::Mandrill
- Includes:
- MessageHelper
- Defined in:
- lib/dm_courier/services/mandrill.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#async ⇒ Object
readonly
Returns the value of attribute async.
-
#mail ⇒ Object
readonly
Returns the value of attribute mail.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #deliver! ⇒ Object
-
#initialize(mail, options = {}) ⇒ Mandrill
constructor
A new instance of Mandrill.
- #mandrill_message ⇒ Object
- #name ⇒ Object
Methods included from MessageHelper
#attachments, #attachments?, #extract_params, #fallback_options, #from, #from_address, #from_email, #from_name, #html_part, #nil_true_false?, #return_string_value, #subject, #text_part
Constructor Details
#initialize(mail, options = {}) ⇒ Mandrill
Returns a new instance of Mandrill.
13 14 15 16 17 18 |
# File 'lib/dm_courier/services/mandrill.rb', line 13 def initialize(mail, = {}) @mail = mail @api_key = .fetch(:api_key) @async = .fetch(:async, false) @options = end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
11 12 13 |
# File 'lib/dm_courier/services/mandrill.rb', line 11 def api_key @api_key end |
#async ⇒ Object (readonly)
Returns the value of attribute async.
11 12 13 |
# File 'lib/dm_courier/services/mandrill.rb', line 11 def async @async end |
#mail ⇒ Object (readonly)
Returns the value of attribute mail.
11 12 13 |
# File 'lib/dm_courier/services/mandrill.rb', line 11 def mail @mail end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
11 12 13 |
# File 'lib/dm_courier/services/mandrill.rb', line 11 def @options end |
Instance Method Details
#deliver! ⇒ Object
24 25 26 27 |
# File 'lib/dm_courier/services/mandrill.rb', line 24 def deliver! mandrill_api = ::Mandrill::API.new(api_key) mandrill_api..send(, async) end |
#mandrill_message ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/dm_courier/services/mandrill.rb', line 29 def = extract_params(nil_true_false: { auto_html: :auto_html, auto_text: :auto_text, important: :important, inline_css: :inline_css, track_clicks: :track_clicks, track_opens: :track_opens, url_strip_qs: :track_url_without_query_string, view_content_link: :log_content }, string: { bcc_address: :bcc_address, return_path_domain: :return_path_domain, signing_domain: :signing_domain, subaccount: :subaccount, tracking_domain: :tracking_domain }) [:important] ||= false .merge!(from_email: from_email, from_name: from_name, headers: headers, html: html_part, subject: subject, tags: , text: text_part, to: to) [:attachments] = if (inline: false) [:images] = if (inline: true) end |
#name ⇒ Object
20 21 22 |
# File 'lib/dm_courier/services/mandrill.rb', line 20 def name :mandrill end |