sendwithus_ruby_action_mailer 0.3.0 → 0.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 21973412760d0201ba0253d88c3a976a29c52c7f
4
- data.tar.gz: d0eb2777b4623eb94fe6e4e453a53688ac269e06
3
+ metadata.gz: 4b5ed4fd380e163f80dcfa9072963cb10ffa2c0e
4
+ data.tar.gz: decd4114b665b03bd3d9c6aa360201e11ea16845
5
5
  SHA512:
6
- metadata.gz: 33616b7350e0bcf5eb9fd60654688b0da22754180e9370f6e7f2e6e02d3f96eba242cbd261c6e089c5eea504bc424118cb4c6789abaf93dab3e99b6ad1a19947
7
- data.tar.gz: cf4f93ca086ffcf134b171ef8f2117e53ee93fef95184a9f8b216c8c841084159958f1278a0245a6cd431183455ad857ba0254e618fb264e75f4f62975226c91
6
+ metadata.gz: 17749e64d882871acb621e98708531d0983feaa815485c1b0d80e79b33286586304668cbdb5d38fe3e495b6a3f8f1b97c060e0b7f016a120eab76cecd8ecdcdf
7
+ data.tar.gz: b9619fcb4f91c8fb1249427c7bb5a1c92121849e0004e8f67a28a6661814bc9680679b4eed1fa20c65340221e30c6466d7fd8b6c36267f911da5c1756e32aa0c
data/README.md CHANGED
@@ -94,6 +94,24 @@ You never instantiate your mailer class. Rather, you just call the method you de
94
94
  on the class itself.
95
95
 
96
96
 
97
+ ### Conditional Delivery
98
+
99
+ If you have to check for a condition for senting the email (useful when it's a scheduled sending with Sidekiq for instance), you can simply not call the mail method and the email won't be sent out.
100
+
101
+ `````Ruby
102
+ class Notifier < SendWithUsMailer::Base
103
+ def we_miss_you(user_id)
104
+ user = User.find user_id
105
+ if user.do_we_miss_him?
106
+ mail(
107
+ email_id: 'ID-CODE-FROM-SEND-WITH-US',
108
+ recipient_address: user.email
109
+ )
110
+ end
111
+ end
112
+ end
113
+ `````
114
+
97
115
  ### Default Hash
98
116
 
99
117
  SendWithUsMailer allows you to specify default values inside the class definition:
@@ -77,7 +77,7 @@ module SendWithUsMailer
77
77
  files: @files,
78
78
  headers: @headers,
79
79
  tags: @tags
80
- )
80
+ ) if @email_id.present?
81
81
  end
82
82
  end
83
83
  end
@@ -1,3 +1,3 @@
1
1
  module SendWithUsMailer
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -58,8 +58,14 @@ describe SendWithUsMailer::MailParams do
58
58
  end
59
59
 
60
60
  it "calls the send_with_us gem" do
61
+ subject.merge!(email_id: 'x')
61
62
  SendWithUs::Api.any_instance.expects(:send_email)
62
63
  subject.deliver
63
64
  end
65
+
66
+ it "doesnt call the send_with_us gem if mail method is not called" do
67
+ SendWithUs::Api.any_instance.expects(:send_with).never
68
+ subject.deliver
69
+ end
64
70
  end
65
- end
71
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sendwithus_ruby_action_mailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas Rempel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-28 00:00:00.000000000 Z
11
+ date: 2016-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: send_with_us
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  version: '0'
125
125
  requirements: []
126
126
  rubyforge_project:
127
- rubygems_version: 2.4.6
127
+ rubygems_version: 2.4.5
128
128
  signing_key:
129
129
  specification_version: 4
130
130
  summary: An ActionMailer look alike for Send With Us.