Class: Spree::SendWithUs::Message
- Inherits:
-
Object
- Object
- Spree::SendWithUs::Message
- Defined in:
- lib/spree_sendwithus/message.rb
Instance Attribute Summary collapse
-
#bcc ⇒ Object
readonly
Returns the value of attribute bcc.
-
#cc ⇒ Object
readonly
Returns the value of attribute cc.
-
#email_data ⇒ Object
readonly
Returns the value of attribute email_data.
-
#email_id ⇒ Object
readonly
Returns the value of attribute email_id.
-
#esp_account ⇒ Object
readonly
Returns the value of attribute esp_account.
-
#files ⇒ Object
readonly
Returns the value of attribute files.
-
#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
- #deliver ⇒ Object
-
#initialize ⇒ Message
constructor
A new instance of Message.
- #merge!(params = {}) ⇒ Object
Constructor Details
#initialize ⇒ Message
Returns a new instance of Message.
9 10 11 12 13 14 15 16 17 |
# File 'lib/spree_sendwithus/message.rb', line 9 def initialize @email_data = {} @to = {} @from = {} @cc = [] @bcc = [] @files = [] @esp_account = Base.esp_account || "" end |
Instance Attribute Details
#bcc ⇒ Object (readonly)
Returns the value of attribute bcc.
6 7 8 |
# File 'lib/spree_sendwithus/message.rb', line 6 def bcc @bcc end |
#cc ⇒ Object (readonly)
Returns the value of attribute cc.
6 7 8 |
# File 'lib/spree_sendwithus/message.rb', line 6 def cc @cc end |
#email_data ⇒ Object (readonly)
Returns the value of attribute email_data.
6 7 8 |
# File 'lib/spree_sendwithus/message.rb', line 6 def email_data @email_data end |
#email_id ⇒ Object (readonly)
Returns the value of attribute email_id.
6 7 8 |
# File 'lib/spree_sendwithus/message.rb', line 6 def email_id @email_id end |
#esp_account ⇒ Object (readonly)
Returns the value of attribute esp_account.
6 7 8 |
# File 'lib/spree_sendwithus/message.rb', line 6 def esp_account @esp_account end |
#files ⇒ Object (readonly)
Returns the value of attribute files.
6 7 8 |
# File 'lib/spree_sendwithus/message.rb', line 6 def files @files end |
#from ⇒ Object (readonly)
Returns the value of attribute from.
6 7 8 |
# File 'lib/spree_sendwithus/message.rb', line 6 def from @from end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
6 7 8 |
# File 'lib/spree_sendwithus/message.rb', line 6 def to @to end |
Instance Method Details
#assign(key, value) ⇒ Object
19 20 21 |
# File 'lib/spree_sendwithus/message.rb', line 19 def assign(key, value) @email_data.merge!(key.to_sym => value) end |
#deliver ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/spree_sendwithus/message.rb', line 50 def deliver ::SendWithUs::Api.new.send_with( @email_id, @to, @email_data, @from, @cc, @bcc, @files, @esp_account ) end |
#merge!(params = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/spree_sendwithus/message.rb', line 23 def merge!(params = {}) params.each_pair do |key, value| case key when :email_id @email_id = value when :recipient_name @to.merge!(name: value) when :recipient_address @to.merge!(address: value) when :from_name @from.merge!(name: value) when :from_address @from.merge!(address: value) when :reply_to @from.merge!(reply_to: value) when :cc @cc.concat(value) when :bcc @bcc.concat(value) when :files @files.concat(value) when :esp_account @esp_account = value end end end |