From c785b443991b1aa55fa43e54edb12509e4bf4a28 Mon Sep 17 00:00:00 2001 From: Vitalii Ananichev <va@anahoret.com> Date: Fri, 29 May 2015 15:08:50 +0300 Subject: [PATCH] Add ability to set :tags key. --- README.md | 3 ++- lib/sendwithus_ruby_action_mailer/mail_params.rb | 6 +++++- test/lib/sendwithus_ruby_action_mailer/integration_test.rb | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 10963c7..2b9d868 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,8 @@ class Notifier < SendWithUsMailer::Base version_name: 'version-A', locale: 'en-US', files: ["/path/to/file"], - headers: { 'header-name' => 'header-value' } + headers: { 'header-name' => 'header-value' }, + tags: ['some-tag'] ) end end diff --git a/lib/sendwithus_ruby_action_mailer/mail_params.rb b/lib/sendwithus_ruby_action_mailer/mail_params.rb index 85e7f51..35cd193 100644 --- a/lib/sendwithus_ruby_action_mailer/mail_params.rb +++ b/lib/sendwithus_ruby_action_mailer/mail_params.rb @@ -14,6 +14,7 @@ def initialize #:nodoc: @locale = "" @files = [] @headers = {} + @tags = [] end def assign(key, value) #:nodoc: @@ -47,6 +48,8 @@ def merge!(params={}) #:nodoc: @files.concat(value) when :headers @headers.merge!(value) + when :tags + @tags.concat(value) end end end @@ -69,7 +72,8 @@ def deliver version_name: @version_name, locale: @locale, files: @files, - headers: @headers + headers: @headers, + tags: @tags ) end end diff --git a/test/lib/sendwithus_ruby_action_mailer/integration_test.rb b/test/lib/sendwithus_ruby_action_mailer/integration_test.rb index 647da58..b950258 100644 --- a/test/lib/sendwithus_ruby_action_mailer/integration_test.rb +++ b/test/lib/sendwithus_ruby_action_mailer/integration_test.rb @@ -29,7 +29,8 @@ def example_email from_name: 'asender', reply_to: 'ano-reply@company.com', version_name: 'v2', - headers: { 'header-name' => 'header-value' } + headers: { 'header-name' => 'header-value' }, + tags: ['some-tag'] end end