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,175 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/DOMAIN.TEST/bounces
6
+ body:
7
+ encoding: US-ASCII
8
+ string: address=integration-test-email%40DOMAIN.TEST&code=550&error=Integration%20Test
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Length:
15
+ - '113'
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:33:28 GMT
29
+ Content-Type:
30
+ - application/json; charset=utf-8
31
+ Content-Length:
32
+ - '139'
33
+ Connection:
34
+ - keep-alive
35
+ Access-Control-Allow-Origin:
36
+ - "*"
37
+ Access-Control-Max-Age:
38
+ - '600'
39
+ Access-Control-Allow-Methods:
40
+ - GET, POST, PUT, DELETE, OPTIONS
41
+ Access-Control-Allow-Headers:
42
+ - Content-Type, x-requested-with
43
+ body:
44
+ encoding: UTF-8
45
+ string: '{"address":"integration-test-email@DOMAIN.TEST","message":"Address
46
+ has been added to the bounces table"}'
47
+ http_version:
48
+ recorded_at: Fri, 08 Jan 2016 20:33:29 GMT
49
+ - request:
50
+ method: get
51
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/DOMAIN.TEST/bounces/integration-test-email@DOMAIN.TEST
52
+ body:
53
+ encoding: US-ASCII
54
+ string: ''
55
+ headers:
56
+ Accept:
57
+ - "*/*"
58
+ Accept-Encoding:
59
+ - gzip, deflate
60
+ User-Agent:
61
+ - Ruby
62
+ response:
63
+ status:
64
+ code: 200
65
+ message: OK
66
+ headers:
67
+ Server:
68
+ - nginx
69
+ Date:
70
+ - Fri, 08 Jan 2016 20:33:28 GMT
71
+ Content-Type:
72
+ - application/json; charset=utf-8
73
+ Content-Length:
74
+ - '168'
75
+ Connection:
76
+ - keep-alive
77
+ Access-Control-Allow-Origin:
78
+ - "*"
79
+ Access-Control-Max-Age:
80
+ - '600'
81
+ Access-Control-Allow-Methods:
82
+ - GET, POST, PUT, DELETE, OPTIONS
83
+ Access-Control-Allow-Headers:
84
+ - Content-Type, x-requested-with
85
+ body:
86
+ encoding: UTF-8
87
+ string: '{"address":"integration-test-email@DOMAIN.TEST","code":"550","error":"Integration
88
+ Test","created_at":"Fri, 08 Jan 2016 20:33:28 UTC"}'
89
+ http_version:
90
+ recorded_at: Fri, 08 Jan 2016 20:33:29 GMT
91
+ - request:
92
+ method: get
93
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/DOMAIN.TEST/bounces
94
+ body:
95
+ encoding: US-ASCII
96
+ string: ''
97
+ headers:
98
+ Accept:
99
+ - "*/*"
100
+ Accept-Encoding:
101
+ - gzip, deflate
102
+ User-Agent:
103
+ - Ruby
104
+ response:
105
+ status:
106
+ code: 200
107
+ message: OK
108
+ headers:
109
+ Server:
110
+ - nginx
111
+ Date:
112
+ - Fri, 08 Jan 2016 20:33:29 GMT
113
+ Content-Type:
114
+ - application/json; charset=utf-8
115
+ Content-Length:
116
+ - '819'
117
+ Connection:
118
+ - keep-alive
119
+ Access-Control-Allow-Origin:
120
+ - "*"
121
+ Access-Control-Max-Age:
122
+ - '600'
123
+ Access-Control-Allow-Methods:
124
+ - GET, POST, PUT, DELETE, OPTIONS
125
+ Access-Control-Allow-Headers:
126
+ - Content-Type, x-requested-with
127
+ body:
128
+ encoding: UTF-8
129
+ string: '{"items":[{"address":"integration-test-email@DOMAIN.TEST","code":"550","error":"Integration
130
+ Test","created_at":"Fri, 08 Jan 2016 20:33:28 UTC"}],"paging":{"first":"https://api.mailgun.net/v3/DOMAIN.TEST/bounces?limit=100","last":"https://api.mailgun.net/v3/DOMAIN.TEST/bounces?page=last\u0026limit=100","next":"https://api.mailgun.net/v3/DOMAIN.TEST/bounces?page=next\u0026address=integration-test-email%40DOMAIN.TEST\u0026limit=100","previous":"https://api.mailgun.net/v3/DOMAIN.TEST/bounces?page=previous\u0026address=integration-test-email%40DOMAIN.TEST\u0026limit=100"}}'
131
+ http_version:
132
+ recorded_at: Fri, 08 Jan 2016 20:33:29 GMT
133
+ - request:
134
+ method: delete
135
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/DOMAIN.TEST/bounces/integration-test-email@DOMAIN.TEST
136
+ body:
137
+ encoding: US-ASCII
138
+ string: ''
139
+ headers:
140
+ Accept:
141
+ - "*/*; q=0.5, application/xml"
142
+ Accept-Encoding:
143
+ - gzip, deflate
144
+ User-Agent:
145
+ - Ruby
146
+ response:
147
+ status:
148
+ code: 200
149
+ message: OK
150
+ headers:
151
+ Server:
152
+ - nginx
153
+ Date:
154
+ - Fri, 08 Jan 2016 20:33:29 GMT
155
+ Content-Type:
156
+ - application/json; charset=utf-8
157
+ Content-Length:
158
+ - '128'
159
+ Connection:
160
+ - keep-alive
161
+ Access-Control-Allow-Origin:
162
+ - "*"
163
+ Access-Control-Max-Age:
164
+ - '600'
165
+ Access-Control-Allow-Methods:
166
+ - GET, POST, PUT, DELETE, OPTIONS
167
+ Access-Control-Allow-Headers:
168
+ - Content-Type, x-requested-with
169
+ body:
170
+ encoding: UTF-8
171
+ string: '{"address":"integration-test-email@DOMAIN.TEST","message":"Bounced
172
+ address has been removed"}'
173
+ http_version:
174
+ recorded_at: Fri, 08 Jan 2016 20:33:30 GMT
175
+ recorded_with: VCR 3.0.1
@@ -0,0 +1,175 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/DOMAIN.TEST/complaints
6
+ body:
7
+ encoding: US-ASCII
8
+ string: address=integration-test-email%40DOMAIN.TEST
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Length:
15
+ - '79'
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:31:59 GMT
29
+ Content-Type:
30
+ - application/json; charset=utf-8
31
+ Content-Length:
32
+ - '142'
33
+ Connection:
34
+ - keep-alive
35
+ Access-Control-Allow-Origin:
36
+ - "*"
37
+ Access-Control-Max-Age:
38
+ - '600'
39
+ Access-Control-Allow-Methods:
40
+ - GET, POST, PUT, DELETE, OPTIONS
41
+ Access-Control-Allow-Headers:
42
+ - Content-Type, x-requested-with
43
+ body:
44
+ encoding: UTF-8
45
+ string: '{"address":"integration-test-email@DOMAIN.TEST","message":"Address
46
+ has been added to the complaints table"}'
47
+ http_version:
48
+ recorded_at: Fri, 08 Jan 2016 20:31:59 GMT
49
+ - request:
50
+ method: get
51
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/DOMAIN.TEST/complaints/integration-test-email@DOMAIN.TEST
52
+ body:
53
+ encoding: US-ASCII
54
+ string: ''
55
+ headers:
56
+ Accept:
57
+ - "*/*"
58
+ Accept-Encoding:
59
+ - gzip, deflate
60
+ User-Agent:
61
+ - Ruby
62
+ response:
63
+ status:
64
+ code: 200
65
+ message: OK
66
+ headers:
67
+ Server:
68
+ - nginx
69
+ Date:
70
+ - Fri, 08 Jan 2016 20:31:59 GMT
71
+ Content-Type:
72
+ - application/json; charset=utf-8
73
+ Content-Length:
74
+ - '128'
75
+ Connection:
76
+ - keep-alive
77
+ Access-Control-Allow-Origin:
78
+ - "*"
79
+ Access-Control-Max-Age:
80
+ - '600'
81
+ Access-Control-Allow-Methods:
82
+ - GET, POST, PUT, DELETE, OPTIONS
83
+ Access-Control-Allow-Headers:
84
+ - Content-Type, x-requested-with
85
+ body:
86
+ encoding: UTF-8
87
+ string: '{"address":"integration-test-email@DOMAIN.TEST","created_at":"Fri,
88
+ 08 Jan 2016 20:31:59 UTC"}'
89
+ http_version:
90
+ recorded_at: Fri, 08 Jan 2016 20:32:00 GMT
91
+ - request:
92
+ method: get
93
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/DOMAIN.TEST/complaints
94
+ body:
95
+ encoding: US-ASCII
96
+ string: ''
97
+ headers:
98
+ Accept:
99
+ - "*/*"
100
+ Accept-Encoding:
101
+ - gzip, deflate
102
+ User-Agent:
103
+ - Ruby
104
+ response:
105
+ status:
106
+ code: 200
107
+ message: OK
108
+ headers:
109
+ Server:
110
+ - nginx
111
+ Date:
112
+ - Fri, 08 Jan 2016 20:31:59 GMT
113
+ Content-Type:
114
+ - application/json; charset=utf-8
115
+ Content-Length:
116
+ - '791'
117
+ Connection:
118
+ - keep-alive
119
+ Access-Control-Allow-Origin:
120
+ - "*"
121
+ Access-Control-Max-Age:
122
+ - '600'
123
+ Access-Control-Allow-Methods:
124
+ - GET, POST, PUT, DELETE, OPTIONS
125
+ Access-Control-Allow-Headers:
126
+ - Content-Type, x-requested-with
127
+ body:
128
+ encoding: UTF-8
129
+ string: '{"items":[{"address":"integration-test-email@DOMAIN.TEST","created_at":"Fri,
130
+ 08 Jan 2016 20:31:59 UTC"}],"paging":{"first":"https://api.mailgun.net/v3/DOMAIN.TEST/complaints?limit=100","last":"https://api.mailgun.net/v3/DOMAIN.TEST/complaints?page=last\u0026limit=100","next":"https://api.mailgun.net/v3/DOMAIN.TEST/complaints?page=next\u0026address=integration-test-email%40DOMAIN.TEST\u0026limit=100","previous":"https://api.mailgun.net/v3/DOMAIN.TEST/complaints?page=previous\u0026address=integration-test-email%40DOMAIN.TEST\u0026limit=100"}}'
131
+ http_version:
132
+ recorded_at: Fri, 08 Jan 2016 20:32:00 GMT
133
+ - request:
134
+ method: delete
135
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/DOMAIN.TEST/complaints/integration-test-email@DOMAIN.TEST
136
+ body:
137
+ encoding: US-ASCII
138
+ string: ''
139
+ headers:
140
+ Accept:
141
+ - "*/*; q=0.5, application/xml"
142
+ Accept-Encoding:
143
+ - gzip, deflate
144
+ User-Agent:
145
+ - Ruby
146
+ response:
147
+ status:
148
+ code: 200
149
+ message: OK
150
+ headers:
151
+ Server:
152
+ - nginx
153
+ Date:
154
+ - Fri, 08 Jan 2016 20:31:59 GMT
155
+ Content-Type:
156
+ - application/json; charset=utf-8
157
+ Content-Length:
158
+ - '127'
159
+ Connection:
160
+ - keep-alive
161
+ Access-Control-Allow-Origin:
162
+ - "*"
163
+ Access-Control-Max-Age:
164
+ - '600'
165
+ Access-Control-Allow-Methods:
166
+ - GET, POST, PUT, DELETE, OPTIONS
167
+ Access-Control-Allow-Headers:
168
+ - Content-Type, x-requested-with
169
+ body:
170
+ encoding: UTF-8
171
+ string: '{"address":"integration-test-email@DOMAIN.TEST","message":"Spam complaint
172
+ has been removed"}'
173
+ http_version:
174
+ recorded_at: Fri, 08 Jan 2016 20:32:00 GMT
175
+ recorded_with: VCR 3.0.1
@@ -0,0 +1,42 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/domains
6
+ body:
7
+ encoding: US-ASCII
8
+ string: name=integration-test.domain.invalid&smtp_password=super_secret&spam_action=tag
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Length:
15
+ - '79'
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:34:40 GMT
29
+ Content-Type:
30
+ - application/json
31
+ Content-Length:
32
+ - '52'
33
+ Connection:
34
+ - keep-alive
35
+ body:
36
+ encoding: UTF-8
37
+ string: |-
38
+ {
39
+ "message": "This domain name is already taken"
40
+ }
41
+ http_version:
42
+ recorded_at: Fri, 08 Jan 2016 20:34:41 GMT
@@ -0,0 +1,360 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/domains
6
+ body:
7
+ encoding: US-ASCII
8
+ string: smtp_password=super_secret&spam_action=tag&wildcard=false&name=integration-test.domain.invalid
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Length:
15
+ - '94'
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, 15 Jan 2016 20:11:28 GMT
29
+ Content-Type:
30
+ - application/json
31
+ Content-Length:
32
+ - '1417'
33
+ Connection:
34
+ - keep-alive
35
+ Content-Disposition:
36
+ - inline
37
+ Access-Control-Allow-Origin:
38
+ - "*"
39
+ - "*"
40
+ Access-Control-Max-Age:
41
+ - '600'
42
+ - '600'
43
+ Access-Control-Allow-Methods:
44
+ - GET, POST, PUT, DELETE, OPTIONS
45
+ - GET, POST, PUT, DELETE, OPTIONS
46
+ Access-Control-Allow-Headers:
47
+ - Content-Type, x-requested-with
48
+ - Content-Type, x-requested-with
49
+ body:
50
+ encoding: UTF-8
51
+ string: |-
52
+ {
53
+ "domain": {
54
+ "created_at": "Fri, 15 Jan 2016 20:11:28 GMT",
55
+ "name": "integration-test.domain.invalid",
56
+ "require_tls": false,
57
+ "skip_verification": false,
58
+ "smtp_login": "postmaster@integration-test.domain.invalid",
59
+ "smtp_password": "super_secret",
60
+ "spam_action": "tag",
61
+ "state": "unverified",
62
+ "type": "custom",
63
+ "wildcard": false
64
+ },
65
+ "message": "Domain has been created",
66
+ "receiving_dns_records": [
67
+ {
68
+ "priority": "10",
69
+ "record_type": "MX",
70
+ "valid": "unknown",
71
+ "value": "mxa.mailgun.org"
72
+ },
73
+ {
74
+ "priority": "10",
75
+ "record_type": "MX",
76
+ "valid": "unknown",
77
+ "value": "mxb.mailgun.org"
78
+ }
79
+ ],
80
+ "sending_dns_records": [
81
+ {
82
+ "name": "integration-test.domain.invalid",
83
+ "record_type": "TXT",
84
+ "valid": "unknown",
85
+ "value": "v=spf1 include:mailgun.org ~all"
86
+ },
87
+ {
88
+ "name": "pic._domainkey.integration-test.domain.invalid",
89
+ "record_type": "TXT",
90
+ "valid": "unknown",
91
+ "value": "k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCYHL7d9j0Y2Vzt11AQk3ZoO2tNu4E3MRJvjw4Uhw3WY2iUpM4x1pw/L+nzGFyd0NfCVLea6mafUTeTWTMIocQVZLWqtnVPONS+YkQTqo1xtcZzC7GMBEVA+VsEMAYbw57pyIu1DQVW+dnqd7cbb4POdLk3Jy75w59Mys8/9GQUNQIDAQAB"
92
+ },
93
+ {
94
+ "name": "email.integration-test.domain.invalid",
95
+ "record_type": "CNAME",
96
+ "valid": "unknown",
97
+ "value": "mailgun.org"
98
+ }
99
+ ]
100
+ }
101
+ http_version:
102
+ recorded_at: Fri, 15 Jan 2016 20:11:29 GMT
103
+ - request:
104
+ method: get
105
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/domains/integration-test.domain.invalid
106
+ body:
107
+ encoding: US-ASCII
108
+ string: ''
109
+ headers:
110
+ Accept:
111
+ - "*/*"
112
+ Accept-Encoding:
113
+ - gzip, deflate
114
+ User-Agent:
115
+ - Ruby
116
+ response:
117
+ status:
118
+ code: 200
119
+ message: OK
120
+ headers:
121
+ Server:
122
+ - nginx
123
+ Date:
124
+ - Fri, 15 Jan 2016 20:11:29 GMT
125
+ Content-Type:
126
+ - application/json
127
+ Content-Length:
128
+ - '1377'
129
+ Connection:
130
+ - keep-alive
131
+ Content-Disposition:
132
+ - inline
133
+ Access-Control-Allow-Origin:
134
+ - "*"
135
+ - "*"
136
+ Access-Control-Max-Age:
137
+ - '600'
138
+ - '600'
139
+ Access-Control-Allow-Methods:
140
+ - GET, POST, PUT, DELETE, OPTIONS
141
+ - GET, POST, PUT, DELETE, OPTIONS
142
+ Access-Control-Allow-Headers:
143
+ - Content-Type, x-requested-with
144
+ - Content-Type, x-requested-with
145
+ body:
146
+ encoding: UTF-8
147
+ string: |-
148
+ {
149
+ "domain": {
150
+ "created_at": "Fri, 15 Jan 2016 20:11:28 GMT",
151
+ "name": "integration-test.domain.invalid",
152
+ "require_tls": false,
153
+ "skip_verification": false,
154
+ "smtp_login": "postmaster@integration-test.domain.invalid",
155
+ "smtp_password": "super_secret",
156
+ "spam_action": "tag",
157
+ "state": "unverified",
158
+ "type": "custom",
159
+ "wildcard": false
160
+ },
161
+ "receiving_dns_records": [
162
+ {
163
+ "priority": "10",
164
+ "record_type": "MX",
165
+ "valid": "unknown",
166
+ "value": "mxa.mailgun.org"
167
+ },
168
+ {
169
+ "priority": "10",
170
+ "record_type": "MX",
171
+ "valid": "unknown",
172
+ "value": "mxb.mailgun.org"
173
+ }
174
+ ],
175
+ "sending_dns_records": [
176
+ {
177
+ "name": "integration-test.domain.invalid",
178
+ "record_type": "TXT",
179
+ "valid": "unknown",
180
+ "value": "v=spf1 include:mailgun.org ~all"
181
+ },
182
+ {
183
+ "name": "pic._domainkey.integration-test.domain.invalid",
184
+ "record_type": "TXT",
185
+ "valid": "unknown",
186
+ "value": "k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCYHL7d9j0Y2Vzt11AQk3ZoO2tNu4E3MRJvjw4Uhw3WY2iUpM4x1pw/L+nzGFyd0NfCVLea6mafUTeTWTMIocQVZLWqtnVPONS+YkQTqo1xtcZzC7GMBEVA+VsEMAYbw57pyIu1DQVW+dnqd7cbb4POdLk3Jy75w59Mys8/9GQUNQIDAQAB"
187
+ },
188
+ {
189
+ "name": "email.integration-test.domain.invalid",
190
+ "record_type": "CNAME",
191
+ "valid": "unknown",
192
+ "value": "mailgun.org"
193
+ }
194
+ ]
195
+ }
196
+ http_version:
197
+ recorded_at: Fri, 15 Jan 2016 20:11:29 GMT
198
+ - request:
199
+ method: get
200
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/domains
201
+ body:
202
+ encoding: US-ASCII
203
+ string: ''
204
+ headers:
205
+ Accept:
206
+ - "*/*"
207
+ Accept-Encoding:
208
+ - gzip, deflate
209
+ User-Agent:
210
+ - Ruby
211
+ response:
212
+ status:
213
+ code: 200
214
+ message: OK
215
+ headers:
216
+ Server:
217
+ - nginx
218
+ Date:
219
+ - Fri, 15 Jan 2016 20:11:29 GMT
220
+ Content-Type:
221
+ - application/json
222
+ Content-Length:
223
+ - '2041'
224
+ Connection:
225
+ - keep-alive
226
+ Content-Disposition:
227
+ - inline
228
+ Access-Control-Allow-Origin:
229
+ - "*"
230
+ - "*"
231
+ Access-Control-Max-Age:
232
+ - '600'
233
+ - '600'
234
+ Access-Control-Allow-Methods:
235
+ - GET, POST, PUT, DELETE, OPTIONS
236
+ - GET, POST, PUT, DELETE, OPTIONS
237
+ Access-Control-Allow-Headers:
238
+ - Content-Type, x-requested-with
239
+ - Content-Type, x-requested-with
240
+ body:
241
+ encoding: UTF-8
242
+ string: |-
243
+ {
244
+ "items": [
245
+ {
246
+ "created_at": "Fri, 15 Jan 2016 20:11:28 GMT",
247
+ "name": "integration-test.domain.invalid",
248
+ "require_tls": false,
249
+ "skip_verification": false,
250
+ "smtp_login": "postmaster@integration-test.domain.invalid",
251
+ "smtp_password": "super_secret",
252
+ "spam_action": "tag",
253
+ "state": "unverified",
254
+ "type": "custom",
255
+ "wildcard": false
256
+ },
257
+ {
258
+ "created_at": "Fri, 08 Jan 2016 21:40:17 GMT",
259
+ "name": "mail.mitchellandness.com",
260
+ "require_tls": false,
261
+ "skip_verification": false,
262
+ "smtp_login": "postmaster@mail.mitchellandness.com",
263
+ "smtp_password": "33114017612439705daa4edcda233950",
264
+ "spam_action": "disabled",
265
+ "state": "active",
266
+ "type": "custom",
267
+ "wildcard": false
268
+ },
269
+ {
270
+ "created_at": "Tue, 29 Dec 2015 21:05:59 GMT",
271
+ "name": "DOMAIN.TEST",
272
+ "require_tls": false,
273
+ "skip_verification": false,
274
+ "smtp_login": "postmaster@DOMAIN.TEST",
275
+ "smtp_password": "bc68064e57238b091107c80dd61a7e6a",
276
+ "spam_action": "disabled",
277
+ "state": "active",
278
+ "type": "sandbox",
279
+ "wildcard": false
280
+ },
281
+ {
282
+ "created_at": "Mon, 14 Dec 2015 22:02:29 GMT",
283
+ "name": "mail.honingpigeon.com",
284
+ "require_tls": false,
285
+ "skip_verification": false,
286
+ "smtp_login": "postmaster@mail.honingpigeon.com",
287
+ "smtp_password": "7344e71cd355c986d6ece8218a520b88",
288
+ "spam_action": "disabled",
289
+ "state": "active",
290
+ "type": "custom",
291
+ "wildcard": false
292
+ },
293
+ {
294
+ "created_at": "Mon, 14 Sep 2015 21:34:08 GMT",
295
+ "name": "mailhive.dmipartners.com",
296
+ "require_tls": false,
297
+ "skip_verification": false,
298
+ "smtp_login": "postmaster@mailhive.dmipartners.com",
299
+ "smtp_password": "a040bcfef229efa52283224144ebc15f",
300
+ "spam_action": "disabled",
301
+ "state": "active",
302
+ "type": "custom",
303
+ "wildcard": false
304
+ }
305
+ ],
306
+ "total_count": 5
307
+ }
308
+ http_version:
309
+ recorded_at: Fri, 15 Jan 2016 20:11:29 GMT
310
+ - request:
311
+ method: delete
312
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/domains/integration-test.domain.invalid
313
+ body:
314
+ encoding: US-ASCII
315
+ string: ''
316
+ headers:
317
+ Accept:
318
+ - "*/*; q=0.5, application/xml"
319
+ Accept-Encoding:
320
+ - gzip, deflate
321
+ User-Agent:
322
+ - Ruby
323
+ response:
324
+ status:
325
+ code: 200
326
+ message: OK
327
+ headers:
328
+ Server:
329
+ - nginx
330
+ Date:
331
+ - Fri, 15 Jan 2016 20:12:54 GMT
332
+ Content-Type:
333
+ - application/json
334
+ Content-Length:
335
+ - '42'
336
+ Connection:
337
+ - keep-alive
338
+ Content-Disposition:
339
+ - inline
340
+ Access-Control-Allow-Origin:
341
+ - "*"
342
+ - "*"
343
+ Access-Control-Max-Age:
344
+ - '600'
345
+ - '600'
346
+ Access-Control-Allow-Methods:
347
+ - GET, POST, PUT, DELETE, OPTIONS
348
+ - GET, POST, PUT, DELETE, OPTIONS
349
+ Access-Control-Allow-Headers:
350
+ - Content-Type, x-requested-with
351
+ - Content-Type, x-requested-with
352
+ body:
353
+ encoding: UTF-8
354
+ string: |-
355
+ {
356
+ "message": "Domain has been deleted"
357
+ }
358
+ http_version:
359
+ recorded_at: Fri, 15 Jan 2016 20:12:54 GMT
360
+ recorded_with: VCR 3.0.1