sendgrid-actionmailer 2.2.0 → 2.4.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
- SHA1:
3
- metadata.gz: d0cf44faa71a46698dd397f001b0ed5c07f00edc
4
- data.tar.gz: 1feedab0fd41d4d9dbff84441f272bab024bf08d
2
+ SHA256:
3
+ metadata.gz: 94259db52788333029d0c8fc9160c054a0e0bef5fc40b0ff4a2f825c9a337e54
4
+ data.tar.gz: eee118a0ebb96bf3c098f6c5ec7a28ec832c2b116b4060d7ef25df18ef36d063
5
5
  SHA512:
6
- metadata.gz: 603221943d0dd4cc9446e68f3c77441930efa6f90545e7255e4af56eed0ab7fcf81e66d94ba6fbc72c9f8347db0922f54558ecb9ec6ea1f39ddb0a042520af51
7
- data.tar.gz: 2976d343386bb783ed92088d6a3417175ed61441562661d71dac703298bf093e6122b84f6509f2bb010b07cbee4a474067e35e8cb19691cb0cff29e4beb2b602
6
+ metadata.gz: 1cb7d6f1972707fa631f27512ab36cc219373ca36725b666d05dab7ea128d270f8454cb30d45b0bc4b7d2f0460ca1ae380a2af3410c585d919461b0994d51cf1
7
+ data.tar.gz: f2852025eecc5f5087a7e8b41df7cae42f93b4978acf3fb4c8a613f2a3f30eefa83b300affc72234b3f398505bab759a977473ee71a4cc8766c4eb27a3762263
data/.gitignore CHANGED
@@ -20,3 +20,4 @@ tmp
20
20
  *.o
21
21
  *.a
22
22
  mkmf.log
23
+ .DS_Store
@@ -1,12 +1,12 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.5.1
5
- - 2.4.4
6
- - 2.3.4
7
- - 2.3.7
8
- - 2.2.10
4
+ - 2.6.5
5
+ - 2.5.7
6
+ - 2.4.9
7
+ - 2.3.8
9
8
  before_install:
9
+ - gem update --system
10
10
  - gem install bundler
11
11
  gemfile:
12
12
  - gemfiles/mail_2.5.gemfile
@@ -1,5 +1,36 @@
1
1
  # Change Log
2
2
 
3
+ ## 2.4.0 - 2019-07-9
4
+
5
+ ### Changed
6
+
7
+ - Compatibility with `sendgrid-ruby` v6.0.
8
+
9
+ ## 2.3.0 - 2019-4-10
10
+
11
+ ### Fixes
12
+
13
+ - No asm substitutions if template_id present
14
+
15
+ ## 2.2.1 - 2019-1-4
16
+
17
+ ### Fixes
18
+
19
+ - Fix Travis
20
+
21
+ ## 2.2.0 - 2018-11-23
22
+
23
+ ### Fixes
24
+
25
+ - Update Readme
26
+
27
+ ## 2.1.0 - 2018-11-20
28
+
29
+ ### Fixes
30
+
31
+ - Substiutions and dynamic_template_data should be compatible.
32
+
33
+
3
34
  ## 2.0.0 - 2018-08-15
4
35
 
5
36
  ### Changed
