mailgun-ruby 1.2.15 → 1.3.5
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/.gitignore +1 -0
- data/CHANGELOG.md +52 -3
- data/Gemfile +1 -0
- data/README.md +2 -2
- data/docs/MessageBuilder.md +12 -0
- data/docs/Metrics.md +108 -0
- data/docs/Webhooks.md +4 -2
- data/lib/mailgun/chains.rb +1 -1
- data/lib/mailgun/client.rb +40 -30
- data/lib/mailgun/domains/domains.rb +19 -0
- data/lib/mailgun/events/events.rb +4 -4
- data/lib/mailgun/exceptions/exceptions.rb +7 -7
- data/lib/mailgun/messages/message_builder.rb +14 -2
- data/lib/mailgun/metrics/metrics.rb +61 -0
- data/lib/mailgun/response.rb +11 -10
- data/lib/mailgun/version.rb +1 -1
- data/lib/mailgun.rb +2 -1
- data/mailgun.gemspec +6 -3
- data/spec/integration/domains_spec.rb +95 -92
- data/spec/integration/email_validation_spec.rb +2 -1
- data/spec/integration/list_spec.rb +1 -1
- data/spec/integration/mailer_spec.rb +5 -5
- data/spec/integration/mailgun_spec.rb +14 -12
- data/spec/integration/metrics_spec.rb +218 -0
- data/spec/integration/routes_spec.rb +17 -1
- data/spec/integration/stats_spec.rb +1 -1
- data/spec/integration/unsubscribes_spec.rb +2 -2
- data/spec/integration/webhook_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/unit/connection/test_client.rb +1 -1
- data/spec/unit/events/events_spec.rb +1 -1
- data/spec/unit/exceptions/exceptions_spec.rb +3 -3
- data/spec/unit/messages/message_builder_spec.rb +4 -3
- data/vcr_cassettes/bounces.yml +59 -98
- data/vcr_cassettes/complaints.yml +237 -97
- data/vcr_cassettes/domains.yml +332 -763
- data/vcr_cassettes/email_validation.yml +81 -144
- data/vcr_cassettes/events.yml +24 -63
- data/vcr_cassettes/exceptions.yml +49 -2
- data/vcr_cassettes/list_members.yml +187 -179
- data/vcr_cassettes/mailing_list.yml +309 -17
- data/vcr_cassettes/metrics.yml +116 -0
- data/vcr_cassettes/routes.yml +246 -246
- data/vcr_cassettes/send_message.yml +54 -3
- data/vcr_cassettes/stats.yml +28 -24
- data/vcr_cassettes/suppressions.yml +229 -447
- data/vcr_cassettes/unsubscribes.yml +219 -9
- metadata +58 -15
- data/docs/Messages.md +0 -107
- /data/docs/{railgun/Templates.md → Templates.md} +0 -0
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: post
|
5
|
-
uri: https://api
|
5
|
+
uri: https://api.mailgun.net/v3/DOMAIN.TEST/unsubscribes
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: address=integration-test-email%40DOMAIN.TEST&tag=*
|
@@ -48,11 +48,11 @@ http_interactions:
|
|
48
48
|
encoding: UTF-8
|
49
49
|
string: '{"address":"integration-test-email@DOMAIN.TEST","message":"Address
|
50
50
|
has been added to the unsubscribes table"}'
|
51
|
-
http_version:
|
51
|
+
http_version:
|
52
52
|
recorded_at: Fri, 08 Jan 2016 18:55:05 GMT
|
53
53
|
- request:
|
54
54
|
method: get
|
55
|
-
uri: https://api
|
55
|
+
uri: https://api.mailgun.net/v3/DOMAIN.TEST/unsubscribes/integration-test-email@DOMAIN.TEST
|
56
56
|
body:
|
57
57
|
encoding: US-ASCII
|
58
58
|
string: ''
|
@@ -94,11 +94,11 @@ http_interactions:
|
|
94
94
|
encoding: UTF-8
|
95
95
|
string: '{"address":"integration-test-email@DOMAIN.TEST","tags":["*"],"created_at":"Fri,
|
96
96
|
08 Jan 2016 18:55:04 UTC"}'
|
97
|
-
http_version:
|
97
|
+
http_version:
|
98
98
|
recorded_at: Fri, 08 Jan 2016 18:55:05 GMT
|
99
99
|
- request:
|
100
100
|
method: get
|
101
|
-
uri: https://api
|
101
|
+
uri: https://api.mailgun.net/v3/DOMAIN.TEST/unsubscribes
|
102
102
|
body:
|
103
103
|
encoding: US-ASCII
|
104
104
|
string: ''
|
@@ -140,11 +140,11 @@ http_interactions:
|
|
140
140
|
encoding: UTF-8
|
141
141
|
string: '{"items":[{"address":"integration-test-email@DOMAIN.TEST","tags":["*"],"created_at":"Fri,
|
142
142
|
08 Jan 2016 18:55:04 UTC"}],"paging":{"first":"https://api.mailgun.net/v3/DOMAIN.TEST/unsubscribes?limit=100","last":"https://api.mailgun.net/v3/DOMAIN.TEST/unsubscribes?page=last\u0026limit=100","next":"https://api.mailgun.net/v3/DOMAIN.TEST/unsubscribes?page=next\u0026address=integration-test-email%40DOMAIN.TEST\u0026limit=100","previous":"https://api.mailgun.net/v3/DOMAIN.TEST/unsubscribes?page=previous\u0026address=integration-test-email%40DOMAIN.TEST\u0026limit=100"}}'
|
143
|
-
http_version:
|
143
|
+
http_version:
|
144
144
|
recorded_at: Fri, 08 Jan 2016 18:55:28 GMT
|
145
145
|
- request:
|
146
146
|
method: delete
|
147
|
-
uri: https://api
|
147
|
+
uri: https://api.mailgun.net/v3/DOMAIN.TEST/unsubscribes/integration-test-email@DOMAIN.TEST
|
148
148
|
body:
|
149
149
|
encoding: US-ASCII
|
150
150
|
string: ''
|
@@ -186,6 +186,216 @@ http_interactions:
|
|
186
186
|
encoding: UTF-8
|
187
187
|
string: '{"address":"integration-test-email@DOMAIN.TEST","message":"Unsubscribe
|
188
188
|
event has been removed"}'
|
189
|
-
http_version:
|
189
|
+
http_version:
|
190
190
|
recorded_at: Fri, 08 Jan 2016 18:55:28 GMT
|
191
|
-
|
191
|
+
- request:
|
192
|
+
method: post
|
193
|
+
uri: https://api.mailgun.net/v3/DOMAIN.TEST/unsubscribes
|
194
|
+
body:
|
195
|
+
encoding: UTF-8
|
196
|
+
string: address=integration-test-email%40DOMAIN.TEST&tag=%2A
|
197
|
+
headers:
|
198
|
+
User-Agent:
|
199
|
+
- mailgun-sdk-ruby/1.3.0
|
200
|
+
Accept:
|
201
|
+
- "*/*"
|
202
|
+
Authorization:
|
203
|
+
- Basic xxx==
|
204
|
+
Content-Type:
|
205
|
+
- application/x-www-form-urlencoded
|
206
|
+
Accept-Encoding:
|
207
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
208
|
+
response:
|
209
|
+
status:
|
210
|
+
code: 200
|
211
|
+
message: OK
|
212
|
+
headers:
|
213
|
+
Access-Control-Allow-Credentials:
|
214
|
+
- 'true'
|
215
|
+
Access-Control-Allow-Origin:
|
216
|
+
- "*"
|
217
|
+
Cache-Control:
|
218
|
+
- no-store
|
219
|
+
Content-Length:
|
220
|
+
- '150'
|
221
|
+
Content-Type:
|
222
|
+
- application/json; charset=utf-8
|
223
|
+
Date:
|
224
|
+
- Sun, 26 Jan 2025 07:29:46 GMT
|
225
|
+
Strict-Transport-Security:
|
226
|
+
- max-age=63072000; includeSubDomains
|
227
|
+
X-Mailgun-Key-Id:
|
228
|
+
- 90b59dea-f2d12a53
|
229
|
+
X-Request-Limit:
|
230
|
+
- '2500'
|
231
|
+
X-Request-Remaining:
|
232
|
+
- '2484'
|
233
|
+
X-Request-Reset:
|
234
|
+
- '1737876591950'
|
235
|
+
X-Xss-Protection:
|
236
|
+
- 1; mode=block
|
237
|
+
body:
|
238
|
+
encoding: UTF-8
|
239
|
+
string: '{"address":"integration-test-email@DOMAIN.TEST","message":"Address
|
240
|
+
has been added to the unsubscribes table"}
|
241
|
+
|
242
|
+
'
|
243
|
+
http_version:
|
244
|
+
recorded_at: Sun, 26 Jan 2025 07:29:46 GMT
|
245
|
+
- request:
|
246
|
+
method: get
|
247
|
+
uri: https://api.mailgun.net/v3/DOMAIN.TEST/unsubscribes/integration-test-email@DOMAIN.TEST
|
248
|
+
body:
|
249
|
+
encoding: US-ASCII
|
250
|
+
string: ''
|
251
|
+
headers:
|
252
|
+
User-Agent:
|
253
|
+
- mailgun-sdk-ruby/1.3.0
|
254
|
+
Accept:
|
255
|
+
- "*/*"
|
256
|
+
Authorization:
|
257
|
+
- Basic xxx==
|
258
|
+
Accept-Encoding:
|
259
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
260
|
+
response:
|
261
|
+
status:
|
262
|
+
code: 200
|
263
|
+
message: OK
|
264
|
+
headers:
|
265
|
+
Access-Control-Allow-Credentials:
|
266
|
+
- 'true'
|
267
|
+
Access-Control-Allow-Origin:
|
268
|
+
- "*"
|
269
|
+
Cache-Control:
|
270
|
+
- no-store
|
271
|
+
Content-Length:
|
272
|
+
- '147'
|
273
|
+
Content-Type:
|
274
|
+
- application/json; charset=utf-8
|
275
|
+
Date:
|
276
|
+
- Sun, 26 Jan 2025 07:29:46 GMT
|
277
|
+
Strict-Transport-Security:
|
278
|
+
- max-age=63072000; includeSubDomains
|
279
|
+
X-Mailgun-Key-Id:
|
280
|
+
- 90b59dea-f2d12a53
|
281
|
+
X-Request-Limit:
|
282
|
+
- '2500'
|
283
|
+
X-Request-Remaining:
|
284
|
+
- '2483'
|
285
|
+
X-Request-Reset:
|
286
|
+
- '1737876591950'
|
287
|
+
X-Xss-Protection:
|
288
|
+
- 1; mode=block
|
289
|
+
body:
|
290
|
+
encoding: UTF-8
|
291
|
+
string: '{"address":"integration-test-email@DOMAIN.TEST","tags":["*"],"created_at":"Sun,
|
292
|
+
26 Jan 2025 07:29:46 UTC"}
|
293
|
+
|
294
|
+
'
|
295
|
+
http_version:
|
296
|
+
recorded_at: Sun, 26 Jan 2025 07:29:47 GMT
|
297
|
+
- request:
|
298
|
+
method: get
|
299
|
+
uri: https://api.mailgun.net/v3/DOMAIN.TEST/unsubscribes
|
300
|
+
body:
|
301
|
+
encoding: US-ASCII
|
302
|
+
string: ''
|
303
|
+
headers:
|
304
|
+
User-Agent:
|
305
|
+
- mailgun-sdk-ruby/1.3.0
|
306
|
+
Accept:
|
307
|
+
- "*/*"
|
308
|
+
Authorization:
|
309
|
+
- Basic xxx==
|
310
|
+
Accept-Encoding:
|
311
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
312
|
+
response:
|
313
|
+
status:
|
314
|
+
code: 200
|
315
|
+
message: OK
|
316
|
+
headers:
|
317
|
+
Access-Control-Allow-Credentials:
|
318
|
+
- 'true'
|
319
|
+
Access-Control-Allow-Origin:
|
320
|
+
- "*"
|
321
|
+
Cache-Control:
|
322
|
+
- no-store
|
323
|
+
Content-Length:
|
324
|
+
- '847'
|
325
|
+
Content-Type:
|
326
|
+
- application/json; charset=utf-8
|
327
|
+
Date:
|
328
|
+
- Sun, 26 Jan 2025 07:29:47 GMT
|
329
|
+
Strict-Transport-Security:
|
330
|
+
- max-age=63072000; includeSubDomains
|
331
|
+
X-Mailgun-Key-Id:
|
332
|
+
- 90b59dea-f2d12a53
|
333
|
+
X-Request-Limit:
|
334
|
+
- '2500'
|
335
|
+
X-Request-Remaining:
|
336
|
+
- '2482'
|
337
|
+
X-Request-Reset:
|
338
|
+
- '1737876591950'
|
339
|
+
X-Xss-Protection:
|
340
|
+
- 1; mode=block
|
341
|
+
body:
|
342
|
+
encoding: UTF-8
|
343
|
+
string: '{"items":[{"address":"integration-test-email@DOMAIN.TEST","tags":["*"],"created_at":"Sun,
|
344
|
+
26 Jan 2025 07:29:46 UTC"}],"paging":{"first":"https://api.mailgun.net/v3/DOMAIN.TEST/unsubscribes?limit=100&term=","last":"https://api.mailgun.net/v3/DOMAIN.TEST/unsubscribes?page=last&limit=100&term=","next":"https://api.mailgun.net/v3/DOMAIN.TEST/unsubscribes?page=next&address=integration-test-email%40DOMAIN.TEST&limit=100&term=","previous":"https://api.mailgun.net/v3/DOMAIN.TEST/unsubscribes?page=previous&address=integration-test-email%40DOMAIN.TEST&limit=100&term="}}
|
345
|
+
|
346
|
+
'
|
347
|
+
http_version:
|
348
|
+
recorded_at: Sun, 26 Jan 2025 07:29:47 GMT
|
349
|
+
- request:
|
350
|
+
method: delete
|
351
|
+
uri: https://api.mailgun.net/v3/DOMAIN.TEST/unsubscribes/integration-test-email@DOMAIN.TEST
|
352
|
+
body:
|
353
|
+
encoding: US-ASCII
|
354
|
+
string: ''
|
355
|
+
headers:
|
356
|
+
User-Agent:
|
357
|
+
- mailgun-sdk-ruby/1.3.0
|
358
|
+
Accept:
|
359
|
+
- "*/*"
|
360
|
+
Authorization:
|
361
|
+
- Basic xxx==
|
362
|
+
Accept-Encoding:
|
363
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
364
|
+
response:
|
365
|
+
status:
|
366
|
+
code: 200
|
367
|
+
message: OK
|
368
|
+
headers:
|
369
|
+
Access-Control-Allow-Credentials:
|
370
|
+
- 'true'
|
371
|
+
Access-Control-Allow-Origin:
|
372
|
+
- "*"
|
373
|
+
Cache-Control:
|
374
|
+
- no-store
|
375
|
+
Content-Length:
|
376
|
+
- '136'
|
377
|
+
Content-Type:
|
378
|
+
- application/json; charset=utf-8
|
379
|
+
Date:
|
380
|
+
- Sun, 26 Jan 2025 07:29:48 GMT
|
381
|
+
Strict-Transport-Security:
|
382
|
+
- max-age=63072000; includeSubDomains
|
383
|
+
X-Mailgun-Key-Id:
|
384
|
+
- 90b59dea-f2d12a53
|
385
|
+
X-Request-Limit:
|
386
|
+
- '2500'
|
387
|
+
X-Request-Remaining:
|
388
|
+
- '2481'
|
389
|
+
X-Request-Reset:
|
390
|
+
- '1737876591950'
|
391
|
+
X-Xss-Protection:
|
392
|
+
- 1; mode=block
|
393
|
+
body:
|
394
|
+
encoding: UTF-8
|
395
|
+
string: '{"address":"integration-test-email@DOMAIN.TEST","message":"Unsubscribe
|
396
|
+
event has been removed"}
|
397
|
+
|
398
|
+
'
|
399
|
+
http_version:
|
400
|
+
recorded_at: Sun, 26 Jan 2025 07:29:48 GMT
|
401
|
+
recorded_with: VCR 3.0.3
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailgun-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mailgun
|
8
8
|
- Travis Swientek
|
9
|
-
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2025-04-07 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
@@ -31,14 +30,28 @@ dependencies:
|
|
31
30
|
requirements:
|
32
31
|
- - "~>"
|
33
32
|
- !ruby/object:Gem::Version
|
34
|
-
version: 3.
|
33
|
+
version: 3.13.0
|
35
34
|
type: :development
|
36
35
|
prerelease: false
|
37
36
|
version_requirements: !ruby/object:Gem::Requirement
|
38
37
|
requirements:
|
39
38
|
- - "~>"
|
40
39
|
- !ruby/object:Gem::Version
|
41
|
-
version: 3.
|
40
|
+
version: 3.13.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec-its
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.0.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.0.0
|
42
55
|
- !ruby/object:Gem::Dependency
|
43
56
|
name: rake
|
44
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,14 +86,14 @@ dependencies:
|
|
73
86
|
requirements:
|
74
87
|
- - "~>"
|
75
88
|
- !ruby/object:Gem::Version
|
76
|
-
version: 0.
|
89
|
+
version: 0.15.2
|
77
90
|
type: :development
|
78
91
|
prerelease: false
|
79
92
|
version_requirements: !ruby/object:Gem::Requirement
|
80
93
|
requirements:
|
81
94
|
- - "~>"
|
82
95
|
- !ruby/object:Gem::Version
|
83
|
-
version: 0.
|
96
|
+
version: 0.15.2
|
84
97
|
- !ruby/object:Gem::Dependency
|
85
98
|
name: vcr
|
86
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -124,19 +137,47 @@ dependencies:
|
|
124
137
|
- !ruby/object:Gem::Version
|
125
138
|
version: '0'
|
126
139
|
- !ruby/object:Gem::Dependency
|
127
|
-
name:
|
140
|
+
name: mime-types
|
128
141
|
requirement: !ruby/object:Gem::Requirement
|
129
142
|
requirements:
|
130
143
|
- - ">="
|
131
144
|
- !ruby/object:Gem::Version
|
132
|
-
version:
|
145
|
+
version: '0'
|
133
146
|
type: :runtime
|
134
147
|
prerelease: false
|
135
148
|
version_requirements: !ruby/object:Gem::Requirement
|
136
149
|
requirements:
|
137
150
|
- - ">="
|
138
151
|
- !ruby/object:Gem::Version
|
139
|
-
version:
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: faraday
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '2.1'
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '2.1'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: faraday-multipart
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 1.1.0
|
174
|
+
type: :runtime
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 1.1.0
|
140
181
|
description: Mailgun's Official Ruby SDK for interacting with the Mailgun API.
|
141
182
|
email: support@mailgunhq.com
|
142
183
|
executables: []
|
@@ -157,16 +198,16 @@ files:
|
|
157
198
|
- docs/EmailValidation.md
|
158
199
|
- docs/Events.md
|
159
200
|
- docs/MessageBuilder.md
|
160
|
-
- docs/
|
201
|
+
- docs/Metrics.md
|
161
202
|
- docs/OptInHandler.md
|
162
203
|
- docs/Snippets.md
|
163
204
|
- docs/Subaccounts.md
|
164
205
|
- docs/Suppressions.md
|
206
|
+
- docs/Templates.md
|
165
207
|
- docs/Webhooks.md
|
166
208
|
- docs/railgun/EmailValidation.md
|
167
209
|
- docs/railgun/Overview.md
|
168
210
|
- docs/railgun/Parameters.md
|
169
|
-
- docs/railgun/Templates.md
|
170
211
|
- lib/mailgun-ruby.rb
|
171
212
|
- lib/mailgun.rb
|
172
213
|
- lib/mailgun/address.rb
|
@@ -178,6 +219,7 @@ files:
|
|
178
219
|
- lib/mailgun/lists/opt_in_handler.rb
|
179
220
|
- lib/mailgun/messages/batch_message.rb
|
180
221
|
- lib/mailgun/messages/message_builder.rb
|
222
|
+
- lib/mailgun/metrics/metrics.rb
|
181
223
|
- lib/mailgun/response.rb
|
182
224
|
- lib/mailgun/subaccounts/subaccounts.rb
|
183
225
|
- lib/mailgun/suppressions.rb
|
@@ -203,6 +245,7 @@ files:
|
|
203
245
|
- spec/integration/mailer_spec.rb
|
204
246
|
- spec/integration/mailgun_spec.rb
|
205
247
|
- spec/integration/messages/sample_data/mime.txt
|
248
|
+
- spec/integration/metrics_spec.rb
|
206
249
|
- spec/integration/routes_spec.rb
|
207
250
|
- spec/integration/stats_spec.rb
|
208
251
|
- spec/integration/subaccounts_spec.rb
|
@@ -240,6 +283,7 @@ files:
|
|
240
283
|
- vcr_cassettes/mailing_list.todo.yml
|
241
284
|
- vcr_cassettes/mailing_list.yml
|
242
285
|
- vcr_cassettes/message_deliver.yml
|
286
|
+
- vcr_cassettes/metrics.yml
|
243
287
|
- vcr_cassettes/routes.yml
|
244
288
|
- vcr_cassettes/send_message.yml
|
245
289
|
- vcr_cassettes/stats.yml
|
@@ -255,7 +299,6 @@ licenses:
|
|
255
299
|
metadata:
|
256
300
|
documentation_uri: https://documentation.mailgun.com/
|
257
301
|
source_code_uri: https://github.com/mailgun/mailgun-ruby
|
258
|
-
post_install_message:
|
259
302
|
rdoc_options: []
|
260
303
|
require_paths:
|
261
304
|
- lib
|
@@ -270,8 +313,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
270
313
|
- !ruby/object:Gem::Version
|
271
314
|
version: '0'
|
272
315
|
requirements: []
|
273
|
-
rubygems_version: 3.
|
274
|
-
signing_key:
|
316
|
+
rubygems_version: 3.6.2
|
275
317
|
specification_version: 4
|
276
318
|
summary: Mailgun's Official Ruby SDK
|
277
319
|
test_files:
|
@@ -286,6 +328,7 @@ test_files:
|
|
286
328
|
- spec/integration/mailer_spec.rb
|
287
329
|
- spec/integration/mailgun_spec.rb
|
288
330
|
- spec/integration/messages/sample_data/mime.txt
|
331
|
+
- spec/integration/metrics_spec.rb
|
289
332
|
- spec/integration/routes_spec.rb
|
290
333
|
- spec/integration/stats_spec.rb
|
291
334
|
- spec/integration/subaccounts_spec.rb
|
data/docs/Messages.md
DELETED
@@ -1,107 +0,0 @@
|
|
1
|
-
Mailgun - Messages
|
2
|
-
====================
|
3
|
-
|
4
|
-
This is the Mailgun Ruby *Message* utilities.
|
5
|
-
|
6
|
-
The below assumes you've already installed the Mailgun Ruby SDK in to your
|
7
|
-
project. If not, go back to the master README for instructions.
|
8
|
-
|
9
|
-
There are two utilities included, Message Builder and Batch Message.
|
10
|
-
|
11
|
-
Message Builder: Allows you to build a message object by calling methods for
|
12
|
-
each MIME attribute.
|
13
|
-
Batch Message: Inherits Message Builder and allows you to iterate through
|
14
|
-
recipients from a list. Messages will fire after the 1,000th recipient has been
|
15
|
-
added.
|
16
|
-
|
17
|
-
Usage - Message Builder
|
18
|
-
-----------------------
|
19
|
-
Here's how to use Message Builder to build your Message.
|
20
|
-
|
21
|
-
```ruby
|
22
|
-
# First, instantiate the Mailgun Client with your API key
|
23
|
-
mg_client = Mailgun::Client.new("your-api-key")
|
24
|
-
mb_obj = Mailgun::MessageBuilder.new
|
25
|
-
|
26
|
-
# Define the from address.
|
27
|
-
mb_obj.set_from_address("me@example.com", {"first"=>"Ruby", "last" => "SDK"})
|
28
|
-
|
29
|
-
# Define a to recipient.
|
30
|
-
mb_obj.add_recipient(:to, "john.doe@example.com", {"first" => "John", "last" => "Doe"})
|
31
|
-
|
32
|
-
# Define a cc recipient.
|
33
|
-
mb_obj.add_recipient(:cc, "sally.doe@example.com", {"first" => "Sally", "last" => "Doe"})
|
34
|
-
|
35
|
-
# Define the subject.
|
36
|
-
mb_obj.set_subject("A message from the Ruby SDK using Message Builder!")
|
37
|
-
|
38
|
-
# Define the body of the message.
|
39
|
-
mb_obj.set_text_body("This is the text body of the message!")
|
40
|
-
|
41
|
-
# Define the HTML text of the message
|
42
|
-
mb_obj.set_html_body("<html><body><p>This is the text body of the message</p></body></html>")
|
43
|
-
|
44
|
-
# Set the Message-Id header. Pass in a valid Message-Id.
|
45
|
-
mb_obj.set_message_id("<20141014000000.11111.11111@example.com>")
|
46
|
-
|
47
|
-
# Clear the Message-Id header. Pass in nil or empty string.
|
48
|
-
mb_obj.set_message_id(nil)
|
49
|
-
mb_obj.set_message_id('')
|
50
|
-
|
51
|
-
# Other Optional Parameters.
|
52
|
-
mb_obj.add_campaign_id("My-Awesome-Campaign")
|
53
|
-
mb_obj.header("Customer-Id", "12345")
|
54
|
-
mb_obj.add_attachment("./tron.jpg")
|
55
|
-
mb_obj.set_delivery_time("tomorrow 8:00AM PST")
|
56
|
-
mb_obj.set_click_tracking(true)
|
57
|
-
|
58
|
-
# Send your message through the client
|
59
|
-
mg_client.send_message("sending_domain.com", mb_obj)
|
60
|
-
```
|
61
|
-
|
62
|
-
Usage - Batch Message
|
63
|
-
---------------------
|
64
|
-
Here's how to use Batch Message to easily handle batch sending jobs.
|
65
|
-
|
66
|
-
```ruby
|
67
|
-
# First, instantiate the Mailgun Client with your API key
|
68
|
-
mg_client = Mailgun::Client.new("your-api-key")
|
69
|
-
mb_obj = Mailgun::BatchMessage.new(mg_client, "example.com")
|
70
|
-
|
71
|
-
# Define the from address.
|
72
|
-
mb_obj.set_from_address("me@example.com", {"first"=>"Ruby", "last" => "SDK"})
|
73
|
-
|
74
|
-
# Define the subject.
|
75
|
-
mb_obj.set_subject("A message from the Ruby SDK using Message Builder!")
|
76
|
-
|
77
|
-
# Define the body of the message.
|
78
|
-
mb_obj.set_text_body("Hello %recipient.first%,
|
79
|
-
This is the text body of the message
|
80
|
-
using recipient variables!
|
81
|
-
If you need to include custom data,
|
82
|
-
you could do it like this: %recipient.account-id%.")
|
83
|
-
|
84
|
-
mb_obj.add_recipient(:to, "john.doe@example.com", {"first" => "John",
|
85
|
-
"last" => "Doe",
|
86
|
-
"account-id" => 1234})
|
87
|
-
|
88
|
-
mb_obj.add_recipient(:to, "jane.doe@example.com", {"first" => "Jane",
|
89
|
-
"last" => "Doe",
|
90
|
-
"account-id" => 5678})
|
91
|
-
|
92
|
-
mb_obj.add_recipient(:to, "bob.doe@example.com", {"first" => "Bob",
|
93
|
-
"last" => "Doe",
|
94
|
-
"account-id" => 91011})
|
95
|
-
...
|
96
|
-
mb_obj.add_recipient(:to, "sally.doe@example.com", {"first" => "Sally",
|
97
|
-
"last" => "Doe",
|
98
|
-
"account-id" => 121314})
|
99
|
-
|
100
|
-
# Send your message through the client
|
101
|
-
message_ids = mb_obj.finalize
|
102
|
-
```
|
103
|
-
|
104
|
-
More Documentation
|
105
|
-
------------------
|
106
|
-
See the official [Mailgun Docs](https://documentation.mailgun.com/en/latest/api-sending.html)
|
107
|
-
for more information.
|
File without changes
|