Class: SendWithUsMailer::MailParams
- Inherits:
-
Object
- Object
- SendWithUsMailer::MailParams
- Defined in:
- lib/send_with_us_mailer/mail_params.rb
Instance Attribute Summary collapse
-
#email_data ⇒ Object
readonly
Returns the value of attribute email_data.
-
#email_id ⇒ Object
readonly
Returns the value of attribute email_id.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
-
#assign(key, value) ⇒ Object
:nodoc:.
-
#deliver ⇒ Object
Invoke
SendWithUs::Api
to deliver the message. -
#initialize ⇒ MailParams
constructor
:nodoc:.
-
#merge!(params = {}) ⇒ Object
:nodoc:.
Constructor Details
#initialize ⇒ MailParams
:nodoc:
7 8 9 10 11 |
# File 'lib/send_with_us_mailer/mail_params.rb', line 7 def initialize #:nodoc: @email_data = {} @to = {} @from = {} end |
Instance Attribute Details
#email_data ⇒ Object (readonly)
Returns the value of attribute email_data.
5 6 7 |
# File 'lib/send_with_us_mailer/mail_params.rb', line 5 def email_data @email_data end |
#email_id ⇒ Object (readonly)
Returns the value of attribute email_id.
5 6 7 |
# File 'lib/send_with_us_mailer/mail_params.rb', line 5 def email_id @email_id end |
#from ⇒ Object (readonly)
Returns the value of attribute from.
5 6 7 |
# File 'lib/send_with_us_mailer/mail_params.rb', line 5 def from @from end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
5 6 7 |
# File 'lib/send_with_us_mailer/mail_params.rb', line 5 def to @to end |
Instance Method Details
#assign(key, value) ⇒ Object
:nodoc:
13 14 15 |
# File 'lib/send_with_us_mailer/mail_params.rb', line 13 def assign(key, value) #:nodoc: @email_data.merge!( key.to_sym => value ) end |
#deliver ⇒ Object
Invoke SendWithUs::Api
to deliver the message. The SendWithUs
module is implemented in the send_with_us
gem.
IMPORTANT NOTE: SendWithUs
must be configured prior to calling this method. In particular, the api_key
must be set (following the guidelines in the send_with_us
documentation).
38 39 40 |
# File 'lib/send_with_us_mailer/mail_params.rb', line 38 def deliver SendWithUs::Api.new.send_with(@email_id, @to, @email_data, @from) end |
#merge!(params = {}) ⇒ Object
:nodoc:
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/send_with_us_mailer/mail_params.rb', line 17 def merge!(params={}) #:nodoc: params.each_pair do |key, value| case key when :email_id @email_id = value when :to @to.merge!(address: value) when :from @from.merge!(address: value) when :reply_to @from.merge!(reply_to: value) end end end |