Skip to content

Commit

Permalink
Add ability to set :headers key.
Browse files Browse the repository at this point in the history
  • Loading branch information
atsapov committed Apr 15, 2015
1 parent 91283a2 commit 283f25a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ class Notifier < SendWithUsMailer::Base
bcc: [{:address => "[email protected]"}, {:address => "[email protected]"}],
version_name: 'version-A',
locale: 'en-US',
files: ["/path/to/file"]
files: ["/path/to/file"],
headers: { 'header-name' => 'header-value' }
)
end
end
Expand Down
6 changes: 5 additions & 1 deletion lib/sendwithus_ruby_action_mailer/mail_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def initialize #:nodoc:
@version_name = ""
@locale = ""
@files = []
@headers = {}
end

def assign(key, value) #:nodoc:
Expand Down Expand Up @@ -44,6 +45,8 @@ def merge!(params={}) #:nodoc:
@locale = value
when :files
@files.concat(value)
when :headers
@headers.merge!(value)
end
end
end
Expand All @@ -65,7 +68,8 @@ def deliver
esp_account: "",
version_name: @version_name,
locale: @locale,
files: @files
files: @files,
headers: @headers
)
end
end
Expand Down
3 changes: 2 additions & 1 deletion test/lib/sendwithus_ruby_action_mailer/integration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def example_email
from_address: '[email protected]',
from_name: 'asender',
reply_to: '[email protected]',
version_name: 'v2'
version_name: 'v2',
headers: { 'header-name' => 'header-value' }
end
end

Expand Down

0 comments on commit 283f25a

Please sign in to comment.