send_grid_mailer 1.0.0 → 1.1.0

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
- SHA1:
3
- metadata.gz: d8269564f91417e0b4e8813c6be1db5f04be828a
4
- data.tar.gz: b49dbc23ca7b63e7f8be14c8a47340bb0cda26ad
2
+ SHA256:
3
+ metadata.gz: 2d726da9f986023abcc14c683d799ed6cacf43ffeb934cf0ec12ea6cd25e707f
4
+ data.tar.gz: 6f09f6d43206e7a9fbe22ef59970d579a94b2f7cd140d79ff534b7090e741dcd
5
5
  SHA512:
6
- metadata.gz: 420118f02069b82f5a6779f481dfb32a0181e29e191b64c31f7afed86fcd4df8b361c7433128ce1504175b3459a47e1de84de119397e4c5bdfdf5d4848290161
7
- data.tar.gz: 75f581ffef9bdba13de8fa9c4790ebd0fef055d2aef4f38f987966b73d962cb678e4f67dd2a7d52497faf2bff163143d8ed56a9ea4f727ae2c68f1ddb0e33efc
6
+ metadata.gz: 9e68184451599dc1579f3891cbfad2613bacc3dbc9741a489cd2ed6169468a0b6e8029bc1f3812b54bb99ad2ccb3b6e9bd8a64100a2461d4eeddcba703ed8308
7
+ data.tar.gz: 817b1843f2c2a2a8727ae9693bdc1186fe947b0b8ee93b52de72e07003cfe450d783ae79757df8e5f022714e24ca6d3b68754ff106efd580d78b3419b93d45b2
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
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
+ ### v1.1.0
6
+
7
+ ##### Added
8
+
9
+ * Detailed API errors
10
+
5
11
  ### v1.0.0
6
12
 
7
13
  ##### Added
@@ -4,7 +4,7 @@ module SendGridMailer
4
4
 
5
5
  class InvalidApiKey < Error
6
6
  def initialize
7
- super("the SendGrid API key is invalid or missing")
7
+ super("The SendGrid API key is invalid or missing")
8
8
  end
9
9
  end
10
10
 
@@ -14,7 +14,8 @@ module SendGridMailer
14
14
  def initialize(error_code, errors)
15
15
  @error_code = error_code
16
16
  @errors = errors
17
- super("sendgrid api error")
17
+ error_message = errors.map { |err| err['message'] }.join('. ')
18
+ super("Sendgrid API error. Code: #{error_code}. Errors: #{error_message}")
18
19
  end
19
20
  end
20
21
  end
@@ -1,3 +1,3 @@
1
1
  module SendGridMailer
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -10,7 +10,9 @@ describe TestMailer do
10
10
  error_code = "404"
11
11
  result = { errors: errors }.to_json
12
12
  expect_sg_api_request(error_code, request_body, result)
13
- expect { deliver }.to raise_error(SendGridMailer::ApiError, "sendgrid api error") do |e|
13
+ error_messages = errors.map { |err| err['message'] }.join('. ')
14
+ message = "Sendgrid API error. Code: #{error_code}. Errors: #{error_messages}"
15
+ expect { deliver }.to raise_error(SendGridMailer::ApiError, message) do |e|
14
16
  expect(e.error_code).to eq(error_code)
15
17
  expect(e.errors).to eq(errors)
16
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: send_grid_mailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Platanus
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-06-14 00:00:00.000000000 Z
12
+ date: 2018-03-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -213,8 +213,6 @@ files:
213
213
  - spec/dummy/config/routes.rb
214
214
  - spec/dummy/config/secrets.yml
215
215
  - spec/dummy/db/schema.rb
216
- - spec/dummy/db/test.sqlite3
217
- - spec/dummy/log/test.log
218
216
  - spec/dummy/public/404.html
219
217
  - spec/dummy/public/422.html
220
218
  - spec/dummy/public/500.html
@@ -246,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
246
244
  version: '0'
247
245
  requirements: []
248
246
  rubyforge_project:
249
- rubygems_version: 2.4.5
247
+ rubygems_version: 2.7.6
250
248
  signing_key:
251
249
  specification_version: 4
252
250
  summary: Action Mailer adapter for using SendGrid
@@ -287,8 +285,6 @@ test_files:
287
285
  - spec/dummy/config/routes.rb
