sendgrid-actionmailer 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 216459b27a5755c4aaadca781956a6ca22298ade1fabd652debec76cc3727864
4
- data.tar.gz: 3876cce1f0c1cf0011cbc62bce448bf450124ac7639aea5b03010a6378ed0529
3
+ metadata.gz: 776fb071876f8748d9d6ab2ae7d304b18d60023afb9e6747aa9b2e5c11757dbb
4
+ data.tar.gz: 2ac9f378ca1372c581f10d24d1861a6b6b7fe3cbaddd9c5b6fc53f3d4f441ec8
5
5
  SHA512:
6
- metadata.gz: '0668df5a8839949ce2cfc252f8d86ed7beecf5c0ff0f6524a3215e5c79dbcbfa9279267be7790bec0e81634d74e943182cf2fe7ee2ef411de1346ca7f9d72918'
7
- data.tar.gz: 9cee753e264ec435abe9a6fa468cb9521adba7d2914c00c811b8683bb39265df86dfec71b48bc9577d72bff174eec64adae9031ce0340cc56cc439fc2e82c1fd
6
+ metadata.gz: fb8c6ed35b214301a578d48b6d241c0a85366ff33767283da5e8d09c33210d960b62477c0de1df8397f144d0e70a95e83ea73c473502a7aa0ed8e949babe1ba7
7
+ data.tar.gz: 3830c481b115beffd21d53a4140d3a1d6de73ff4fe2952cbdafb63b3133b663a464d0075def2934b61112ab5a791d5c31796a86f1d2eeb25deb54ea3af3a1fdb
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## 3.0.2 - 2020-4-20
4
+
5
+ ### Changes
6
+
7
+ - perform_send_request setting for testing perposes
8
+
3
9
  ## 3.0.1 - 2020-4-3
4
10
 
5
11
  ### Changes
data/README.md CHANGED
@@ -248,13 +248,11 @@ Example usage:
248
248
 
249
249
  ```
250
250
  mail(subject: 'default subject', 'email body', personalizations: [
251
- { to: { email: 'example@example.com' }},
252
- { to: { email: 'example2@example.com' }}
251
+ { to: [{ email: 'example@example.com' }]},
252
+ { to: [{ email: 'example2@example.com' }]}
253
253
  ])
254
-
255
254
  ```
256
255
 
257
-
258
256
  ### Unsubscribe Links
259
257
 
260
258
  Sendgrid unfortunately uses <% %> for their default substitution syntax, which makes it incompatible with Rails templates. Their proposed solution is to use Personalization Substitutions with the v3 Mail Send Endpoint. This gem makes that modification to make the following Rails friendly unsubscribe urls.
@@ -264,3 +262,9 @@ Sendgrid unfortunately uses <% %> for their default substitution syntax, which m
264
262
  * `<a href="%asm_preferences_raw_url%">Manage Email Preferences</a>`
265
263
 
266
264
  Note: This feature, and substitutions in general, do not work in combination with dynamic templates.
265
+
266
+ ## Testing
267
+
268
+ The setting `perform_send_request` is available to disable sending for testing purposes. Setting perform_send_request false and return_response true enables the testing of the JSON API payload.
269
+
270
+
@@ -34,7 +34,11 @@ module SendGridActionMailer
34
34
  add_mail_settings(sendgrid_mail, mail)
35
35
  add_tracking_settings(sendgrid_mail, mail)
36
36
 
37
- response = perform_send_request(sendgrid_mail)
37
+ if (settings[:perform_send_request] == false)
38
+ response = sendgrid_mail
39
+ else
40
+ response = perform_send_request(sendgrid_mail)
41
+ end
38
42
 
39
43
  settings[:return_response] ? response : self
40
44
  end
@@ -225,7 +229,7 @@ module SendGridActionMailer
225
229
  asm = asm.delete_if { |key, value|
226
230
  !key.to_s.match(/(group_id)|(groups_to_display)/) }
227
231
  if asm.keys.map(&:to_s).include?('group_id')
228
- sendgrid_mail.asm = ASM.new(asm)
232
+ sendgrid_mail.asm = ASM.new(self.class.transform_keys(asm, &:to_sym))
229
233
  end
230
234
  end
231
235
  if mail['ip_pool_name']
@@ -1,3 +1,3 @@
1
1
  module SendGridActionMailer
2
- VERSION = '3.0.1'.freeze
2
+ VERSION = '3.0.2'.freeze
3
3
  end
@@ -59,6 +59,11 @@ module SendGridActionMailer
59
59
  m = DeliveryMethod.new(return_response: true)
60
60
  expect(m.settings[:return_response]).to eq(true)
61
61
  end
62
+
63
+ it 'sets perform_deliveries' do
64
+ m = DeliveryMethod.new(perform_send_request: false)
65
+ expect(m.settings[:perform_send_request]).to eq(false)
66
+ end
62
67
  end
63
68
 
64
69
  describe '#deliver!' do
@@ -756,6 +761,14 @@ module SendGridActionMailer
756
761
  expect(client.sent_mail['personalizations'][2]['bcc']).to eq([{"email"=>"test@sendgrid.com"}])
757
762
  end
758
763
  end
764
+
765
+ context 'when perform_send_request false' do
766
+ it 'should not send and email and return json body' do
767
+ m = DeliveryMethod.new(perform_send_request: false, return_response: true, api_key: 'key')
768
+ response = m.deliver!(mail)
769
+ expect(response).to respond_to(:to_json)
770
+ end
771
+ end
759
772
  end
760
773
  end
761
774
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sendgrid-actionmailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eddie Zaneski
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-04-03 00:00:00.000000000 Z
13
+ date: 2020-04-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: mail