lib/spree_sendwithus/message.rb in spree_sendwithus-2.0.11.9 vs lib/spree_sendwithus/message.rb in spree_sendwithus-2.0.11.10
- old
+ new
@@ -2,20 +2,22 @@
module Spree
module SendWithUs
class Message
attr_reader :to, :from, :email_id, :email_data, :cc, :bcc, :files,
- :esp_account
+ :esp_account, :tags, :locale
def initialize
@email_data = {}
@to = {}
@from = {}
@cc = []
@bcc = []
@files = []
@esp_account = Base.esp_account || ""
+ @tags = []
+ @locale = I18n.default_locale.to_s
end
def assign(key, value)
@email_data.merge!(key.to_sym => value)
end
@@ -41,23 +43,31 @@
@bcc.concat(value)
when :files
@files.concat(value)
when :esp_account
@esp_account = value
+ when :tags
+ @tags = value
+ when :locale
+ @locale = value
end
end
end
def deliver
- ::SendWithUs::Api.new.send_with(
+ ::SendWithUs::Api.new.send_email(
@email_id,
@to,
- @email_data,
- @from,
- @cc,
- @bcc,
- @files,
- @esp_account
+ {
+ data: @email_data,
+ from: @from,
+ cc: @cc,
+ bcc: @bcc,
+ esp_account: @esp_account,
+ files: @files,
+ tags: @tags,
+ locale: @locale
+ }
)
end
end
end
end