mailgun-ruby 1.0.3 → 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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.rubocop.yml +8 -0
  4. data/.rubocop_todo.yml +22 -0
  5. data/.ruby-env.yml.example +12 -0
  6. data/.travis.yml +6 -12
  7. data/Domains.md +36 -0
  8. data/MessageBuilder.md +14 -14
  9. data/Messages.md +44 -30
  10. data/OptInHandler.md +34 -34
  11. data/README.md +74 -24
  12. data/Rakefile +22 -20
  13. data/Snippets.md +26 -26
  14. data/Webhooks.md +40 -0
  15. data/lib/mailgun.rb +26 -228
  16. data/lib/mailgun/chains.rb +16 -0
  17. data/lib/mailgun/client.rb +143 -0
  18. data/lib/mailgun/domains/domains.rb +84 -0
  19. data/lib/mailgun/events/events.rb +53 -35
  20. data/lib/mailgun/exceptions/exceptions.rb +43 -10
  21. data/lib/mailgun/lists/opt_in_handler.rb +18 -19
  22. data/lib/mailgun/messages/batch_message.rb +31 -48
  23. data/lib/mailgun/messages/message_builder.rb +160 -144
  24. data/lib/mailgun/response.rb +55 -0
  25. data/lib/mailgun/version.rb +2 -3
  26. data/lib/mailgun/webhooks/webhooks.rb +101 -0
  27. data/mailgun.gemspec +16 -10
  28. data/spec/integration/bounces_spec.rb +44 -0
  29. data/spec/integration/campaign_spec.rb +60 -0
  30. data/spec/integration/complaints_spec.rb +38 -0
  31. data/spec/integration/domains_spec.rb +39 -0
  32. data/spec/integration/email_validation_spec.rb +29 -0
  33. data/spec/integration/events_spec.rb +20 -0
  34. data/spec/integration/list_members_spec.rb +63 -0
  35. data/spec/integration/list_spec.rb +58 -0
  36. data/spec/integration/mailgun_spec.rb +26 -550
  37. data/spec/integration/routes_spec.rb +74 -0
  38. data/spec/integration/stats_spec.rb +15 -0
  39. data/spec/integration/unsubscribes_spec.rb +42 -0
  40. data/spec/integration/webhook_spec.rb +54 -0
  41. data/spec/spec_helper.rb +37 -7
  42. data/spec/unit/connection/test_client.rb +15 -95
  43. data/spec/unit/events/events_spec.rb +9 -6
  44. data/spec/unit/lists/opt_in_handler_spec.rb +6 -4
  45. data/spec/unit/mailgun_spec.rb +25 -19
  46. data/spec/unit/messages/batch_message_spec.rb +47 -38
  47. data/spec/unit/messages/message_builder_spec.rb +282 -111
  48. data/vcr_cassettes/bounces.yml +175 -0
  49. data/vcr_cassettes/complaints.yml +175 -0
  50. data/vcr_cassettes/domains.todo.yml +42 -0
  51. data/vcr_cassettes/domains.yml +360 -0
  52. data/vcr_cassettes/email_validation.yml +104 -0
  53. data/vcr_cassettes/events.yml +61 -0
  54. data/vcr_cassettes/list_members.yml +320 -0
  55. data/vcr_cassettes/mailing_list.todo.yml +43 -0
  56. data/vcr_cassettes/mailing_list.yml +390 -0
  57. data/vcr_cassettes/routes.yml +359 -0
  58. data/vcr_cassettes/send_message.yml +107 -0
  59. data/vcr_cassettes/stats.yml +44 -0
  60. data/vcr_cassettes/unsubscribes.yml +191 -0
  61. data/vcr_cassettes/webhooks.yml +276 -0
  62. metadata +114 -10
