mailgun-ruby 1.3.0 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +27 -0
- data/README.md +1 -2
- data/docs/MessageBuilder.md +12 -0
- data/lib/mailgun/client.rb +1 -0
- data/lib/mailgun/domains/domains.rb +19 -0
- data/lib/mailgun/events/events.rb +4 -4
- data/lib/mailgun/version.rb +1 -1
- data/mailgun.gemspec +1 -1
- data/spec/integration/routes_spec.rb +17 -1
- data/vcr_cassettes/bounces.yml +210 -1
- data/vcr_cassettes/complaints.yml +215 -5
- data/vcr_cassettes/domains.yml +777 -45
- data/vcr_cassettes/email_validation.yml +137 -8
- data/vcr_cassettes/events.yml +735 -2
- data/vcr_cassettes/exceptions.yml +48 -1
- data/vcr_cassettes/list_members.yml +343 -7
- data/vcr_cassettes/mailing_list.yml +301 -9
- data/vcr_cassettes/routes.yml +246 -246
- data/vcr_cassettes/send_message.yml +54 -3
- data/vcr_cassettes/stats.yml +47 -2
- data/vcr_cassettes/suppressions.yml +785 -0
- data/vcr_cassettes/unsubscribes.yml +215 -5
- metadata +17 -18
- data/docs/Messages.md +0 -107
@@ -48,7 +48,7 @@ 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
|
@@ -94,7 +94,7 @@ 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
|
@@ -140,7 +140,7 @@ 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
|
@@ -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,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailgun-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mailgun
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2025-01-
|
12
|
+
date: 2025-01-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -53,20 +53,6 @@ dependencies:
|
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 12.3.2
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: mime-types
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - ">="
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '0'
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - ">="
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
70
56
|
- !ruby/object:Gem::Dependency
|
71
57
|
name: webmock
|
72
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,6 +123,20 @@ dependencies:
|
|
137
123
|
- - ">="
|
138
124
|
- !ruby/object:Gem::Version
|
139
125
|
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: mime-types
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
type: :runtime
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
140
|
- !ruby/object:Gem::Dependency
|
141
141
|
name: faraday
|
142
142
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,7 +171,6 @@ files:
|
|
171
171
|
- docs/EmailValidation.md
|
172
172
|
- docs/Events.md
|
173
173
|
- docs/MessageBuilder.md
|
174
|
-
- docs/Messages.md
|
175
174
|
- docs/Metrics.md
|
176
175
|
- docs/OptInHandler.md
|
177
176
|
- docs/Snippets.md
|
@@ -288,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
288
287
|
- !ruby/object:Gem::Version
|
289
288
|
version: '0'
|
290
289
|
requirements: []
|
291
|
-
rubygems_version: 3.3.
|
290
|
+
rubygems_version: 3.3.26
|
292
291
|
signing_key:
|
293
292
|
specification_version: 4
|
294
293
|
summary: Mailgun's Official Ruby SDK
|
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.
|