mailgun-ruby 1.4.5 → 1.4.6
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/CHANGELOG.md +17 -1
- data/README.md +3 -1
- data/lib/mailgun/api_keys/api_keys.rb +2 -2
- data/lib/mailgun/client.rb +1 -1
- data/lib/mailgun/domains/domain_keys.rb +5 -5
- data/lib/mailgun/domains/domains.rb +12 -9
- data/lib/mailgun/events/events.rb +1 -1
- data/lib/mailgun/helpers/api_version_checker.rb +23 -12
- data/lib/mailgun/helpers/deprecation.rb +32 -0
- data/lib/mailgun/lists/mailing_lists.rb +250 -0
- data/lib/mailgun/messages/message_builder.rb +17 -7
- data/lib/mailgun/response.rb +1 -1
- data/lib/mailgun/routes/routes.rb +98 -0
- data/lib/mailgun/tags/analytics_tags.rb +2 -2
- data/lib/mailgun/tags/tags.rb +16 -8
- data/lib/mailgun/version.rb +1 -1
- data/lib/mailgun/webhooks/account_webhooks.rb +2 -2
- data/lib/mailgun/webhooks/webhooks.rb +17 -9
- data/lib/mailgun.rb +1 -0
- metadata +6 -326
- data/.github/workflows/ci.yml +0 -49
- data/.github_changelog_generator +0 -1
- data/.gitignore +0 -24
- data/.rubocop.yml +0 -68
- data/.ruby-env.yml.example +0 -13
- data/Gemfile +0 -9
- data/Rakefile +0 -32
- data/docs/AccountWebhooks.md +0 -55
- data/docs/AnalyticsTags.md +0 -63
- data/docs/ApiKeys.md +0 -65
- data/docs/DomainKeys.md +0 -49
- data/docs/Domains.md +0 -82
- data/docs/EmailValidation.md +0 -34
- data/docs/Events.md +0 -48
- data/docs/Logs.md +0 -67
- data/docs/MessageBuilder.md +0 -120
- data/docs/Metrics.md +0 -108
- data/docs/OptInHandler.md +0 -103
- data/docs/Snippets.md +0 -519
- data/docs/Subaccounts.md +0 -68
- data/docs/Suppressions.md +0 -92
- data/docs/Templates.md +0 -92
- data/docs/Webhooks.md +0 -65
- data/docs/railgun/EmailValidation.md +0 -34
- data/docs/railgun/Overview.md +0 -11
- data/docs/railgun/Parameters.md +0 -83
- data/mailgun.gemspec +0 -47
- data/spec/integration/account_webhooks_spec.rb +0 -57
- data/spec/integration/analytics_tags_spec.rb +0 -54
- data/spec/integration/api_keys_spec.rb +0 -50
- data/spec/integration/bounces_spec.rb +0 -45
- data/spec/integration/campaign_spec.rb +0 -62
- data/spec/integration/complaints_spec.rb +0 -40
- data/spec/integration/domain_keys_spec.rb +0 -124
- data/spec/integration/domains_spec.rb +0 -201
- data/spec/integration/email_validation_spec.rb +0 -73
- data/spec/integration/events_spec.rb +0 -28
- data/spec/integration/list_members_spec.rb +0 -64
- data/spec/integration/list_spec.rb +0 -59
- data/spec/integration/logs_spec.rb +0 -105
- data/spec/integration/mailer_spec.rb +0 -65
- data/spec/integration/mailgun_spec.rb +0 -198
- data/spec/integration/messages/sample_data/mime.txt +0 -38
- data/spec/integration/metrics_spec.rb +0 -224
- data/spec/integration/routes_spec.rb +0 -91
- data/spec/integration/stats_spec.rb +0 -17
- data/spec/integration/subaccounts_spec.rb +0 -57
- data/spec/integration/suppressions_spec.rb +0 -320
- data/spec/integration/templates_spec.rb +0 -137
- data/spec/integration/unsubscribes_spec.rb +0 -44
- data/spec/integration/webhook_spec.rb +0 -79
- data/spec/spec_helper.rb +0 -53
- data/spec/unit/client_spec.rb +0 -448
- data/spec/unit/connection/test_client.rb +0 -169
- data/spec/unit/events/events_spec.rb +0 -88
- data/spec/unit/exceptions/exceptions_spec.rb +0 -31
- data/spec/unit/helpers/api_version_checker_spec.rb +0 -206
- data/spec/unit/lists/opt_in_handler_spec.rb +0 -28
- data/spec/unit/mailgun_spec.rb +0 -171
- data/spec/unit/messages/batch_message_spec.rb +0 -148
- data/spec/unit/messages/message_builder_spec.rb +0 -745
- data/spec/unit/messages/sample_data/mailgun_icon.png +0 -0
- data/spec/unit/messages/sample_data/mime.txt +0 -38
- data/spec/unit/messages/sample_data/rackspace_logo.jpg +0 -0
- data/spec/unit/messages/sample_data/unknown.type +0 -0
- data/spec/unit/railgun/content_type_spec.rb +0 -89
- data/spec/unit/railgun/mailer_spec.rb +0 -391
- data/spec/unit/response_spec.rb +0 -225
- data/spec/unit/webhooks_spec.rb +0 -121
- data/vcr_cassettes/For_the_suppressions_handling_class/creates_a_single_bounce.yml +0 -55
- data/vcr_cassettes/account_webhooks.yml +0 -269
- data/vcr_cassettes/analytics_tags.yml +0 -187
- data/vcr_cassettes/api_keys.yml +0 -212
- data/vcr_cassettes/bounces.yml +0 -136
- data/vcr_cassettes/complaints.yml +0 -315
- data/vcr_cassettes/domains.todo.yml +0 -42
- data/vcr_cassettes/domains.yml +0 -1243
- data/vcr_cassettes/email_validation.yml +0 -152
- data/vcr_cassettes/events.yml +0 -69
- data/vcr_cassettes/exceptions-invalid-api-key.yml +0 -52
- data/vcr_cassettes/exceptions-invalid-data.yml +0 -52
- data/vcr_cassettes/exceptions-not-allowed.yml +0 -54
- data/vcr_cassettes/exceptions.yml +0 -92
- data/vcr_cassettes/list_members.yml +0 -328
- data/vcr_cassettes/logs.yml +0 -53
- data/vcr_cassettes/mailer_invalid_domain.yml +0 -109
- data/vcr_cassettes/mailing_list.todo.yml +0 -43
- data/vcr_cassettes/mailing_list.yml +0 -682
- data/vcr_cassettes/message_deliver.yml +0 -149
- data/vcr_cassettes/metrics.yml +0 -116
- data/vcr_cassettes/routes.yml +0 -359
- data/vcr_cassettes/send_message.yml +0 -158
- data/vcr_cassettes/stats.yml +0 -48
- data/vcr_cassettes/subaccounts.yml +0 -270
- data/vcr_cassettes/suppressions.yml +0 -1392
- data/vcr_cassettes/templates.yml +0 -1065
- data/vcr_cassettes/unsubscribes.yml +0 -401
- data/vcr_cassettes/webhooks.yml +0 -246
- data/vcr_cassettes/webhooks_v4.yml +0 -275
data/spec/unit/response_spec.rb
DELETED
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
require 'json'
|
|
5
|
-
require 'yaml'
|
|
6
|
-
require 'mailgun/response'
|
|
7
|
-
require 'mailgun/exceptions/exceptions'
|
|
8
|
-
|
|
9
|
-
describe Mailgun::Response do
|
|
10
|
-
subject(:response) { described_class.new(http_response) }
|
|
11
|
-
|
|
12
|
-
let(:json_body) { '{"id":"<message-id@example.com>","message":"Queued. Thank you."}' }
|
|
13
|
-
let(:status200) { 200 }
|
|
14
|
-
|
|
15
|
-
# Minimal double that mimics a RestClient::Response
|
|
16
|
-
let(:http_response) do
|
|
17
|
-
double('http_response', body: json_body, status: status200)
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
# ---------------------------------------------------------------------------
|
|
21
|
-
# .new
|
|
22
|
-
# ---------------------------------------------------------------------------
|
|
23
|
-
describe '#initialize' do
|
|
24
|
-
it 'sets body from the underlying response' do
|
|
25
|
-
expect(response.body).to eq(json_body)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it 'sets status from the underlying response' do
|
|
29
|
-
expect(response.status).to eq(status200)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
it 'aliases code to status' do
|
|
33
|
-
expect(response.code).to eq(status200)
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
# ---------------------------------------------------------------------------
|
|
38
|
-
# .from_hash
|
|
39
|
-
# ---------------------------------------------------------------------------
|
|
40
|
-
describe '.from_hash' do
|
|
41
|
-
subject(:from_hash_response) do
|
|
42
|
-
described_class.from_hash(body: json_body, status: status200)
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
it 'returns a Response instance' do
|
|
46
|
-
expect(from_hash_response).to be_a(described_class)
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
it 'sets body from the hash' do
|
|
50
|
-
expect(from_hash_response.body).to eq(json_body)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
it 'sets status from the hash' do
|
|
54
|
-
expect(from_hash_response.status).to eq(status200)
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
it 'aliases code to status' do
|
|
58
|
-
expect(from_hash_response.code).to eq(status200)
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
# ---------------------------------------------------------------------------
|
|
63
|
-
# #to_h
|
|
64
|
-
# ---------------------------------------------------------------------------
|
|
65
|
-
describe '#to_h' do
|
|
66
|
-
it 'returns a Hash' do
|
|
67
|
-
expect(response.to_h).to be_a(Hash)
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
it 'correctly parses the JSON body' do
|
|
71
|
-
result = response.to_h
|
|
72
|
-
expect(result['id']).to eq('<message-id@example.com>')
|
|
73
|
-
expect(result['message']).to eq('Queued. Thank you.')
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
it 'does not mutate the body attribute' do
|
|
77
|
-
expect { response.to_h }.not_to(change(response, :body))
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
context 'when the body is invalid JSON' do
|
|
81
|
-
let(:http_response) { double('http_response', body: 'not-json', status: 200) }
|
|
82
|
-
|
|
83
|
-
it 'raises a Mailgun::ParseError' do
|
|
84
|
-
expect { response.to_h }.to raise_error(Mailgun::ParseError)
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
# ---------------------------------------------------------------------------
|
|
90
|
-
# #to_h!
|
|
91
|
-
# ---------------------------------------------------------------------------
|
|
92
|
-
describe '#to_h!' do
|
|
93
|
-
it 'returns a Hash' do
|
|
94
|
-
expect(response.to_h!).to be_a(Hash)
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
it 'correctly parses the JSON body' do
|
|
98
|
-
result = response.to_h!
|
|
99
|
-
expect(result['message']).to eq('Queued. Thank you.')
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
it 'replaces body with the parsed Hash' do
|
|
103
|
-
response.to_h!
|
|
104
|
-
expect(response.body).to be_a(Hash)
|
|
105
|
-
expect(response.body['id']).to eq('<message-id@example.com>')
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
context 'when the body is invalid JSON' do
|
|
109
|
-
let(:http_response) { double('http_response', body: 'not-json', status: 200) }
|
|
110
|
-
|
|
111
|
-
it 'raises a Mailgun::ParseError' do
|
|
112
|
-
expect { response.to_h! }.to raise_error(Mailgun::ParseError)
|
|
113
|
-
end
|
|
114
|
-
end
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
# ---------------------------------------------------------------------------
|
|
118
|
-
# #to_yaml
|
|
119
|
-
# ---------------------------------------------------------------------------
|
|
120
|
-
describe '#to_yaml' do
|
|
121
|
-
it 'returns a String' do
|
|
122
|
-
expect(response.to_yaml).to be_a(String)
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
it 'returns valid YAML that round-trips back to the expected hash' do
|
|
126
|
-
parsed = YAML.safe_load(response.to_yaml)
|
|
127
|
-
expect(parsed['id']).to eq('<message-id@example.com>')
|
|
128
|
-
expect(parsed['message']).to eq('Queued. Thank you.')
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
it 'does not mutate the body attribute' do
|
|
132
|
-
expect { response.to_yaml }.not_to(change(response, :body))
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
context 'when the body is invalid JSON' do
|
|
136
|
-
let(:http_response) { double('http_response', body: 'not-json', status: 200) }
|
|
137
|
-
|
|
138
|
-
it 'raises a Mailgun::ParseError' do
|
|
139
|
-
expect { response.to_yaml }.to raise_error(Mailgun::ParseError)
|
|
140
|
-
end
|
|
141
|
-
end
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
# ---------------------------------------------------------------------------
|
|
145
|
-
# #to_yaml!
|
|
146
|
-
# ---------------------------------------------------------------------------
|
|
147
|
-
describe '#to_yaml!' do
|
|
148
|
-
it 'returns a String' do
|
|
149
|
-
expect(response.to_yaml!).to be_a(String)
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
it 'returns valid YAML that round-trips back to the expected hash' do
|
|
153
|
-
yaml_str = response.to_yaml!
|
|
154
|
-
parsed = YAML.safe_load(yaml_str)
|
|
155
|
-
expect(parsed['message']).to eq('Queued. Thank you.')
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
it 'replaces body with the YAML string' do
|
|
159
|
-
response.to_yaml!
|
|
160
|
-
expect(response.body).to be_a(String)
|
|
161
|
-
expect(response.body).to include('Queued. Thank you.')
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
context 'when the body is invalid JSON' do
|
|
165
|
-
let(:http_response) { double('http_response', body: 'not-json', status: 200) }
|
|
166
|
-
|
|
167
|
-
it 'raises a Mailgun::ParseError' do
|
|
168
|
-
expect { response.to_yaml! }.to raise_error(Mailgun::ParseError)
|
|
169
|
-
end
|
|
170
|
-
end
|
|
171
|
-
end
|
|
172
|
-
|
|
173
|
-
# ---------------------------------------------------------------------------
|
|
174
|
-
# #success?
|
|
175
|
-
# ---------------------------------------------------------------------------
|
|
176
|
-
describe '#success?' do
|
|
177
|
-
context 'with a 2xx status code' do
|
|
178
|
-
[200, 201, 204, 299].each do |code|
|
|
179
|
-
it "returns true for status #{code}" do
|
|
180
|
-
allow(http_response).to receive(:status).and_return(code)
|
|
181
|
-
expect(described_class.new(http_response).success?).to be(true)
|
|
182
|
-
end
|
|
183
|
-
end
|
|
184
|
-
end
|
|
185
|
-
|
|
186
|
-
context 'with a non-2xx status code' do
|
|
187
|
-
[400, 401, 403, 404, 422, 500, 503].each do |code|
|
|
188
|
-
it "returns false for status #{code}" do
|
|
189
|
-
allow(http_response).to receive(:status).and_return(code)
|
|
190
|
-
expect(described_class.new(http_response).success?).to be(false)
|
|
191
|
-
end
|
|
192
|
-
end
|
|
193
|
-
end
|
|
194
|
-
|
|
195
|
-
it 'returns false for status 199 (just below 2xx range)' do
|
|
196
|
-
allow(http_response).to receive(:status).and_return(199)
|
|
197
|
-
expect(described_class.new(http_response).success?).to be(false)
|
|
198
|
-
end
|
|
199
|
-
|
|
200
|
-
it 'returns false for status 300 (just above 2xx range)' do
|
|
201
|
-
allow(http_response).to receive(:status).and_return(300)
|
|
202
|
-
expect(described_class.new(http_response).success?).to be(false)
|
|
203
|
-
end
|
|
204
|
-
end
|
|
205
|
-
|
|
206
|
-
# ---------------------------------------------------------------------------
|
|
207
|
-
# attr_accessor sanity checks
|
|
208
|
-
# ---------------------------------------------------------------------------
|
|
209
|
-
describe 'attribute accessors' do
|
|
210
|
-
it 'allows body to be overwritten' do
|
|
211
|
-
response.body = 'new body'
|
|
212
|
-
expect(response.body).to eq('new body')
|
|
213
|
-
end
|
|
214
|
-
|
|
215
|
-
it 'allows status to be overwritten' do
|
|
216
|
-
response.status = 404
|
|
217
|
-
expect(response.status).to eq(404)
|
|
218
|
-
end
|
|
219
|
-
|
|
220
|
-
it 'allows code to be overwritten' do
|
|
221
|
-
response.code = 500
|
|
222
|
-
expect(response.code).to eq(500)
|
|
223
|
-
end
|
|
224
|
-
end
|
|
225
|
-
end
|
data/spec/unit/webhooks_spec.rb
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
describe Mailgun::Webhooks do
|
|
6
|
-
let(:client) { double(:client) }
|
|
7
|
-
let(:webhooks) { described_class.new(client) }
|
|
8
|
-
let(:domain) { 'example.com' }
|
|
9
|
-
let(:url) { 'https://example.com/mailgun/events' }
|
|
10
|
-
|
|
11
|
-
%i[create_all add_all_webhooks].each do |method|
|
|
12
|
-
describe "##{method}" do
|
|
13
|
-
it 'creates every webhook action with the provided URL' do
|
|
14
|
-
described_class::ACTIONS.each do |action|
|
|
15
|
-
expect(webhooks).to receive(:create).with(domain, action, url).ordered
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
expect { webhooks.public_send(method, domain, url) }
|
|
19
|
-
.to output(/`#{method}` method will be deprecated/).to_stderr
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
context 'with v3 endpoints' do
|
|
25
|
-
let(:client) { instance_double(Mailgun::Client, api_version: 'v3') }
|
|
26
|
-
|
|
27
|
-
describe '#create' do
|
|
28
|
-
let(:urls) { [url, 'https://example.com/other'] }
|
|
29
|
-
let(:response) do
|
|
30
|
-
instance_double(Mailgun::Response,
|
|
31
|
-
to_h: { 'message' => 'Webhook has been created', 'webhook' => { 'urls' => urls } })
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
before { allow(client).to receive(:post).and_return(response) }
|
|
35
|
-
|
|
36
|
-
it 'returns true when a single url was created' do
|
|
37
|
-
expect(webhooks.create(domain, 'delivered', url)).to be(true)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
it 'returns true when multiple urls were created' do
|
|
41
|
-
expect(webhooks.create(domain, 'delivered', urls)).to be(true)
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
it 'returns false when a url is missing from the response' do
|
|
45
|
-
expect(webhooks.create(domain, 'delivered', [url, 'https://example.com/missing'])).to be(false)
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
describe 'parameter validation' do
|
|
50
|
-
it 'raises a ParameterError when the domain is missing' do
|
|
51
|
-
[nil, ''].each do |blank|
|
|
52
|
-
expect { webhooks.update(blank, 'delivered', url) }
|
|
53
|
-
.to raise_error(Mailgun::ParameterError, 'Domain not provided to update webhooks')
|
|
54
|
-
expect { webhooks.remove(blank, 'delivered') }
|
|
55
|
-
.to raise_error(Mailgun::ParameterError, 'Domain not provided to remove webhook from')
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
it 'raises a ParameterError when the action is missing' do
|
|
60
|
-
[nil, ''].each do |blank|
|
|
61
|
-
expect { webhooks.update(domain, blank, url) }
|
|
62
|
-
.to raise_error(Mailgun::ParameterError, 'Action not provided to identify webhook to update')
|
|
63
|
-
expect { webhooks.remove(domain, blank) }
|
|
64
|
-
.to raise_error(Mailgun::ParameterError, 'Action not provided to identify webhook to remove')
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
context 'with v4 endpoints' do
|
|
71
|
-
let(:api_version) { 'v4' }
|
|
72
|
-
let(:client) { instance_double(Mailgun::Client, api_version: api_version) }
|
|
73
|
-
let(:response) { instance_double(Mailgun::Response, to_h: { 'webhooks' => { 'accepted' => { 'urls' => [url] } } }) }
|
|
74
|
-
|
|
75
|
-
describe '#create_v4' do
|
|
76
|
-
it 'posts the url and event types to the domain webhooks endpoint' do
|
|
77
|
-
expect(client).to receive(:post)
|
|
78
|
-
.with("domains/#{domain}/webhooks", { url: url, event_types: %w[accepted delivered] })
|
|
79
|
-
.and_return(response)
|
|
80
|
-
|
|
81
|
-
expect(webhooks.create_v4(domain, url: url, event_types: %w[accepted delivered]))
|
|
82
|
-
.to eq('accepted' => { 'urls' => [url] })
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
describe '#update_v4' do
|
|
87
|
-
it 'puts the url and event types to the domain webhooks endpoint' do
|
|
88
|
-
expect(client).to receive(:put)
|
|
89
|
-
.with("domains/#{domain}/webhooks", { url: url, event_types: 'accepted' })
|
|
90
|
-
.and_return(response)
|
|
91
|
-
|
|
92
|
-
expect(webhooks.update_v4(domain, url: url, event_types: 'accepted'))
|
|
93
|
-
.to eq('accepted' => { 'urls' => [url] })
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
describe '#remove_v4' do
|
|
98
|
-
it 'sends the urls as query params' do
|
|
99
|
-
urls = [url, 'https://example.com/other']
|
|
100
|
-
expect(client).to receive(:delete)
|
|
101
|
-
.with("domains/#{domain}/webhooks", { url: urls })
|
|
102
|
-
.and_return(response)
|
|
103
|
-
|
|
104
|
-
webhooks.remove_v4(domain, url: urls)
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
context 'when the client api version is not v4' do
|
|
109
|
-
let(:api_version) { 'v3' }
|
|
110
|
-
|
|
111
|
-
it 'raises a ParameterError' do
|
|
112
|
-
expect { webhooks.create_v4(domain, url: url, event_types: 'accepted') }
|
|
113
|
-
.to raise_error(Mailgun::ParameterError, /must be v4/)
|
|
114
|
-
expect { webhooks.update_v4(domain, url: url, event_types: 'accepted') }
|
|
115
|
-
.to raise_error(Mailgun::ParameterError, /must be v4/)
|
|
116
|
-
expect { webhooks.remove_v4(domain, url: url) }
|
|
117
|
-
.to raise_error(Mailgun::ParameterError, /must be v4/)
|
|
118
|
-
end
|
|
119
|
-
end
|
|
120
|
-
end
|
|
121
|
-
end
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
http_interactions:
|
|
3
|
-
- request:
|
|
4
|
-
method: post
|
|
5
|
-
uri: https://api.mailgun.net/bounces
|
|
6
|
-
body:
|
|
7
|
-
encoding: UTF-8
|
|
8
|
-
string: address=test5%40example.info&code=500&error=integration+testing
|
|
9
|
-
headers:
|
|
10
|
-
User-Agent:
|
|
11
|
-
- mailgun-sdk-ruby/1.4.2
|
|
12
|
-
Accept:
|
|
13
|
-
- "*/*"
|
|
14
|
-
Authorization:
|
|
15
|
-
- Basic XXX
|
|
16
|
-
Content-Type:
|
|
17
|
-
- application/x-www-form-urlencoded
|
|
18
|
-
Accept-Encoding:
|
|
19
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
20
|
-
response:
|
|
21
|
-
status:
|
|
22
|
-
code: 200
|
|
23
|
-
message: OK
|
|
24
|
-
headers:
|
|
25
|
-
Access-Control-Allow-Credentials:
|
|
26
|
-
- 'true'
|
|
27
|
-
Access-Control-Allow-Origin:
|
|
28
|
-
- "*"
|
|
29
|
-
Cache-Control:
|
|
30
|
-
- no-store
|
|
31
|
-
Content-Length:
|
|
32
|
-
- '89'
|
|
33
|
-
Content-Type:
|
|
34
|
-
- application/json; charset=utf-8
|
|
35
|
-
Date:
|
|
36
|
-
- Wed, 25 Mar 2026 18:09:17 GMT
|
|
37
|
-
Strict-Transport-Security:
|
|
38
|
-
- max-age=63072000; includeSubDomains
|
|
39
|
-
X-Mailgun-Key-Id:
|
|
40
|
-
- XXX
|
|
41
|
-
X-Request-Limit:
|
|
42
|
-
- '2500'
|
|
43
|
-
X-Request-Remaining:
|
|
44
|
-
- '2498'
|
|
45
|
-
X-Request-Reset:
|
|
46
|
-
- '1774462171770'
|
|
47
|
-
X-Xss-Protection:
|
|
48
|
-
- 1; mode=block
|
|
49
|
-
body:
|
|
50
|
-
encoding: UTF-8
|
|
51
|
-
string: '{"message":"Address has been added to the bounces table","address":"test5@example.info"}
|
|
52
|
-
|
|
53
|
-
'
|
|
54
|
-
recorded_at: Wed, 25 Mar 2026 18:09:17 GMT
|
|
55
|
-
recorded_with: VCR 6.4.0
|
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
http_interactions:
|
|
3
|
-
- request:
|
|
4
|
-
method: post
|
|
5
|
-
uri: https://api.mailgun.net/v1/webhooks
|
|
6
|
-
body:
|
|
7
|
-
encoding: UTF-8
|
|
8
|
-
string: description=test&event_types=accepted&url=http%3A%2F%2Fexample.com%2Fmailgun%2Fevents
|
|
9
|
-
headers:
|
|
10
|
-
User-Agent:
|
|
11
|
-
- mailgun-sdk-ruby/1.4.4
|
|
12
|
-
Accept:
|
|
13
|
-
- "*/*"
|
|
14
|
-
Authorization:
|
|
15
|
-
- Basic xxx
|
|
16
|
-
Content-Type:
|
|
17
|
-
- application/x-www-form-urlencoded
|
|
18
|
-
Accept-Encoding:
|
|
19
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
20
|
-
response:
|
|
21
|
-
status:
|
|
22
|
-
code: 200
|
|
23
|
-
message: OK
|
|
24
|
-
headers:
|
|
25
|
-
Access-Control-Allow-Credentials:
|
|
26
|
-
- 'true'
|
|
27
|
-
Access-Control-Allow-Origin:
|
|
28
|
-
- "*"
|
|
29
|
-
Cache-Control:
|
|
30
|
-
- no-store
|
|
31
|
-
Content-Length:
|
|
32
|
-
- '42'
|
|
33
|
-
Content-Type:
|
|
34
|
-
- application/json; charset=utf-8
|
|
35
|
-
Date:
|
|
36
|
-
- Mon, 25 May 2026 09:11:02 GMT
|
|
37
|
-
Strict-Transport-Security:
|
|
38
|
-
- max-age=63072000; includeSubDomains
|
|
39
|
-
X-Mailgun-Key-Id:
|
|
40
|
-
- xxx
|
|
41
|
-
X-Xss-Protection:
|
|
42
|
-
- 1; mode=block
|
|
43
|
-
Server-Timing:
|
|
44
|
-
- cfReqDur;dur=382.358
|
|
45
|
-
Cf-Team:
|
|
46
|
-
- xxx
|
|
47
|
-
body:
|
|
48
|
-
encoding: UTF-8
|
|
49
|
-
string: '{"webhook_id":"test"}
|
|
50
|
-
|
|
51
|
-
'
|
|
52
|
-
recorded_at: Mon, 25 May 2026 09:11:02 GMT
|
|
53
|
-
- request:
|
|
54
|
-
method: get
|
|
55
|
-
uri: https://api.mailgun.net/v1/webhooks?webhook_ids=
|
|
56
|
-
body:
|
|
57
|
-
encoding: US-ASCII
|
|
58
|
-
string: ''
|
|
59
|
-
headers:
|
|
60
|
-
User-Agent:
|
|
61
|
-
- mailgun-sdk-ruby/1.4.4
|
|
62
|
-
Accept:
|
|
63
|
-
- "*/*"
|
|
64
|
-
Authorization:
|
|
65
|
-
- Basic xxx
|
|
66
|
-
Accept-Encoding:
|
|
67
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
68
|
-
response:
|
|
69
|
-
status:
|
|
70
|
-
code: 200
|
|
71
|
-
message: OK
|
|
72
|
-
headers:
|
|
73
|
-
Access-Control-Allow-Credentials:
|
|
74
|
-
- 'true'
|
|
75
|
-
Access-Control-Allow-Origin:
|
|
76
|
-
- "*"
|
|
77
|
-
Cache-Control:
|
|
78
|
-
- no-store
|
|
79
|
-
Content-Length:
|
|
80
|
-
- '183'
|
|
81
|
-
Content-Type:
|
|
82
|
-
- application/json; charset=utf-8
|
|
83
|
-
Date:
|
|
84
|
-
- Mon, 25 May 2026 09:16:27 GMT
|
|
85
|
-
Strict-Transport-Security:
|
|
86
|
-
- max-age=63072000; includeSubDomains
|
|
87
|
-
X-Mailgun-Key-Id:
|
|
88
|
-
- xxx
|
|
89
|
-
X-Xss-Protection:
|
|
90
|
-
- 1; mode=block
|
|
91
|
-
Server-Timing:
|
|
92
|
-
- cfReqDur;dur=201.477
|
|
93
|
-
Cf-Team:
|
|
94
|
-
- xxx
|
|
95
|
-
body:
|
|
96
|
-
encoding: UTF-8
|
|
97
|
-
string: '{"webhooks":[{"webhook_id":"test","description":"test","url":"http://example.com/mailgun/events","event_types":["accepted"],"created_at":"2026-05-25T09:11:02Z"}]}
|
|
98
|
-
|
|
99
|
-
'
|
|
100
|
-
recorded_at: Mon, 25 May 2026 09:16:27 GMT
|
|
101
|
-
- request:
|
|
102
|
-
method: get
|
|
103
|
-
uri: https://api.mailgun.net/v1/webhooks/test
|
|
104
|
-
body:
|
|
105
|
-
encoding: US-ASCII
|
|
106
|
-
string: ''
|
|
107
|
-
headers:
|
|
108
|
-
User-Agent:
|
|
109
|
-
- mailgun-sdk-ruby/1.4.4
|
|
110
|
-
Accept:
|
|
111
|
-
- "*/*"
|
|
112
|
-
Authorization:
|
|
113
|
-
- Basic xxx
|
|
114
|
-
Accept-Encoding:
|
|
115
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
116
|
-
response:
|
|
117
|
-
status:
|
|
118
|
-
code: 200
|
|
119
|
-
message: OK
|
|
120
|
-
headers:
|
|
121
|
-
Access-Control-Allow-Credentials:
|
|
122
|
-
- 'true'
|
|
123
|
-
Access-Control-Allow-Origin:
|
|
124
|
-
- "*"
|
|
125
|
-
Cache-Control:
|
|
126
|
-
- no-store
|
|
127
|
-
Content-Length:
|
|
128
|
-
- '168'
|
|
129
|
-
Content-Type:
|
|
130
|
-
- application/json; charset=utf-8
|
|
131
|
-
Date:
|
|
132
|
-
- Mon, 25 May 2026 09:22:12 GMT
|
|
133
|
-
Strict-Transport-Security:
|
|
134
|
-
- max-age=63072000; includeSubDomains
|
|
135
|
-
X-Mailgun-Key-Id:
|
|
136
|
-
- xxx
|
|
137
|
-
X-Xss-Protection:
|
|
138
|
-
- 1; mode=block
|
|
139
|
-
Server-Timing:
|
|
140
|
-
- cfReqDur;dur=234.628
|
|
141
|
-
Cf-Team:
|
|
142
|
-
- xxx
|
|
143
|
-
body:
|
|
144
|
-
encoding: UTF-8
|
|
145
|
-
string: '{"webhook_id":"test","description":"test","url":"http://example.com/mailgun/events","event_types":["accepted"],"created_at":"2026-05-25T09:11:02Z"}
|
|
146
|
-
|
|
147
|
-
'
|
|
148
|
-
recorded_at: Mon, 25 May 2026 09:22:12 GMT
|
|
149
|
-
- request:
|
|
150
|
-
method: put
|
|
151
|
-
uri: https://api.mailgun.net/v1/webhooks/test
|
|
152
|
-
body:
|
|
153
|
-
encoding: UTF-8
|
|
154
|
-
string: description=test2&event_types=accepted&url=http%3A%2F%2Fexample.com%2Fmailgun%2Fevents
|
|
155
|
-
headers:
|
|
156
|
-
User-Agent:
|
|
157
|
-
- mailgun-sdk-ruby/1.4.4
|
|
158
|
-
Accept:
|
|
159
|
-
- "*/*"
|
|
160
|
-
Authorization:
|
|
161
|
-
- Basic xxx
|
|
162
|
-
Content-Type:
|
|
163
|
-
- application/x-www-form-urlencoded
|
|
164
|
-
Accept-Encoding:
|
|
165
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
166
|
-
response:
|
|
167
|
-
status:
|
|
168
|
-
code: 204
|
|
169
|
-
message: No Content
|
|
170
|
-
headers:
|
|
171
|
-
Access-Control-Allow-Credentials:
|
|
172
|
-
- 'true'
|
|
173
|
-
Access-Control-Allow-Origin:
|
|
174
|
-
- "*"
|
|
175
|
-
Cache-Control:
|
|
176
|
-
- no-store
|
|
177
|
-
Date:
|
|
178
|
-
- Mon, 25 May 2026 12:03:17 GMT
|
|
179
|
-
Strict-Transport-Security:
|
|
180
|
-
- max-age=63072000; includeSubDomains
|
|
181
|
-
X-Mailgun-Key-Id:
|
|
182
|
-
- xxx
|
|
183
|
-
X-Xss-Protection:
|
|
184
|
-
- 1; mode=block
|
|
185
|
-
body:
|
|
186
|
-
encoding: UTF-8
|
|
187
|
-
string: ''
|
|
188
|
-
recorded_at: Mon, 25 May 2026 12:03:17 GMT
|
|
189
|
-
- request:
|
|
190
|
-
method: delete
|
|
191
|
-
uri: https://api.mailgun.net/v1/webhooks/test
|
|
192
|
-
body:
|
|
193
|
-
encoding: US-ASCII
|
|
194
|
-
string: ''
|
|
195
|
-
headers:
|
|
196
|
-
User-Agent:
|
|
197
|
-
- mailgun-sdk-ruby/1.4.4
|
|
198
|
-
Accept:
|
|
199
|
-
- "*/*"
|
|
200
|
-
Authorization:
|
|
201
|
-
- Basic xxx
|
|
202
|
-
Accept-Encoding:
|
|
203
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
204
|
-
response:
|
|
205
|
-
status:
|
|
206
|
-
code: 204
|
|
207
|
-
message: No Content
|
|
208
|
-
headers:
|
|
209
|
-
Access-Control-Allow-Credentials:
|
|
210
|
-
- 'true'
|
|
211
|
-
Access-Control-Allow-Origin:
|
|
212
|
-
- "*"
|
|
213
|
-
Cache-Control:
|
|
214
|
-
- no-store
|
|
215
|
-
Date:
|
|
216
|
-
- Mon, 25 May 2026 12:08:15 GMT
|
|
217
|
-
Strict-Transport-Security:
|
|
218
|
-
- max-age=63072000; includeSubDomains
|
|
219
|
-
X-Mailgun-Key-Id:
|
|
220
|
-
- xxx
|
|
221
|
-
X-Xss-Protection:
|
|
222
|
-
- 1; mode=block
|
|
223
|
-
body:
|
|
224
|
-
encoding: UTF-8
|
|
225
|
-
string: ''
|
|
226
|
-
recorded_at: Mon, 25 May 2026 12:08:15 GMT
|
|
227
|
-
- request:
|
|
228
|
-
method: delete
|
|
229
|
-
uri: https://api.mailgun.net/v1/webhooks?all=true
|
|
230
|
-
body:
|
|
231
|
-
encoding: US-ASCII
|
|
232
|
-
string: ''
|
|
233
|
-
headers:
|
|
234
|
-
User-Agent:
|
|
235
|
-
- mailgun-sdk-ruby/1.4.4
|
|
236
|
-
Accept:
|
|
237
|
-
- "*/*"
|
|
238
|
-
Authorization:
|
|
239
|
-
- Basic xxx
|
|
240
|
-
Accept-Encoding:
|
|
241
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
242
|
-
response:
|
|
243
|
-
status:
|
|
244
|
-
code: 204
|
|
245
|
-
message: No Content
|
|
246
|
-
headers:
|
|
247
|
-
Access-Control-Allow-Credentials:
|
|
248
|
-
- 'true'
|
|
249
|
-
Access-Control-Allow-Origin:
|
|
250
|
-
- "*"
|
|
251
|
-
Cache-Control:
|
|
252
|
-
- no-store
|
|
253
|
-
Date:
|
|
254
|
-
- Mon, 25 May 2026 20:28:16 GMT
|
|
255
|
-
Strict-Transport-Security:
|
|
256
|
-
- max-age=63072000; includeSubDomains
|
|
257
|
-
X-Mailgun-Key-Id:
|
|
258
|
-
- xxx
|
|
259
|
-
X-Xss-Protection:
|
|
260
|
-
- 1; mode=block
|
|
261
|
-
Server-Timing:
|
|
262
|
-
- cfReqDur;dur=246.503
|
|
263
|
-
Cf-Team:
|
|
264
|
-
- xxx
|
|
265
|
-
body:
|
|
266
|
-
encoding: UTF-8
|
|
267
|
-
string: ''
|
|
268
|
-
recorded_at: Mon, 25 May 2026 20:28:16 GMT
|
|
269
|
-
recorded_with: VCR 6.4.0
|