@@ -0,0 +1,43 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/lists
6
+ body:
7
+ encoding: US-ASCII
8
+ string: address=integration_test_list%40DOMAIN.TEST&name=Integration%20Test%20List&description=This%20list%20should%20be%20deleted%20automatically.&access_level=members
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Length:
15
+ - '195'
16
+ Content-Type:
17
+ - application/x-www-form-urlencoded
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 400
23
+ message: Bad Request
24
+ headers:
25
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Fri, 08 Jan 2016 20:13:41 GMT
29
+ Content-Type:
30
+ - application/json
31
+ Content-Length:
32
+ - '35'
33
+ Connection:
34
+ - keep-alive
35
+ body:
36
+ encoding: UTF-8
37
+ string: |-
38
+ {
39
+ "message": "Duplicate object"
40
+ }
41
+ http_version:
42
+ recorded_at: Fri, 08 Jan 2016 20:13:41 GMT
43
+ recorded_with: VCR 3.0.1
@@ -0,0 +1,390 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/lists
6
+ body:
7
+ encoding: US-ASCII
8
+ string: address=integration_test_list%40DOMAIN.TEST&name=Integration%20Test%20List&description=This%20list%20should%20be%20deleted%20automatically.&access_level=members
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Length:
15
+ - '195'
16
+ Content-Type:
17
+ - application/x-www-form-urlencoded
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Fri, 08 Jan 2016 20:22:42 GMT
29
+ Content-Type:
30
+ - application/json
31
+ Content-Length:
32
+ - '361'
33
+ Connection:
34
+ - keep-alive
35
+ Content-Disposition:
36
+ - inline
37
+ Access-Control-Allow-Origin:
38
+ - "*"
39
+ Access-Control-Max-Age:
40
+ - '600'
41
+ Access-Control-Allow-Methods:
42
+ - GET, POST, PUT, DELETE, OPTIONS
43
+ Access-Control-Allow-Headers:
44
+ - Content-Type, x-requested-with
45
+ body:
46
+ encoding: UTF-8
47
+ string: |-
48
+ {
49
+ "list": {
50
+ "access_level": "members",
51
+ "address": "integration_test_list@DOMAIN.TEST",
52
+ "created_at": "Fri, 08 Jan 2016 20:22:42 -0000",
53
+ "description": "This list should be deleted automatically.",
54
+ "members_count": 0,
55
+ "name": "Integration Test List"
56
+ },
57
+ "message": "Mailing list has been created"
58
+ }
59
+ http_version:
60
+ recorded_at: Fri, 08 Jan 2016 20:22:43 GMT
61
+ - request:
62
+ method: get
63
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/lists/
64
+ body:
65
+ encoding: US-ASCII
66
+ string: ''
67
+ headers:
68
+ Accept:
69
+ - "*/*"
70
+ Accept-Encoding:
71
+ - gzip, deflate
72
+ User-Agent:
73
+ - Ruby
74
+ response:
75
+ status:
76
+ code: 404
77
+ message: Not Found
78
+ headers:
79
+ Server:
80
+ - nginx
81
+ Date:
82
+ - Fri, 08 Jan 2016 20:22:43 GMT
83
+ Content-Type:
84
+ - text/html; charset=utf-8
85
+ Content-Length:
86
+ - '233'
87
+ Connection:
88
+ - keep-alive
89
+ body:
90
+ encoding: UTF-8
91
+ string: |
92
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
93
+ <title>404 Not Found</title>
94
+ <h1>Not Found</h1>
95
+ <p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p>
96
+ http_version:
97
+ recorded_at: Fri, 08 Jan 2016 20:22:43 GMT
98
+ - request:
99
+ method: get
100
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/lists?limit=50
101
+ body:
102
+ encoding: US-ASCII
103
+ string: ''
104
+ headers:
105
+ Accept:
106
+ - "*/*"
107
+ Accept-Encoding:
108
+ - gzip, deflate
109
+ User-Agent:
110
+ - Ruby
111
+ response:
112
+ status:
113
+ code: 200
114
+ message: OK
115
+ headers:
116
+ Server:
117
+ - nginx
118
+ Date:
119
+ - Fri, 08 Jan 2016 20:22:44 GMT
120
+ Content-Type:
121
+ - application/json
122
+ Content-Length:
123
+ - '360'
124
+ Connection:
125
+ - keep-alive
126
+ Content-Disposition:
127
+ - inline
128
+ Access-Control-Allow-Origin:
129
+ - "*"
130
+ Access-Control-Max-Age:
131
+ - '600'
132
+ Access-Control-Allow-Methods:
133
+ - GET, POST, PUT, DELETE, OPTIONS
134
+ Access-Control-Allow-Headers:
135
+ - Content-Type, x-requested-with
136
+ body:
137
+ encoding: UTF-8
138
+ string: |-
139
+ {
140
+ "items": [
141
+ {
142
+ "access_level": "members",
143
+ "address": "integration_test_list@DOMAIN.TEST",
144
+ "created_at": "Fri, 08 Jan 2016 20:22:42 -0000",
145
+ "description": "This list should be deleted automatically.",
146
+ "members_count": 0,
147
+ "name": "Integration Test List"
148
+ }
149
+ ],
150
+ "total_count": 1
151
+ }
152
+ http_version:
153
+ recorded_at: Fri, 08 Jan 2016 20:22:44 GMT
154
+ - request:
155
+ method: put
156
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/lists/
157
+ body:
158
+ encoding: US-ASCII
159
+ string: address=&name=Integration%20Test%20List%20Update&description=This%20list%20should%20be%20deleted%20automatically.&access_level=readonly
160
+ headers:
161
+ Accept:
162
+ - "*/*; q=0.5, application/xml"
163
+ Accept-Encoding:
164
+ - gzip, deflate
165
+ Content-Length:
166
+ - '135'
167
+ Content-Type:
168
+ - application/x-www-form-urlencoded
169
+ User-Agent:
170
+ - Ruby
171
+ response:
172
+ status:
173
+ code: 404
174
+ message: Not Found
175
+ headers:
176
+ Server:
177
+ - nginx
178
+ Date:
179
+ - Fri, 08 Jan 2016 20:22:44 GMT
180
+ Content-Type:
181
+ - text/html; charset=utf-8
182
+ Content-Length:
183
+ - '233'
184
+ Connection:
185
+ - keep-alive
186
+ body:
187
+ encoding: UTF-8
188
+ string: |
189
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
190
+ <title>404 Not Found</title>
191
+ <h1>Not Found</h1>
192
+ <p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p>
193
+ http_version:
194
+ recorded_at: Fri, 08 Jan 2016 20:22:45 GMT
195
+ - request:
196
+ method: delete
197
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/lists/
198
+ body:
199
+ encoding: US-ASCII
200
+ string: ''
201
+ headers:
202
+ Accept:
203
+ - "*/*; q=0.5, application/xml"
204
+ Accept-Encoding:
205
+ - gzip, deflate
206
+ User-Agent:
207
+ - Ruby
208
+ response:
209
+ status:
210
+ code: 404
211
+ message: Not Found
212
+ headers:
213
+ Server:
214
+ - nginx
215
+ Date:
216
+ - Fri, 08 Jan 2016 20:22:45 GMT
217
+ Content-Type:
218
+ - text/html; charset=utf-8
219
+ Content-Length:
220
+ - '233'
221
+ Connection:
222
+ - keep-alive
223
+ body:
224
+ encoding: UTF-8
225
+ string: |
226
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
227
+ <title>404 Not Found</title>
228
+ <h1>Not Found</h1>
229
+ <p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p>
230
+ http_version:
231
+ recorded_at: Fri, 08 Jan 2016 20:22:45 GMT
232
+ - request:
233
+ method: get
234
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/lists/integration_test_list@DOMAIN.TEST
235
+ body:
236
+ encoding: US-ASCII
237
+ string: ''
238
+ headers:
239
+ Accept:
240
+ - "*/*"
241
+ Accept-Encoding:
242
+ - gzip, deflate
243
+ User-Agent:
244
+ - Ruby
245
+ response:
246
+ status:
247
+ code: 200
248
+ message: OK
249
+ headers:
250
+ Server:
251
+ - nginx
252
+ Date:
253
+ - Fri, 08 Jan 2016 20:23:02 GMT
254
+ Content-Type:
255
+ - application/json
256
+ Content-Length:
257
+ - '315'
258
+ Connection:
259
+ - keep-alive
260
+ Content-Disposition:
261
+ - inline
262
+ Access-Control-Allow-Origin:
263
+ - "*"
264
+ Access-Control-Max-Age:
265
+ - '600'
266
+ Access-Control-Allow-Methods:
267
+ - GET, POST, PUT, DELETE, OPTIONS
268
+ Access-Control-Allow-Headers:
269
+ - Content-Type, x-requested-with
270
+ body:
271
+ encoding: UTF-8
272
+ string: |-
273
+ {
274
+ "list": {
275
+ "access_level": "members",
276
+ "address": "integration_test_list@DOMAIN.TEST",
277
+ "created_at": "Fri, 08 Jan 2016 20:22:42 -0000",
278
+ "description": "This list should be deleted automatically.",
279
+ "members_count": 0,
280
+ "name": "Integration Test List"
281
+ }
282
+ }
283
+ http_version:
284
+ recorded_at: Fri, 08 Jan 2016 20:23:02 GMT
285
+ - request:
286
+ method: put
287
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/lists/integration_test_list@DOMAIN.TEST
288
+ body:
289
+ encoding: US-ASCII
290
+ string: address=integration_test_list%40DOMAIN.TEST&name=Integration%20Test%20List%20Update&description=This%20list%20should%20be%20deleted%20automatically.&access_level=readonly
291
+ headers:
292
+ Accept:
293
+ - "*/*; q=0.5, application/xml"
294
+ Accept-Encoding:
295
+ - gzip, deflate
296
+ Content-Length:
297
+ - '205'
298
+ Content-Type:
299
+ - application/x-www-form-urlencoded
300
+ User-Agent:
301
+ - Ruby
302
+ response:
303
+ status:
304
+ code: 200
305
+ message: OK
306
+ headers:
307
+ Server:
308
+ - nginx
309
+ Date:
310
+ - Fri, 08 Jan 2016 20:23:02 GMT
311
+ Content-Type:
312
+ - application/json
313
+ Content-Length:
314
+ - '369'
315
+ Connection:
316
+ - keep-alive
317
+ Content-Disposition:
318
+ - inline
319
+ Access-Control-Allow-Origin:
320
+ - "*"
321
+ Access-Control-Max-Age:
322
+ - '600'
323
+ Access-Control-Allow-Methods:
324
+ - GET, POST, PUT, DELETE, OPTIONS
325
+ Access-Control-Allow-Headers:
326
+ - Content-Type, x-requested-with
327
+ body:
328
+ encoding: UTF-8
329
+ string: |-
330
+ {
331
+ "list": {
332
+ "access_level": "readonly",
333
+ "address": "integration_test_list@DOMAIN.TEST",
334
+ "created_at": "Fri, 08 Jan 2016 20:22:42 -0000",
335
+ "description": "This list should be deleted automatically.",
336
+ "members_count": 0,
337
+ "name": "Integration Test List Update"
338
+ },
339
+ "message": "Mailing list has been updated"
340
+ }
341
+ http_version:
342
+ recorded_at: Fri, 08 Jan 2016 20:23:03 GMT
343
+ - request:
344
+ method: delete
345
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/lists/integration_test_list@DOMAIN.TEST
346
+ body:
347
+ encoding: US-ASCII
348
+ string: ''
349
+ headers:
350
+ Accept:
351
+ - "*/*; q=0.5, application/xml"
352
+ Accept-Encoding:
353
+ - gzip, deflate
354
+ User-Agent:
355
+ - Ruby
356
+ response:
357
+ status:
358
+ code: 200
359
+ message: OK
360
+ headers:
361
+ Server:
362
+ - nginx
363
+ Date:
364
+ - Fri, 08 Jan 2016 20:23:03 GMT
365
+ Content-Type:
366
+ - application/json
367
+ Content-Length:
368
+ - '133'
369
+ Connection:
370
+ - keep-alive
371
+ Content-Disposition:
372
+ - inline
373
+ Access-Control-Allow-Origin:
374
+ - "*"
375
+ Access-Control-Max-Age:
376
+ - '600'
377
+ Access-Control-Allow-Methods:
378
+ - GET, POST, PUT, DELETE, OPTIONS
379
+ Access-Control-Allow-Headers:
380
+ - Content-Type, x-requested-with
381
+ body:
382
+ encoding: UTF-8
383
+ string: |-
384
+ {
385
+ "address": "integration_test_list@DOMAIN.TEST",
386
+ "message": "Mailing list has been removed"
387
+ }
388
+ http_version:
389
+ recorded_at: Fri, 08 Jan 2016 20:23:03 GMT
390
+ recorded_with: VCR 3.0.1
@@ -0,0 +1,359 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/routes
6
+ body:
7
+ encoding: US-ASCII
8
+ string: priority=10&description=Integration%20Test%20Route&expression=match_recipient(%22alice%40DOMAIN.TEST%22)&action=forward(%22.*%40DOMAIN.TEST%22)
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Length:
15
+ - '213'
16
+ Content-Type:
17
+ - application/x-www-form-urlencoded
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Fri, 08 Jan 2016 20:08:18 GMT
29
+ Content-Type:
30
+ - application/json
31
+ Content-Length:
32
+ - '402'
33
+ Connection:
34
+ - keep-alive
35
+ Content-Disposition:
36
+ - inline
37
+ Access-Control-Allow-Origin:
38
+ - "*"
39
+ Access-Control-Max-Age:
40
+ - '600'
41
+ Access-Control-Allow-Methods:
42
+ - GET, POST, PUT, DELETE, OPTIONS
43
+ Access-Control-Allow-Headers:
44
+ - Content-Type, x-requested-with
45
+ body:
46
+ encoding: UTF-8
47
+ string: |-
48
+ {
49
+ "message": "Route has been created",
50
+ "route": {
51
+ "actions": [
52
+ "forward(\".*@DOMAIN.TEST\")"
53
+ ],
54
+ "created_at": "Fri, 08 Jan 2016 20:08:18 GMT",
55
+ "description": "Integration Test Route",
56
+ "expression": "match_recipient(\"alice@DOMAIN.TEST\")",
57
+ "id": "5690173212573000be30671e",
58
+ "priority": 10
59
+ }
60
+ }
61
+ http_version:
62
+ recorded_at: Fri, 08 Jan 2016 20:08:19 GMT
63
+ - request:
64
+ method: get
65
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/routes?limit=50
66
+ body:
67
+ encoding: US-ASCII
68
+ string: ''
69
+ headers:
70
+ Accept:
71
+ - "*/*"
72
+ Accept-Encoding:
73
+ - gzip, deflate
74
+ User-Agent:
75
+ - Ruby
76
+ response:
77
+ status:
78
+ code: 200
79
+ message: OK
80
+ headers:
81
+ Server:
82
+ - nginx
83
+ Date:
84
+ - Fri, 08 Jan 2016 20:08:18 GMT
85
+ Content-Type:
86
+ - application/json
87
+ Content-Length:
88
+ - '1155'
89
+ Connection:
90
+ - keep-alive
91
+ Content-Disposition:
92
+ - inline
93
+ Access-Control-Allow-Origin:
94
+ - "*"
95
+ Access-Control-Max-Age:
96
+ - '600'
97
+ Access-Control-Allow-Methods:
98
+ - GET, POST, PUT, DELETE, OPTIONS
99
+ Access-Control-Allow-Headers:
100
+ - Content-Type, x-requested-with
101
+ body:
102
+ encoding: UTF-8
103
+ string: |-
104
+ {
105
+ "items": [
106
+ {
107
+ "actions": [
108
+ "forward(\".*@DOMAIN.TEST\")"
109
+ ],
110
+ "created_at": "Fri, 08 Jan 2016 20:08:18 GMT",
111
+ "description": "Integration Test Route",
112
+ "expression": "match_recipient(\"alice@DOMAIN.TEST\")",
113
+ "id": "5690173212573000be30671e",
114
+ "priority": 10
115
+ },
116
+ {
117
+ "actions": [
118
+ "forward(\".*@DOMAIN.TEST\")"
119
+ ],
120
+ "created_at": "Fri, 08 Jan 2016 19:55:02 GMT",
121
+ "description": "Integration Test Route",
122
+ "expression": "match_recipient(\"alice@DOMAIN.TEST\")",
123
+ "id": "5690141612573000b69c0e35",
124
+ "priority": 10
125
+ },
126
+ {
127
+ "actions": [
128
+ "forward(\".*@DOMAIN.TEST\")"
129
+ ],
130
+ "created_at": "Fri, 08 Jan 2016 19:53:50 GMT",
131
+ "description": "Integration Test Route",
132
+ "expression": "match_recipient(\"alice@DOMAIN.TEST\")",
133
+ "id": "569013ce11e2bdcea3fbcd1d",
134
+ "priority": 10
135
+ }
136
+ ],
137
+ "total_count": 3
138
+ }
139
+ http_version:
140
+ recorded_at: Fri, 08 Jan 2016 20:08:19 GMT
141
+ - request:
142
+ method: get
143
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/routes?limit=1
144
+ body:
145
+ encoding: US-ASCII
146
+ string: ''
147
+ headers:
148
+ Accept:
149
+ - "*/*"
150
+ Accept-Encoding:
151
+ - gzip, deflate
152
+ User-Agent:
153
+ - Ruby
154
+ response:
155
+ status:
156
+ code: 200
157
+ message: OK
158
+ headers:
159
+ Server:
160
+ - nginx
161
+ Date:
162
+ - Fri, 08 Jan 2016 20:08:19 GMT
163
+ Content-Type:
164
+ - application/json
165
+ Content-Length:
166
+ - '411'
167
+ Connection:
168
+ - keep-alive
169
+ Content-Disposition:
170
+ - inline
171
+ Access-Control-Allow-Origin:
172
+ - "*"
173
+ Access-Control-Max-Age:
174
+ - '600'
175
+ Access-Control-Allow-Methods:
176
+ - GET, POST, PUT, DELETE, OPTIONS
177
+ Access-Control-Allow-Headers:
178
+ - Content-Type, x-requested-with
179
+ body:
180
+ encoding: UTF-8
181
+ string: |-
182
+ {
183
+ "items": [
184
+ {
185
+ "actions": [
186
+ "forward(\".*@DOMAIN.TEST\")"
187
+ ],
188
+ "created_at": "Fri, 08 Jan 2016 20:08:18 GMT",
189
+ "description": "Integration Test Route",
190
+ "expression": "match_recipient(\"alice@DOMAIN.TEST\")",
191
+ "id": "5690173212573000be30671e",
192
+ "priority": 10
193
+ }
194
+ ],
195
+ "total_count": 3
196
+ }
197
+ http_version:
198
+ recorded_at: Fri, 08 Jan 2016 20:08:19 GMT
199
+ - request:
200
+ method: get
201
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/routes/5690173212573000be30671e
202
+ body:
203
+ encoding: US-ASCII
204
+ string: ''
205
+ headers:
206
+ Accept:
207
+ - "*/*"
208
+ Accept-Encoding:
209
+ - gzip, deflate
210
+ User-Agent:
211
+ - Ruby
212
+ response:
213
+ status:
214
+ code: 200
215
+ message: OK
216
+ headers:
217
+ Server:
218
+ - nginx
219
+ Date:
220
+ - Fri, 08 Jan 2016 20:08:19 GMT
221
+ Content-Type:
222
+ - application/json
223
+ Content-Length:
224
+ - '363'
225
+ Connection:
226
+ - keep-alive
227
+ Content-Disposition:
228
+ - inline
229
+ Access-Control-Allow-Origin:
230
+ - "*"
231
+ Access-Control-Max-Age:
232
+ - '600'
233
+ Access-Control-Allow-Methods:
234
+ - GET, POST, PUT, DELETE, OPTIONS
235
+ Access-Control-Allow-Headers:
236
+ - Content-Type, x-requested-with
237
+ body:
238
+ encoding: UTF-8
239
+ string: |-
240
+ {
241
+ "route": {
242
+ "actions": [
243
+ "forward(\".*@DOMAIN.TEST\")"
244
+ ],
245
+ "created_at": "Fri, 08 Jan 2016 20:08:18 GMT",
246
+ "description": "Integration Test Route",
247
+ "expression": "match_recipient(\"alice@DOMAIN.TEST\")",
248
+ "id": "5690173212573000be30671e",
249
+ "priority": 10
250
+ }
251
+ }
252
+ http_version:
253
+ recorded_at: Fri, 08 Jan 2016 20:08:19 GMT
254
+ - request:
255
+ method: put
256
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/routes/5690173212573000be30671e
257
+ body:
258
+ encoding: US-ASCII
259
+ string: priority=10&description=Integration%20Test%20Route%20Update&expression=match_recipient(%22alice%40DOMAIN.TEST%22)&action=forward(%22.*%40DOMAIN.TEST%22)
260
+ headers:
261
+ Accept:
262
+ - "*/*; q=0.5, application/xml"
263
+ Accept-Encoding:
264
+ - gzip, deflate
265
+ Content-Length:
266
+ - '222'
267
+ Content-Type:
268
+ - application/x-www-form-urlencoded
269
+ User-Agent:
270
+ - Ruby
271
+ response:
272
+ status:
273
+ code: 200
274
+ message: OK
275
+ headers:
276
+ Server:
277
+ - nginx
278
+ Date:
279
+ - Fri, 08 Jan 2016 20:08:19 GMT
280
+ Content-Type:
281
+ - application/json
282
+ Content-Length:
283
+ - '376'
284
+ Connection:
285
+ - keep-alive
286
+ Content-Disposition:
287
+ - inline
288
+ Access-Control-Allow-Origin:
289
+ - "*"
290
+ Access-Control-Max-Age:
291
+ - '600'
292
+ Access-Control-Allow-Methods:
293
+ - GET, POST, PUT, DELETE, OPTIONS
294
+ Access-Control-Allow-Headers:
295
+ - Content-Type, x-requested-with
296
+ body:
297
+ encoding: UTF-8
298
+ string: |-
299
+ {
300
+ "actions": [
301
+ "forward(\".*@DOMAIN.TEST\")"
302
+ ],
303
+ "created_at": "Fri, 08 Jan 2016 20:08:18 GMT",
304
+ "description": "Integration Test Route Update",
305
+ "expression": "match_recipient(\"alice@DOMAIN.TEST\")",
306
+ "id": "5690173212573000be30671e",
307
+ "message": "Route has been updated",
308
+ "priority": 10
309
+ }
310
+ http_version:
311
+ recorded_at: Fri, 08 Jan 2016 20:08:19 GMT
312
+ - request:
313
+ method: delete
314
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/routes/5690173212573000be30671e
315
+ body:
316
+ encoding: US-ASCII
317
+ string: ''
318
+ headers:
319
+ Accept:
320
+ - "*/*; q=0.5, application/xml"
321
+ Accept-Encoding:
322
+ - gzip, deflate
323
+ User-Agent:
324
+ - Ruby
325
+ response:
326
+ status:
327
+ code: 200
328
+ message: OK
329
+ headers:
330
+ Server:
331
+ - nginx
332
+ Date:
333
+ - Fri, 08 Jan 2016 20:08:19 GMT
334
+ Content-Type:
335
+ - application/json
336
+ Content-Length:
337
+ - '77'
338
+ Connection:
339
+ - keep-alive
340
+ Content-Disposition:
341
+ - inline
342
+ Access-Control-Allow-Origin:
343
+ - "*"
344
+ Access-Control-Max-Age:
345
+ - '600'
346
+ Access-Control-Allow-Methods:
347
+ - GET, POST, PUT, DELETE, OPTIONS
348
+ Access-Control-Allow-Headers:
349
+ - Content-Type, x-requested-with
350
+ body:
351
+ encoding: UTF-8
352
+ string: |-
353
+ {
354
+ "id": "5690173212573000be30671e",
355
+ "message": "Route has been deleted"
356
+ }
357
+ http_version:
358
+ recorded_at: Fri, 08 Jan 2016 20:08:20 GMT
359
+ recorded_with: VCR 3.0.1