data/README.md CHANGED
@@ -45,7 +45,7 @@ The Mail functionality is extended to include additional attributes provided by
45
45
  [Sendgrid v3 API Documentation](https://sendgrid.com/docs/API_Reference/api_v3.html)
46
46
 
47
47
  ### template_id (string)
48
- The id of a template that you would like to use. If you use a template that contains a subject and content (either text or html), you do not need to specify those at the personalizations nor message level.
48
+ The id of a template that you would like to use. If you use a template that contains a subject, you do not need to specify a subject at the personalizations nor message level. However, because of the way ActionMailer works, a body is required, even if the template contains one. If all your emails use templates with a body, you can add `default body: "not used"` to the top of your mailer.
49
49
 
50
50
  ```mail(to: 'example@email.com', subject: 'email subject', body: 'email body', template_id: 'template_1')```
51
51
 
@@ -217,7 +217,7 @@ The name of the campaign.
217
217
 
218
218
  ### dynamic_template_data (json)
219
219
 
220
- Data to provide for feeding the new dynamic templates in Sendgrid with valueable data. This also disables the following Unsubscribe links because of deprecation of substitutions in the new template implementaiton.
220
+ Data to provide for feeding the new dynamic templates in Sendgrid with valueable data. This also disables the following Unsubscribe links because of deprecation of substitutions in the new template implementaiton. Variables are available within templates using [{{handlebar syntax}}](https://sendgrid.com/docs/for-developers/sending-email/using-handlebars).
221
221
 
222
222
  ```mail(to: 'example@email.com', subject: 'email subject', body: 'email body', dynamic_template_data:{ variable_1: 'foo', variable_2: 'bar'})```
223
223
 
@@ -229,4 +229,4 @@ Sendgrid unfortunately uses <% %> for their default substitution syntax, which m
229
229
  * `<a href="%asm_global_unsubscribe_raw_url%">Unsubscribe from List</a>`
230
230
  * `<a href="%asm_preferences_raw_url%">Manage Email Preferences</a>`
231
231
 
232
- Note: This feature, and substitutions in general, do not work in combination with dynamic templates.
232
+ Note: This feature, and substitutions in general, do not work in combination with dynamic templates.
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "mail", "2.5.4"
5
+ gem "mail", "2.5.5"
6
6
 
7
7
  gemspec :path => "../"
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "mail", "2.6.4"
5
+ gem "mail", "2.6.6"
6
6
 
7
7
  gemspec :path => "../"
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "mail", "2.7.0"
5
+ gem "mail", "2.7.1"
6
6
 
7
7
  gemspec :path => "../"
@@ -83,7 +83,7 @@ module SendGridActionMailer
83
83
 
84
84
  if mail['dynamic_template_data']
85
85
  p.add_dynamic_template_data(json_parse(mail['dynamic_template_data'].value))
86
- else
86
+ elsif mail['template_id'].nil?
87
87
  p.add_substitution(Substitution.new(key: "%asm_group_unsubscribe_raw_url%", value: "<%asm_group_unsubscribe_raw_url%>"))
88
88
  p.add_substitution(Substitution.new(key: "%asm_global_unsubscribe_raw_url%", value: "<%asm_global_unsubscribe_raw_url%>"))
89
89
  p.add_substitution(Substitution.new(key: "%asm_preferences_raw_url%", value: "<%asm_preferences_raw_url%>"))
@@ -136,7 +136,7 @@ module SendGridActionMailer
136
136
  end
137
137
 
138
138
  def json_parse(text, symbolize=true)
139
- JSON.parse(text.gsub(/:*\"*([\%a-zA-Z0-9_-]*)\"*(( *)=>\ *)/) { "\"#{$1}\":" }, symbolize_names: symbolize)
139
+ JSON.parse(text.empty? ? '{}' : text.gsub(/:*\"*([\%a-zA-Z0-9_-]*)\"*(( *)=>\ *)/) { "\"#{$1}\":" }, symbolize_names: symbolize)
140
140
  end
141
141
 
142
142
  def add_send_options(sendgrid_mail, mail)
@@ -163,9 +163,11 @@ module SendGridActionMailer
163
163
  sendgrid_mail.add_custom_arg(CustomArg.new(key: key, value: value))
164
164
  end
165
165
  end
166
- if mail['send_at'] && mail['batch_id']
166
+ if mail['send_at']
167
167
  sendgrid_mail.send_at = mail['send_at'].value.to_i
168
- sendgrid_mail.batch_id= mail['batch_id'].to_s
168
+ end
169
+ if mail['batch_id']
170
+ sendgrid_mail.batch_id = mail['batch_id'].to_s
169
171
  end
170
172
  if mail['asm']
171
173
  asm = json_parse(mail['asm'].value)
@@ -226,7 +228,7 @@ module SendGridActionMailer
226
228
  result = client.mail._('send').post(request_body: email.to_json) # ლ(ಠ益ಠლ) that API
227
229
 
228
230
  if result.status_code && result.status_code.start_with?('4')
229
- message = JSON.parse(result.body).fetch('errors').pop.fetch('message')
231
+ message = !!(result.body) ? JSON.parse(result.body).fetch('errors').pop.fetch('message') : 'Sendgrid API Error'
230
232
  full_message = "Sendgrid delivery failed with #{result.status_code} #{message}"
231
233
 
232
234
  settings[:raise_delivery_errors] ? raise(SendgridDeliveryError, full_message) : warn(full_message)
@@ -1,3 +1,3 @@
1
1
  module SendGridActionMailer
2
- VERSION = '2.2.0'.freeze
2
+ VERSION = '2.4.2'.freeze
3
3
  end
@@ -20,10 +20,10 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ['lib']
21
21
 
22
22
  spec.add_dependency 'mail', '~> 2.5'
23
- spec.add_dependency 'sendgrid-ruby', '~> 5.3.0'
23
+ spec.add_dependency 'sendgrid-ruby', '~> 6.0'
24
24
 
25
25
  spec.add_development_dependency 'appraisal', '~> 2.1.0'
26
- spec.add_development_dependency 'bundler', '~> 1.6'
26
+ spec.add_development_dependency 'bundler'
27
27
  spec.add_development_dependency 'rake'
28
28
  spec.add_development_dependency 'rspec', '~> 3.2'
29
29
  spec.add_development_dependency 'webmock'
@@ -393,6 +393,18 @@ module SendGridActionMailer
393
393
  expect(client.sent_mail['personalizations'].first['dynamic_template_data']).to eq(template_data)
394
394
  end
395
395
  end
396
+
397
+ it 'sets dynamic template data and sandbox_mode' do
398
+ mail['mail_settings'] = '{}'
399
+ mailer.deliver!(mail)
400
+ expect(client.sent_mail['mail_settings']).to eq(nil)
401
+ end
402
+
403
+ it 'sets dynamic template data and sandbox_mode' do
404
+ mail['mail_settings'] = {}
405
+ mailer.deliver!(mail)
406
+ expect(client.sent_mail['mail_settings']).to eq(nil)
407
+ end
396
408
  end
397
409
 
398
410
  context 'multipart/alternative' do
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: 2.2.0
4
+ version: 2.4.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: 2018-11-23 00:00:00.000000000 Z
13
+ date: 2020-01-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: mail
@@ -32,14 +32,14 @@ dependencies:
32
32
  requirements:
33
33
  - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: 5.3.0
35
+ version: '6.0'
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: 5.3.0
42
+ version: '6.0'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: appraisal
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -58,16 +58,16 @@ dependencies:
58
58
  name: bundler
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - "~>"
61
+ - - ">="
62
62
  - !ruby/object:Gem::Version
63
- version: '1.6'
63
+ version: '0'
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - "~>"
68
+ - - ">="
69
69
  - !ruby/object:Gem::Version
70
- version: '1.6'
70
+ version: '0'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: rake
73
73
  requirement: !ruby/object:Gem::Requirement
@@ -157,8 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  - !ruby/object:Gem::Version
158
158
  version: '0'
159
159
  requirements: []
160
- rubyforge_project:
161
- rubygems_version: 2.6.14
160
+ rubygems_version: 3.0.6
162
161
  signing_key:
163
162
  specification_version: 4
164
163
  summary: SendGrid support for ActionMailer.