mandrill_mailer 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/CHANGELOG.md +10 -6
 - data/README.md +3 -1
 - data/lib/mandrill_mailer/arg_formatter.rb +1 -1
 - data/lib/mandrill_mailer/core_mailer.rb +5 -3
 - data/lib/mandrill_mailer/template_mailer.rb +6 -2
 - data/lib/mandrill_mailer/version.rb +1 -1
 - data/spec/core_mailer_spec.rb +7 -4
 - metadata +3 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 1f1b23face89c57dcf4a9d63594a1d316adb67e5
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 5311702dc42f69d2c6718177d6f790da846c56fa
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: eda62b4c59aa3d60a60f15f851e5483cc1af155a3304c15ed28ee58ae1bccd59ff804e3af1913d018f451e11fac36ab14a95ebdde2ec6b44af30835060edb5fb
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 094eed9cb7c1e02c72b9fd040ad2a7a03bb9ae46999601d0e654998d72e984e041383053094cf943e796c75875cd542319f9ec4db68f6d54fab9cb2d6c402990
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -2,24 +2,28 @@ 
     | 
|
| 
       2 
2 
     | 
    
         
             
            All notable changes to this project will be documented in this file.
         
     | 
| 
       3 
3 
     | 
    
         
             
            This project adheres to [Semantic Versioning](http://semver.org/).
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
      
 5 
     | 
    
         
            +
            ## 1.0.4 - 2015-09-24
         
     | 
| 
      
 6 
     | 
    
         
            +
            ### Added
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Allow default `view_content_link` on Mailer class.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
       5 
9 
     | 
    
         
             
            ## 1.0.3
         
     | 
| 
       6 
     | 
    
         
            -
            - Fix a bug where defaults in merge vars were receiving the correct defaults  
     | 
| 
      
 10 
     | 
    
         
            +
            - Fix a bug where defaults in merge vars were receiving the correct defaults (credit @kennethkalmer).
         
     | 
| 
       7 
11 
     | 
    
         | 
| 
       8 
12 
     | 
    
         
             
            ## 1.0.1
         
     | 
| 
       9 
     | 
    
         
            -
            - Correct regression caused in 1.0.0 that broke defaults in mailers  
     | 
| 
      
 13 
     | 
    
         
            +
            - Correct regression caused in 1.0.0 that broke defaults in mailers (credit: @etipton).
         
     | 
| 
       10 
14 
     | 
    
         | 
| 
       11 
15 
     | 
    
         
             
            ## 1.0.0
         
     | 
| 
       12 
16 
     | 
    
         
             
            ### Changed
         
     | 
| 
       13 
     | 
    
         
            -
            - Update manrill_api gem to 1.0.X
         
     | 
| 
       14 
     | 
    
         
            -
            - Change how interceptors work to be more flexible and not overwrite data if needed
         
     | 
| 
       15 
     | 
    
         
            -
            - Make both the template and message mailers compatible with all available attributes in the messages  
     | 
| 
      
 17 
     | 
    
         
            +
            - Update manrill_api gem to 1.0.X.
         
     | 
| 
      
 18 
     | 
    
         
            +
            - Change how interceptors work to be more flexible and not overwrite data if needed.
         
     | 
| 
      
 19 
     | 
    
         
            +
            - Make both the template and message mailers compatible with all available attributes in the messages API.
         
     | 
| 
       16 
20 
     | 
    
         | 
| 
       17 
21 
     | 
    
         
             
            ### Removed
         
     | 
| 
       18 
22 
     | 
    
         
             
            - Deprecated `data` method on Mailer objects, replaced with `message`.
         
     | 
| 
       19 
23 
     | 
    
         | 
| 
       20 
24 
     | 
    
         
             
            ## 0.6.1
         
     | 
| 
       21 
25 
     | 
    
         
             
            ### Fixed
         
     | 
| 
       22 
     | 
    
         
            -
            - Correct a regression introduced in 0.6.0 that caused a TypeError exception
         
     | 
| 
      
 26 
     | 
    
         
            +
            - Correct a regression introduced in 0.6.0 that caused a TypeError exception.
         
     | 
| 
       23 
27 
     | 
    
         
             
            when no `merge_vars` were provided as arguments to `mandrill_mail`.
         
     | 
| 
       24 
28 
     | 
    
         | 
| 
       25 
29 
     | 
    
         
             
            ## 0.6.0
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -100,6 +100,7 @@ end 
     | 
|
| 
       100 
100 
     | 
    
         
             
              * `:from` - set the default from email address for the mailer
         
     | 
| 
       101 
101 
     | 
    
         
             
              * `:from_name` - set the default from name for the mailer. If not set, defaults to from email address. Setting :from_name in the .mandrill_mail overrides the default.
         
     | 
| 
       102 
102 
     | 
    
         
             
              * `:merge_vars` - set some default `merge_vars` that will be sent with every mailer method (in `global_merge_vars` so there's no risk of collision with method-specific `merge_vars`.
         
     | 
| 
      
 103 
     | 
    
         
            +
              * `:view_content_link` - set a default to be able to access individual mailer messages in the Mandrill dashboard
         
     | 
| 
       103 
104 
     | 
    
         | 
| 
       104 
105 
     | 
    
         
             
            * `.mandrill_mail`
         
     | 
| 
       105 
106 
     | 
    
         
             
               * `:template`(required) - Template slug from within Mandrill (for backwards-compatibility, the template name may also be used but the immutable slug is preferred)
         
     | 
| 
         @@ -184,7 +185,8 @@ class InvitationMailer < MandrillMailer::MessageMailer 
     | 
|
| 
       184 
185 
     | 
    
         
             
                              # to: { email: invitation.email, name: 'Honored Guest' },
         
     | 
| 
       185 
186 
     | 
    
         
             
                              text: "Example text content",
         
     | 
| 
       186 
187 
     | 
    
         
             
                              html: "<p>Example HTML content</p>",
         
     | 
| 
       187 
     | 
    
         
            -
                               
     | 
| 
      
 188 
     | 
    
         
            +
                              # when you need to see the content of individual emails sent to users
         
     | 
| 
      
 189 
     | 
    
         
            +
                              view_content_link: true,
         
     | 
| 
       188 
190 
     | 
    
         
             
                              vars: {
         
     | 
| 
       189 
191 
     | 
    
         
             
                                'OWNER_NAME' => invitation.owner_name,
         
     | 
| 
       190 
192 
     | 
    
         
             
                                'PROJECT_NAME' => invitation.project_name
         
     | 
| 
         @@ -92,7 +92,7 @@ module MandrillMailer 
     | 
|
| 
       92 
92 
     | 
    
         
             
                    "inline_css" => boolean(args[:inline_css]),
         
     | 
| 
       93 
93 
     | 
    
         
             
                    "url_strip_qs" => boolean(args.fetch(:url_strip_qs, true)),
         
     | 
| 
       94 
94 
     | 
    
         
             
                    "preserve_recipients" => boolean(args[:preserve_recipients]),
         
     | 
| 
       95 
     | 
    
         
            -
                    "view_content_link" => boolean(args[:view_content_link]),
         
     | 
| 
      
 95 
     | 
    
         
            +
                    "view_content_link" => boolean(args[:view_content_link] || defaults[:view_content_link]),
         
     | 
| 
       96 
96 
     | 
    
         
             
                    "bcc_address" => args[:bcc],
         
     | 
| 
       97 
97 
     | 
    
         
             
                    "tracking_domain" => args[:tracking_domain],
         
     | 
| 
       98 
98 
     | 
    
         
             
                    "signing_domain" => args[:signing_domain],
         
     | 
| 
         @@ -7,6 +7,7 @@ 
     | 
|
| 
       7 
7 
     | 
    
         
             
            #   default from: 'support@codeschool.com',
         
     | 
| 
       8 
8 
     | 
    
         
             
            #           from_name: 'Code School',
         
     | 
| 
       9 
9 
     | 
    
         
             
            #           merge_vars: { 'FOO' => 'Bar' }
         
     | 
| 
      
 10 
     | 
    
         
            +
            #           view_content_link: false
         
     | 
| 
       10 
11 
     | 
    
         | 
| 
       11 
12 
     | 
    
         
             
            #   def invite(invitation)
         
     | 
| 
       12 
13 
     | 
    
         
             
            #     invitees = invitation.invitees.map { |invitee| { email: invitee.email, name: invitee.name } }
         
     | 
| 
         @@ -36,9 +37,10 @@ 
     | 
|
| 
       36 
37 
     | 
    
         
             
            # end
         
     | 
| 
       37 
38 
     | 
    
         | 
| 
       38 
39 
     | 
    
         
             
            # #default:
         
     | 
| 
       39 
     | 
    
         
            -
            #   :from 
     | 
| 
       40 
     | 
    
         
            -
            #   :from_name 
     | 
| 
       41 
     | 
    
         
            -
            #   :merge_vars 
     | 
| 
      
 40 
     | 
    
         
            +
            #   :from               - set the default from email address for the mailer
         
     | 
| 
      
 41 
     | 
    
         
            +
            #   :from_name          - set the default from name for the mailer
         
     | 
| 
      
 42 
     | 
    
         
            +
            #   :merge_vars         - set the default merge vars for the mailer
         
     | 
| 
      
 43 
     | 
    
         
            +
            #   :view_content_link  - set a default view_content_link option for the mailer
         
     | 
| 
       42 
44 
     | 
    
         | 
| 
       43 
45 
     | 
    
         
             
            # .mandrill_mail
         
     | 
| 
       44 
46 
     | 
    
         
             
            #   :template(required) - Template name from within Mandrill
         
     | 
| 
         @@ -6,7 +6,8 @@ 
     | 
|
| 
       6 
6 
     | 
    
         
             
            # class InvitationMailer < MandrillMailer::TemplateMailer
         
     | 
| 
       7 
7 
     | 
    
         
             
            #   default from: 'support@codeschool.com',
         
     | 
| 
       8 
8 
     | 
    
         
             
            #           from_name: 'Code School',
         
     | 
| 
       9 
     | 
    
         
            -
            #           merge_vars: { 'FOO' => 'Bar' }
         
     | 
| 
      
 9 
     | 
    
         
            +
            #           merge_vars: { 'FOO' => 'Bar' },
         
     | 
| 
      
 10 
     | 
    
         
            +
            #           view_content_link: true
         
     | 
| 
       10 
11 
     | 
    
         | 
| 
       11 
12 
     | 
    
         
             
            #   def invite(invitation)
         
     | 
| 
       12 
13 
     | 
    
         
             
            #     invitees = invitation.invitees.map { |invitee| { email: invitee.email, name: invitee.name } }
         
     | 
| 
         @@ -36,7 +37,10 @@ 
     | 
|
| 
       36 
37 
     | 
    
         
             
            # end
         
     | 
| 
       37 
38 
     | 
    
         | 
| 
       38 
39 
     | 
    
         
             
            # #default:
         
     | 
| 
       39 
     | 
    
         
            -
            #   :from 
     | 
| 
      
 40 
     | 
    
         
            +
            #   :from               - set the default from email address for the mailer
         
     | 
| 
      
 41 
     | 
    
         
            +
            #   :from_name          - set the default from name for the mailer
         
     | 
| 
      
 42 
     | 
    
         
            +
            #   :merge_vars         - set the default merge vars for the mailer
         
     | 
| 
      
 43 
     | 
    
         
            +
            #   :view_content_link  - set a default view_content_link option for the mailer
         
     | 
| 
       40 
44 
     | 
    
         | 
| 
       41 
45 
     | 
    
         
             
            # .mandrill_mail
         
     | 
| 
       42 
46 
     | 
    
         
             
            #   :template(required) - Template name from within Mandrill
         
     | 
    
        data/spec/core_mailer_spec.rb
    CHANGED
    
    | 
         @@ -99,11 +99,13 @@ describe MandrillMailer::CoreMailer do 
     | 
|
| 
       99 
99 
     | 
    
         
             
                  default_from = "default name"
         
     | 
| 
       100 
100 
     | 
    
         
             
                  default_from_email = "default@email.com"
         
     | 
| 
       101 
101 
     | 
    
         
             
                  default_merge_vars = { foo: "bar" }
         
     | 
| 
      
 102 
     | 
    
         
            +
                  default_view_content_link = true
         
     | 
| 
       102 
103 
     | 
    
         | 
| 
       103 
104 
     | 
    
         
             
                  unique_mailer = Class.new(core_mailer) do
         
     | 
| 
       104 
105 
     | 
    
         
             
                    default from_name: default_from,
         
     | 
| 
       105 
106 
     | 
    
         
             
                            from: default_from_email,
         
     | 
| 
       106 
     | 
    
         
            -
                            merge_vars: default_merge_vars
         
     | 
| 
      
 107 
     | 
    
         
            +
                            merge_vars: default_merge_vars,
         
     | 
| 
      
 108 
     | 
    
         
            +
                            view_content_link: default_view_content_link
         
     | 
| 
       107 
109 
     | 
    
         
             
                  end
         
     | 
| 
       108 
110 
     | 
    
         | 
| 
       109 
111 
     | 
    
         
             
                  # Create a second mailer to make sure we don't get class var pollution
         
     | 
| 
         @@ -117,6 +119,7 @@ describe MandrillMailer::CoreMailer do 
     | 
|
| 
       117 
119 
     | 
    
         | 
| 
       118 
120 
     | 
    
         
             
                  expect(new_unique_mailer.message['from_name']).to eq default_from
         
     | 
| 
       119 
121 
     | 
    
         
             
                  expect(new_unique_mailer.message['from_email']).to eq default_from_email
         
     | 
| 
      
 122 
     | 
    
         
            +
                  expect(new_unique_mailer.message['view_content_link']).to eq default_view_content_link
         
     | 
| 
       120 
123 
     | 
    
         | 
| 
       121 
124 
     | 
    
         
             
                  global_merge_vars = [{ "name" => :foo, "content" => "bar" }]
         
     | 
| 
       122 
125 
     | 
    
         
             
                  expect(new_unique_mailer.message['global_merge_vars']).to eq global_merge_vars
         
     | 
| 
         @@ -215,7 +218,7 @@ describe MandrillMailer::CoreMailer do 
     | 
|
| 
       215 
218 
     | 
    
         
             
              end
         
     | 
| 
       216 
219 
     | 
    
         | 
| 
       217 
220 
     | 
    
         
             
              describe 'defaults' do
         
     | 
| 
       218 
     | 
    
         
            -
                it ' 
     | 
| 
      
 221 
     | 
    
         
            +
                it "doesn't share between different subclasses" do
         
     | 
| 
       219 
222 
     | 
    
         
             
                  klassA = Class.new(core_mailer) do
         
     | 
| 
       220 
223 
     | 
    
         
             
                    default from_name: 'ClassA'
         
     | 
| 
       221 
224 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -227,7 +230,7 @@ describe MandrillMailer::CoreMailer do 
     | 
|
| 
       227 
230 
     | 
    
         
             
                  expect(klassB.defaults[:from_name]).to eq 'ClassB'
         
     | 
| 
       228 
231 
     | 
    
         
             
                end
         
     | 
| 
       229 
232 
     | 
    
         | 
| 
       230 
     | 
    
         
            -
                it ' 
     | 
| 
      
 233 
     | 
    
         
            +
                it 'uses defaults from the parent class' do
         
     | 
| 
       231 
234 
     | 
    
         
             
                  klassA = Class.new(core_mailer) do
         
     | 
| 
       232 
235 
     | 
    
         
             
                    default from_name: 'ClassA'
         
     | 
| 
       233 
236 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -237,7 +240,7 @@ describe MandrillMailer::CoreMailer do 
     | 
|
| 
       237 
240 
     | 
    
         
             
                  expect(klassB.defaults[:from_name]).to eq 'ClassA'
         
     | 
| 
       238 
241 
     | 
    
         
             
                end
         
     | 
| 
       239 
242 
     | 
    
         | 
| 
       240 
     | 
    
         
            -
                it ' 
     | 
| 
      
 243 
     | 
    
         
            +
                it 'allows overriding defaults from the parent' do
         
     | 
| 
       241 
244 
     | 
    
         
             
                  klassA = Class.new(core_mailer) do
         
     | 
| 
       242 
245 
     | 
    
         
             
                    default from_name: 'ClassA'
         
     | 
| 
       243 
246 
     | 
    
         
             
                  end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: mandrill_mailer
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.4
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Adam Rensel
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2015- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-09-25 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: activesupport
         
     | 
| 
         @@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       130 
130 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       131 
131 
     | 
    
         
             
            requirements: []
         
     | 
| 
       132 
132 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       133 
     | 
    
         
            -
            rubygems_version: 2.4. 
     | 
| 
      
 133 
     | 
    
         
            +
            rubygems_version: 2.4.8
         
     | 
| 
       134 
134 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       135 
135 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       136 
136 
     | 
    
         
             
            summary: Transactional Mailer for Mandrill
         
     |