288
286
  - spec/dummy/config/secrets.yml
289
287
  - spec/dummy/db/schema.rb
290
- - spec/dummy/db/test.sqlite3
291
- - spec/dummy/log/test.log
292
288
  - spec/dummy/public/404.html
293
289
  - spec/dummy/public/422.html
294
290
  - spec/dummy/public/500.html
Binary file
@@ -1,414 +0,0 @@
1
-  (146.5ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
2
-  (0.1ms) select sqlite_version(*)
3
-  (3.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
4
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
5
- ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
6
-  (8.3ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
7
-  (0.2ms) select sqlite_version(*)
8
-  (3.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
9
-  (0.2ms) SELECT version FROM "schema_migrations"
10
-  (5.1ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
11
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
12
-  (0.2ms) begin transaction
13
-  (0.1ms) rollback transaction
14
-  (0.1ms) begin transaction
15
-  (0.1ms) rollback transaction
16
-  (0.1ms) begin transaction
17
-  (0.1ms) rollback transaction
18
-  (0.1ms) begin transaction
19
-  (0.1ms) rollback transaction
20
-  (0.1ms) begin transaction
21
-  (0.1ms) rollback transaction
22
-  (0.1ms) begin transaction
23
-  (0.2ms) rollback transaction
24
-  (0.1ms) begin transaction
25
-  (0.1ms) rollback transaction
26
-  (0.1ms) begin transaction
27
-  (0.1ms) rollback transaction
28
-  (0.1ms) begin transaction
29
-  (0.1ms) rollback transaction
30
-  (0.2ms) begin transaction
31
-  (0.1ms) rollback transaction
32
-  (0.1ms) begin transaction
33
-  (0.1ms) rollback transaction
34
-  (0.1ms) begin transaction
35
-  (0.1ms) rollback transaction
36
-  (0.1ms) begin transaction
37
-  (0.1ms) rollback transaction
38
-  (0.1ms) begin transaction
39
-  (0.1ms) rollback transaction
40
-  (0.1ms) begin transaction
41
-  (0.1ms) rollback transaction
42
-  (0.1ms) begin transaction
43
-
44
- Subject: Body email
45
- Template ID: -
46
- From: default-sender@platan.us
47
- To: -
48
- Cc: -
49
- Bcc: -
50
- Substitutions: -
51
- Headers: -
52
- body:
53
- type: text/plain
54
- value: Body
55
- Attachments: -
56
-
57
- The E-mail was not sent :(
58
- Status Code: 404
59
- Errors:
60
- * from.email: The from email does not...
61
- * personalizations.0.to: The to array is required...
62
-
63
- TestMailer#body_email: processed outbound mail in 12.3ms
64
-  (0.3ms) rollback transaction
65
-  (0.1ms) begin transaction
66
-
67
- Subject: Body email
68
- Template ID: -
69
- From: default-sender@platan.us
70
- To: -
71
- Cc: -
72
- Bcc: -
73
- Substitutions: -
74
- Headers: -
75
- body:
76
- type: text/plain
77
- value: Body
78
- Attachments: -
79
-
80
- The E-mail was successfully sent :)
81
- Status Code: 202
82
-
83
- TestMailer#body_email: processed outbound mail in 2.3ms
84
-  (0.1ms) rollback transaction
85
-  (0.1ms) begin transaction
86
-
87
- Subject: Body params email
88
- Template ID: -
89
- From: default-sender@platan.us
90
- To: -
91
- Cc: -
92
- Bcc: -
93
- Substitutions: -
94
- Headers: -
95
- body:
96
- type: text/html
97
- value: <h1>Body Params</h1>
98
- Attachments: -
99
-
100
- The E-mail was successfully sent :)
101
- Status Code: 202
102
-
103
- TestMailer#body_params_email: processed outbound mail in 2.3ms
104
-  (0.1ms) rollback transaction
105
-  (0.1ms) begin transaction
106
- Rendered test_mailer/rails_tpl_email.html.erb within layouts/mailer (2.0ms)
107
-
108
- Subject: Rails tpl email
109
- Template ID: -
110
- From: default-sender@platan.us
111
- To: -
112
- Cc: -
113
- Bcc: -
114
- Substitutions: -
115
- Headers: -
116
- body:
117
- type: text/html
118
- value: <html>
119
- <body>
120
- Rails Template!
121
-
122
- </body>
123
- </html>
124
-
125
- Attachments: -
126
-
127
- The E-mail was successfully sent :)
128
- Status Code: 202
129
-
130
- TestMailer#rails_tpl_email: processed outbound mail in 22.8ms
131
-  (0.1ms) rollback transaction
132
-  (0.1ms) begin transaction
133
-
134
- Subject: From params email
135
- Template ID: -
136
- From: override@platan.us
137
- To: -
138
- Cc: -
139
- Bcc: -
140
- Substitutions: -
141
- Headers: -
142
- body:
143
- type: text/plain
144
- value: X
145
- Attachments: -
146
-
147
- The E-mail was successfully sent :)
148
- Status Code: 202
149
-
150
- TestMailer#from_params_email: processed outbound mail in 2.7ms
151
-  (0.2ms) rollback transaction
152
-  (0.1ms) begin transaction
153
-
154
- Subject: From email
155
- Template ID: -
156
- From: override@platan.us
157
- To: -
158
- Cc: -
159
- Bcc: -
160
- Substitutions: -
161
- Headers: -
162
- body:
163
- type: text/plain
164
- value: X
165
- Attachments: -
166
-
167
- The E-mail was successfully sent :)
168
- Status Code: 202
169
-
170
- TestMailer#from_email: processed outbound mail in 2.3ms
171
-  (0.1ms) rollback transaction
172
-  (0.1ms) begin transaction
173
-
174
- Subject: Recipients params email
175
- Template ID: -
176
- From: default-sender@platan.us
177
- To: r1@platan.us, r2@platan.us
178
- Cc: r4@platan.us
179
- Bcc: r5@platan.us
180
- Substitutions: -
181
- Headers: -
182
- body:
183
- type: text/plain
184
- value: X
185
- Attachments: -
186
-
187
- The E-mail was successfully sent :)
188
- Status Code: 202
189
-
190
- TestMailer#recipients_params_email: processed outbound mail in 2.3ms
191
-  (0.2ms) rollback transaction
192
-  (0.1ms) begin transaction
193
-
194
- Subject: Recipients email
195
- Template ID: -
196
- From: default-sender@platan.us
197
- To: r1@platan.us, r2@platan.us
198
- Cc: r4@platan.us
199
- Bcc: r5@platan.us
200
- Substitutions: -
201
- Headers: -
202
- body:
203
- type: text/plain
204
- value: X
205
- Attachments: -
206
-
207
- The E-mail was successfully sent :)
208
- Status Code: 202
209
-
210
- TestMailer#recipients_email: processed outbound mail in 2.3ms
211
-  (0.1ms) rollback transaction
212
-  (0.1ms) begin transaction
213
-
214
- Subject: Template id params email
215
- Template ID: XXX
216
- From: default-sender@platan.us
217
- To: -
218
- Cc: -
219
- Bcc: -
220
- Substitutions: -
221
- Headers: -
222
- body: -
223
- Attachments: -
224
-
225
- The E-mail was successfully sent :)
226
- Status Code: 202
227
-
228
- TestMailer#template_id_params_email: processed outbound mail in 2.2ms
229
-  (0.1ms) rollback transaction
230
-  (0.1ms) begin transaction
231
-
232
- Subject: Template id email
233
- Template ID: XXX
234
- From: default-sender@platan.us
235
- To: -
236
- Cc: -
237
- Bcc: -
238
- Substitutions: -
239
- Headers: -
240
- body: -
241
- Attachments: -
242
-
243
- The E-mail was successfully sent :)
244
- Status Code: 202
245
-
246
- TestMailer#template_id_email: processed outbound mail in 2.2ms
247
-  (0.1ms) rollback transaction
248
-  (0.1ms) begin transaction
249
-
250
- Subject: My Subject
251
- Template ID: -
252
- From: default-sender@platan.us
253
- To: -
254
- Cc: -
255
- Bcc: -
256
- Substitutions: -
257
- Headers: -
258
- body:
259
- type: text/plain
260
- value: X
261
- Attachments: -
262
-
263
- The E-mail was successfully sent :)
264
- Status Code: 202
265
-
266
- TestMailer#subject_params_email: processed outbound mail in 1.9ms
267
-  (0.1ms) rollback transaction
268
-  (0.1ms) begin transaction
269
-
270
- Subject: My Subject
271
- Template ID: -
272
- From: default-sender@platan.us
273
- To: -
274
- Cc: -
275
- Bcc: -
276
- Substitutions: -
277
- Headers: -
278
- body:
279
- type: text/plain
280
- value: X
281
- Attachments: -
282
-
283
- The E-mail was successfully sent :)
284
- Status Code: 202
285
-
286
- TestMailer#subject_email: processed outbound mail in 2.2ms
287
-  (0.1ms) rollback transaction
288
-  (0.1ms) begin transaction
289
-
290
- Subject: Headers params email
291
- Template ID: -
292
- From: default-sender@platan.us
293
- To: -
294
- Cc: -
295
- Bcc: -
296
- Substitutions: -
297
- Headers:
298
- HEADER-1 => VALUE-1
299
- HEADER-2 => VALUE-2
300
- body:
301
- type: text/plain
302
- value: X
303
- Attachments: -
304
-
305
- The E-mail was successfully sent :)
306
- Status Code: 202
307
-
308
- TestMailer#headers_params_email: processed outbound mail in 2.3ms
309
-  (0.1ms) rollback transaction
310
-  (0.1ms) begin transaction
311
-
312
- Subject: Headers email
313
- Template ID: -
314
- From: default-sender@platan.us
315
- To: -
316
- Cc: -
317
- Bcc: -
318
- Substitutions: -
319
- Headers:
320
- HEADER-1 => VALUE-1
321
- HEADER-2 => VALUE-2
322
- body:
323
- type: text/plain
324
- value: X
325
- Attachments: -
326
-
327
- The E-mail was successfully sent :)
328
- Status Code: 202
329
-
330
- TestMailer#headers_email: processed outbound mail in 3.5ms
331
-  (0.1ms) rollback transaction
332
-  (0.1ms) begin transaction
333
-
334
- Subject: Add attachments email
335
- Template ID: -
336
- From: default-sender@platan.us
337
- To: -
338
- Cc: -
339
- Bcc: -
340
- Substitutions: -
341
- Headers: -
342
- body:
343
- type: text/plain
344
- value: X
345
- Attachments:
346
- nana.png
347
-
348
- The E-mail was successfully sent :)
349
- Status Code: 202
350
-
351
- TestMailer#add_attachments_email: processed outbound mail in 19.1ms
352
-  (0.1ms) rollback transaction
353
-  (0.1ms) begin transaction
354
-
355
- Subject: Substitutions email
356
- Template ID: -
357
- From: default-sender@platan.us
358
- To: -
359
- Cc: -
360
- Bcc: -
361
- Substitutions:
362
- %key1% => value1
363
- %key2% => value2
364
- Headers: -
365
- body:
366
- type: text/plain
367
- value: X
368
- Attachments: -
369
-
370
- The E-mail was successfully sent :)
371
- Status Code: 202
372
-
373
- TestMailer#substitutions_email: processed outbound mail in 2.9ms
374
-  (0.2ms) rollback transaction
375
-  (0.1ms) begin transaction
376
-
377
- Subject: [STAGING] Recipients email
378
- Template ID: -
379
- From: default-sender@platan.us
380
- To: interceptor1@platan.us, interceptor2@platan.us
381
- Cc: -
382
- Bcc: -
383
- Substitutions: -
384
- Headers:
385
- X-Intercepted-To => r1@platan.us, r2@platan.us
386
- X-Intercepted-Cc => r4@platan.us
387
- X-Intercepted-Bcc => r5@platan.us
388
- body:
389
- type: text/plain
390
- value: X
391
- Attachments: -
392
-
393
- The E-mail was successfully sent :)
394
- Status Code: 202
395
-
396
- TestMailer#recipients_email: processed outbound mail in 2.7ms
397
-  (0.1ms) rollback transaction
398
-  (0.1ms) begin transaction
399
-
400
- Subject: Body email
401
- Template ID: -
402
- From: default-sender@platan.us
403
- To: -
404
- Cc: -
405
- Bcc: -
406
- Substitutions: -
407
- Headers: -
408
- body:
409
- type: text/plain
410
- value: Body
411
- Attachments: -
412
-
413
- TestMailer#body_email: processed outbound mail in 1.5ms
414
-  (0.1ms) rollback transaction