mailgun-ruby 1.2.5 → 1.2.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +0 -0
  3. data/.rubocop_todo.yml +0 -0
  4. data/.ruby-env.yml.example +0 -0
  5. data/README.md +4 -2
  6. data/docs/Domains.md +3 -0
  7. data/docs/OptInHandler.md +1 -1
  8. data/docs/Snippets.md +54 -61
  9. data/docs/railgun/Templates.md +92 -0
  10. data/lib/mailgun/address.rb +3 -28
  11. data/lib/mailgun/chains.rb +0 -0
  12. data/lib/mailgun/client.rb +20 -6
  13. data/lib/mailgun/domains/domains.rb +19 -1
  14. data/lib/mailgun/exceptions/exceptions.rb +27 -2
  15. data/lib/mailgun/messages/message_builder.rb +2 -2
  16. data/lib/mailgun/response.rb +0 -0
  17. data/lib/mailgun/suppressions.rb +11 -7
  18. data/lib/mailgun/version.rb +1 -1
  19. data/lib/mailgun/webhooks/webhooks.rb +2 -2
  20. data/lib/mailgun-ruby.rb +1 -1
  21. data/lib/mailgun.rb +3 -1
  22. data/lib/railgun/mailer.rb +4 -1
  23. data/spec/integration/bounces_spec.rb +3 -3
  24. data/spec/integration/campaign_spec.rb +0 -0
  25. data/spec/integration/complaints_spec.rb +0 -0
  26. data/spec/integration/domains_spec.rb +8 -0
  27. data/spec/integration/email_validation_spec.rb +1 -8
  28. data/spec/integration/events_spec.rb +0 -0
  29. data/spec/integration/list_members_spec.rb +0 -0
  30. data/spec/integration/list_spec.rb +0 -0
  31. data/spec/integration/mailgun_spec.rb +72 -0
  32. data/spec/integration/routes_spec.rb +0 -0
  33. data/spec/integration/stats_spec.rb +0 -0
  34. data/spec/integration/suppressions_spec.rb +0 -0
  35. data/spec/integration/unsubscribes_spec.rb +0 -0
  36. data/spec/integration/webhook_spec.rb +0 -0
  37. data/spec/unit/connection/test_client.rb +4 -3
  38. data/spec/unit/mailgun_spec.rb +19 -0
  39. data/vcr_cassettes/bounces.yml +12 -12
  40. data/vcr_cassettes/complaints.yml +0 -0
  41. data/vcr_cassettes/domains.todo.yml +0 -0
  42. data/vcr_cassettes/domains.yml +51 -1
  43. data/vcr_cassettes/events.yml +0 -0
  44. data/vcr_cassettes/exceptions-invalid-api-key.yml +52 -0
  45. data/vcr_cassettes/exceptions-invalid-data.yml +52 -0
  46. data/vcr_cassettes/exceptions-not-allowed.yml +54 -0
  47. data/vcr_cassettes/list_members.yml +0 -0
  48. data/vcr_cassettes/mailing_list.todo.yml +0 -0
  49. data/vcr_cassettes/mailing_list.yml +0 -0
  50. data/vcr_cassettes/routes.yml +0 -0
  51. data/vcr_cassettes/send_message.yml +0 -0
  52. data/vcr_cassettes/stats.yml +0 -0
  53. data/vcr_cassettes/unsubscribes.yml +0 -0
  54. data/vcr_cassettes/webhooks.yml +0 -0
  55. metadata +6 -2
@@ -11,12 +11,12 @@ module Mailgun
11
11
  class Client
12
12
 
13
13
  def initialize(api_key = Mailgun.api_key,
14
- api_host = 'api.mailgun.net',
15
- api_version = 'v3',
14
+ api_host = Mailgun.api_host || 'api.mailgun.net',
15
+ api_version = Mailgun.api_version || 'v3',
16
16
  ssl = true,
17
17
  test_mode = false,
18
18
  timeout = nil,
19
- proxy_url = nil)
19
+ proxy_url = Mailgun.proxy_url)
20
20
 
21
21
  rest_client_params = {
22
22
  user: 'api',
@@ -45,6 +45,11 @@ module Mailgun
45
45
  @test_mode = false
46
46
  end
47
47
 
48
+ # Change API key
49
+ def set_api_key(api_key)
50
+ @http_client.options[:password] = api_key
51
+ end
52
+
48
53
  # Client is in test mode?
49
54
  #
50
55
  # @return [Boolean] Is the client set in test mode?
@@ -200,7 +205,16 @@ module Mailgun
200
205
  #
201
206
  # @param [StandardException] e upstream exception object
202
207
  def communication_error(e)
203
- return CommunicationError.new(e.message, e.response) if e.respond_to? :response
208
+ if e.respond_to?(:response) && e.response
209
+ return case e.response.code
210
+ when Unauthorized::CODE
211
+ Unauthorized.new(e.message, e.response)
212
+ when BadRequest::CODE
213
+ BadRequest.new(e.message, e.response)
214
+ else
215
+ CommunicationError.new(e.message, e.response)
216
+ end
217
+ end
204
218
  CommunicationError.new(e.message)
205
219
  end
206
220
 
@@ -208,11 +222,11 @@ module Mailgun
208
222
  message = data.respond_to?(:message) ? data.message : data
209
223
  fail ParameterError.new('Missing working domain', working_domain) unless working_domain
210
224
  fail ParameterError.new(
211
- 'Missing `to` recipient, message should containg at least 1 recipient',
225
+ 'Missing `to` recipient, message should contain at least 1 recipient',
212
226
  working_domain
213
227
  ) if message.fetch('to', []).empty? && message.fetch(:to, []).empty?
214
228
  fail ParameterError.new(
215
- 'Missing a `from` sender, message should containg at least 1 `from` sender',
229
+ 'Missing a `from` sender, message should contain at least 1 `from` sender',
216
230
  working_domain
217
231
  ) if message.fetch('from', []).empty? && message.fetch(:from, []).empty?
218
232
  end
@@ -53,8 +53,9 @@ module Mailgun
53
53
  # domain - [String] Name of the domain (ex. domain.com)
54
54
  # options - [Hash] of
55
55
  # smtp_password - [String] Password for SMTP authentication
56
- # spam_action - [String] disabled or tag
56
+ # spam_action - [String] disabled, blocked or tag
57
57
  # Disable, no spam filtering will occur for inbound messages.
58
+ # Block, inbound spam messages will not be delivered.
58
59
  # Tag, messages will be tagged wtih a spam header. See Spam Filter.
59
60
  # wildcard - [Boolean] true or false Determines whether the domain will accept email for sub-domains.
60
61
  #
@@ -80,5 +81,22 @@ module Mailgun
80
81
  alias_method :delete, :remove
81
82
  alias_method :delete_domain, :remove
82
83
 
84
+ # Public: Update domain
85
+ #
86
+ # domain - [String] Name of the domain (ex. domain.com)
87
+ # options - [Hash] of
88
+ # spam_action - [String] disabled, blocked or tag
89
+ # Disable, no spam filtering will occur for inbound messages.
90
+ # Block, inbound spam messages will not be delivered.
91
+ # Tag, messages will be tagged wtih a spam header. See Spam Filter.
92
+ # web_scheme - [String] http or https
93
+ # Set your open, click and unsubscribe URLs to use http or https
94
+ # wildcard - [Boolean] true or false Determines whether the domain will accept email for sub-domains.
95
+ #
96
+ # Returns [Hash] of updated domain
97
+ def update(domain, options = {})
98
+ fail(ParameterError, 'No domain given to add on Mailgun', caller) unless domain
99
+ @client.put("domains/#{domain}", options).to_h
100
+ end
83
101
  end
84
102
  end
@@ -43,7 +43,11 @@ module Mailgun
43
43
  #
44
44
  def initialize(message = nil, response = nil)
45
45
  @response = response
46
- @code = response.code || NOCODE
46
+ @code = if response.nil?
47
+ NOCODE
48
+ else
49
+ response.code
50
+ end
47
51
 
48
52
  begin
49
53
  api_message = JSON.parse(response.body)['message']
@@ -51,8 +55,9 @@ module Mailgun
51
55
  api_message = response.body
52
56
  rescue NoMethodError
53
57
  api_message = "Unknown API error"
58
+ rescue
59
+ api_message = 'Unknown API error'
54
60
  end
55
- api_message = api_message + ' - Invalid Domain or API key' if api_message == FORBIDDEN
56
61
 
57
62
  message = message || ''
58
63
  message = message + ': ' + api_message
@@ -62,6 +67,26 @@ module Mailgun
62
67
  @code = NOCODE
63
68
  super(message, response)
64
69
  end
70
+ end
71
+
72
+ # Public: Class for managing unauthorized 401 errors
73
+ # Inherits from Mailgun::CommunicationError
74
+ class Unauthorized < CommunicationError
75
+ CODE = 401
65
76
 
77
+ def initialize(error_message, response)
78
+ error_message = error_message + ' - Invalid Domain or API key'
79
+ super(error_message, response)
80
+ end
81
+ end
82
+
83
+ # Public: Class for managing bad request 400 errors
84
+ # Inherits from Mailgun::CommunicationError
85
+ class BadRequest < CommunicationError
86
+ CODE = 400
87
+
88
+ def initialize(error_message, response)
89
+ super(error_message, response)
90
+ end
66
91
  end
67
92
  end
@@ -406,7 +406,7 @@ module Mailgun
406
406
  def make_json(obj)
407
407
  return JSON.parse(obj).to_json if obj.is_a?(String)
408
408
  return obj.to_json if obj.is_a?(Hash)
409
- return JSON.generate(obj).to_json
409
+ JSON.generate(obj).to_json
410
410
  rescue
411
411
  raise Mailgun::ParameterError, 'Provided data could not be made into JSON. Try a JSON string or Hash.', obj
412
412
  end
@@ -429,7 +429,7 @@ module Mailgun
429
429
  full_name = vars['full_name']
430
430
  elsif vars['first'] || vars['last']
431
431
  full_name = "#{vars['first']} #{vars['last']}".strip
432
- end
432
+ end
433
433
 
434
434
  return "'#{full_name}' <#{address}>" if full_name
435
435
  address
File without changes
@@ -45,11 +45,11 @@ module Mailgun
45
45
  end
46
46
 
47
47
  def get_bounce(address)
48
- @client.get("#{@domain}/bounces/#{address}", nil)
48
+ @client.get("#{@domain}/bounces/#{escape_address(address)}", nil)
49
49
  end
50
50
 
51
51
  def create_bounce(params = {})
52
- @client.post("#{@domain/bounces}", params)
52
+ @client.post("#{@domain}/bounces", params)
53
53
  end
54
54
 
55
55
  # Creates multiple bounces on the Mailgun API.
@@ -100,7 +100,7 @@ module Mailgun
100
100
  end
101
101
 
102
102
  def delete_bounce(address)
103
- @client.delete("#{@domain}/bounces/#{address}")
103
+ @client.delete("#{@domain}/bounces/#{escape_address(address)}")
104
104
  end
105
105
 
106
106
  def delete_all_bounces
@@ -118,7 +118,7 @@ module Mailgun
118
118
  end
119
119
 
120
120
  def get_unsubscribe(address)
121
- @client.get("#{@domain}/unsubscribes/#{address}")
121
+ @client.get("#{@domain}/unsubscribes/#{escape_address(address)}")
122
122
  end
123
123
 
124
124
  def create_unsubscribe(params = {})
@@ -173,7 +173,7 @@ module Mailgun
173
173
  end
174
174
 
175
175
  def delete_unsubscribe(address, params = {})
176
- @client.delete("#{@domain}/unsubscribes/#{address}")
176
+ @client.delete("#{@domain}/unsubscribes/#{escape_address(address)}")
177
177
  end
178
178
 
179
179
  ####
@@ -187,7 +187,7 @@ module Mailgun
187
187
  end
188
188
 
189
189
  def get_complaint(address)
190
- @client.get("#{@domain}/complaints/#{address}", nil)
190
+ @client.get("#{@domain}/complaints/#{escape_address(address)}", nil)
191
191
  end
192
192
 
193
193
  def create_complaint(params = {})
@@ -239,11 +239,15 @@ module Mailgun
239
239
  end
240
240
 
241
241
  def delete_complaint(address)
242
- @client.delete("#{@domain}/complaints/#{address}")
242
+ @client.delete("#{@domain}/complaints/#{escape_address(address)}")
243
243
  end
244
244
 
245
245
  private
246
246
 
247
+ def escape_address(address)
248
+ CGI.escape address
249
+ end
250
+
247
251
  def get_from_paging(uri, params = {})
248
252
  @client.get(uri, params)
249
253
  end
@@ -1,4 +1,4 @@
1
1
  # It's the version. Yeay!
2
2
  module Mailgun
3
- VERSION = '1.2.5'
3
+ VERSION = '1.2.11'
4
4
  end
@@ -58,7 +58,7 @@ module Mailgun
58
58
  #
59
59
  # Returns true or false
60
60
  def create_all(domain, url = '')
61
- %w(bounce click deliver drop open spam unsubscribe).each do |action|
61
+ %w(accepted clicked complained delivered opened permanent_fail temporary_fail unsubscribed).each do |action|
62
62
  add_webhook domain, action, url
63
63
  end
64
64
  true
@@ -90,7 +90,7 @@ module Mailgun
90
90
  # Returns a Boolean on the success
91
91
  def remove_all(domain)
92
92
  fail Mailgun::ParameterError('Domain not provided to remove webhooks from') unless domain
93
- %w(bounce click deliver drop open spam unsubscribe).each do |action|
93
+ %w(accepted clicked complained delivered opened permanent_fail temporary_fail unsubscribed).each do |action|
94
94
  delete_webhook domain, action
95
95
  end
96
96
  end
data/lib/mailgun-ruby.rb CHANGED
@@ -1,2 +1,2 @@
1
1
  require 'mailgun'
2
- require 'railgun' if defined?(Rails)
2
+ require 'railgun' if defined?(Rails) && defined?(ActionMailer)
data/lib/mailgun.rb CHANGED
@@ -22,10 +22,12 @@ require 'mailgun/webhooks/webhooks'
22
22
  module Mailgun
23
23
 
24
24
  class << self
25
- attr_accessor :api_key,
25
+ attr_accessor :api_host,
26
+ :api_key,
26
27
  :api_version,
27
28
  :protocol,
28
29
  :mailgun_host,
30
+ :proxy_url,
29
31
  :test_mode,
30
32
  :domain
31
33
 
@@ -33,7 +33,7 @@ module Railgun
33
33
  config[:api_version] || 'v3',
34
34
  config[:api_ssl].nil? ? true : config[:api_ssl],
35
35
  false,
36
- config[:timeout],
36
+ config[:timeout]
37
37
  )
38
38
  @domain = @config[:domain]
39
39
 
@@ -48,7 +48,10 @@ module Railgun
48
48
 
49
49
  def deliver!(mail)
50
50
  @mg_domain = set_mg_domain(mail)
51
+ @mg_client.set_api_key(mail[:api_key].value) if mail[:api_key].present?
52
+
51
53
  mail[:domain] = nil if mail[:domain].present?
54
+ mail[:api_key] = nil if mail[:api_key].present?
52
55
 
53
56
  mg_message = Railgun.transform_for_mailgun(mail)
54
57
  response = @mg_client.send_message(@mg_domain, mg_message)
@@ -7,7 +7,7 @@ describe 'For the Bounces endpoint', order: :defined, vcr: vcr_opts do
7
7
  before(:all) do
8
8
  @mg_obj = Mailgun::Client.new(APIKEY, APIHOST, APIVERSION, SSL)
9
9
  @domain = TESTDOMAIN
10
- @email = "integration-test-email@#{TESTDOMAIN}"
10
+ @email = "integration-test+email@#{TESTDOMAIN}"
11
11
  end
12
12
 
13
13
  it 'creates a bounce' do
@@ -22,7 +22,7 @@ describe 'For the Bounces endpoint', order: :defined, vcr: vcr_opts do
22
22
  end
23
23
 
24
24
  it 'get a bounce.' do
25
- result = @mg_obj.get("#{@domain}/bounces/#{@email}")
25
+ result = @mg_obj.get("#{@domain}/bounces/#{CGI.escape(@email)}")
26
26
 
27
27
  result.to_h!
28
28
  expect(result.body["code"]).to eq("550")
@@ -38,7 +38,7 @@ describe 'For the Bounces endpoint', order: :defined, vcr: vcr_opts do
38
38
  end
39
39
 
40
40
  it 'deletes a bounce' do
41
- @mg_obj.delete("#{@domain}/bounces/#{@email}")
41
+ @mg_obj.delete("#{@domain}/bounces/#{CGI.escape(@email)}")
42
42
  end
43
43
 
44
44
  end
File without changes
File without changes
@@ -36,4 +36,12 @@ describe 'For the domains endpoint', vcr: vcr_opts do
36
36
 
37
37
  expect(result).to be_truthy
38
38
  end
39
+
40
+ it 'updates the domain' do
41
+ result = @mg_obj.update(@domain, { spam_action: 'block', web_scheme: 'https', wildcard: true })
42
+
43
+ expect(result['domain']["spam_action"]).to eq('block')
44
+ expect(result['domain']["web_scheme"]).to eq('https')
45
+ expect(result['domain']["wildcard"]).to eq(true)
46
+ end
39
47
  end
@@ -7,7 +7,7 @@ vcr_opts = { :cassette_name => "email_validation" }
7
7
 
8
8
  describe 'For the email validation endpoint', order: :defined, vcr: vcr_opts do
9
9
  before(:all) do
10
- @mg_obj = Mailgun::Address.new(PUB_APIKEY)
10
+ @mg_obj = Mailgun::Address.new
11
11
 
12
12
  @valid = ["Alice <alice@example.com>", "bob@example.com"]
13
13
  @invalid = ["example.org"]
@@ -15,13 +15,6 @@ describe 'For the email validation endpoint', order: :defined, vcr: vcr_opts do
15
15
  @all_addrs = @valid + @invalid
16
16
  end
17
17
 
18
- it 'returns parsed and unparsable lists' do
19
- res = @mg_obj.parse(@all_addrs)
20
-
21
- expect(res["parsed"]).to eq(@valid)
22
- expect(res["unparseable"]).to eq(@invalid)
23
- end
24
-
25
18
  it 'validates alice@mailgun.net with info' do
26
19
  res = @mg_obj.validate("alice@mailgun.net")
27
20
 
File without changes
File without changes
File without changes
@@ -34,6 +34,78 @@ describe 'Client exceptions', vcr: vcr_opts do
34
34
  end
35
35
  end
36
36
 
37
+ vcr_opts = { :cassette_name => "exceptions-invalid-api-key" }
38
+
39
+ describe 'Client exceptions', vcr: vcr_opts do
40
+ before(:all) do
41
+ @mg_obj = Mailgun::Client.new(APIKEY, APIHOST, APIVERSION, SSL)
42
+ @domain = TESTDOMAIN
43
+ end
44
+
45
+ it 'displays error information that API key is invalid' do
46
+ begin
47
+ @mg_obj.send_message(@domain, {
48
+ :from => "sally@#{@domain}",
49
+ :to => "sally@#{@domain}",
50
+ :subject => 'Exception Integration Test',
51
+ :text => 'INTEGRATION TESTING'
52
+ })
53
+ rescue Mailgun::Unauthorized => err
54
+ expect(err.message).to eq('401 Unauthorized - Invalid Domain or API key: Forbidden')
55
+ else
56
+ fail
57
+ end
58
+ end
59
+ end
60
+
61
+ vcr_opts = { :cassette_name => "exceptions-invalid-data" }
62
+
63
+ describe 'Client exceptions', vcr: vcr_opts do
64
+ before(:all) do
65
+ @mg_obj = Mailgun::Client.new(APIKEY, APIHOST, APIVERSION, SSL)
66
+ @domain = TESTDOMAIN
67
+ end
68
+
69
+ it 'display useful error information' do
70
+ begin
71
+ @mg_obj.send_message(@domain, {
72
+ :from => "sally@#{@domain}",
73
+ :to => "sally#{@domain}",
74
+ :subject => 'Exception Integration Test',
75
+ :text => 'INTEGRATION TESTING'
76
+ })
77
+ rescue Mailgun::BadRequest => err
78
+ expect(err.message).to eq('400 Bad Request: to parameter is not a valid address. please check documentation')
79
+ else
80
+ fail
81
+ end
82
+ end
83
+ end
84
+
85
+ vcr_opts = { :cassette_name => "exceptions-not-allowed" }
86
+
87
+ describe 'Client exceptions', vcr: vcr_opts do
88
+ before(:all) do
89
+ @mg_obj = Mailgun::Client.new(APIKEY, APIHOST, APIVERSION, SSL)
90
+ @domain = TESTDOMAIN
91
+ end
92
+
93
+ it 'display useful error information' do
94
+ begin
95
+ @mg_obj.send_message(@domain, {
96
+ :from => "invalid@#{@domain}",
97
+ :to => "invalid#{@domain}",
98
+ :subject => 'Exception Integration Test',
99
+ :text => 'INTEGRATION TESTING'
100
+ })
101
+ rescue Mailgun::CommunicationError => err
102
+ expect(err.message).to include('403 Forbidden')
103
+ else
104
+ fail
105
+ end
106
+ end
107
+ end
108
+
37
109
  vcr_opts = { :cassette_name => "send_message" }
38
110
 
39
111
  describe 'The method send_message()', vcr: vcr_opts do
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -46,7 +46,8 @@ module Mailgun
46
46
  Mailgun::Response.new(response_generator(@endpoint))
47
47
  rescue => e
48
48
  p e
49
- raise CommunicationError.new(e), e.response
49
+ raise CommunicationError.new(e), e.response if e.respond_to? :response
50
+ raise CommunicationError.new(e.message)
50
51
  end
51
52
  end
52
53
 
@@ -82,11 +83,11 @@ module Mailgun
82
83
  message = data.respond_to?(:message) ? data.message : data
83
84
 
84
85
  fail ParameterError.new(
85
- 'Missing `to` recipient, message should containg at least 1 recipient',
86
+ 'Missing `to` recipient, message should contain at least 1 recipient',
86
87
  working_domain
87
88
  ) if message.fetch('to', []).empty? && message.fetch(:to, []).empty?
88
89
  fail ParameterError.new(
89
- 'Missing a `from` sender, message should containg at least 1 `from` sender',
90
+ 'Missing a `from` sender, message should contain at least 1 `from` sender',
90
91
  working_domain
91
92
  ) if message.fetch('from', []).empty? && message.fetch(:from, []).empty?
92
93
  end
@@ -87,6 +87,25 @@ describe 'The method post()' do
87
87
  expect(result.body).to include("message")
88
88
  expect(result.body).to include("id")
89
89
  end
90
+
91
+ context 'when Unknown API error is raised' do
92
+ before do
93
+ allow(Mailgun::Response).to receive(:new).and_raise(StandardError, "message")
94
+ allow(JSON).to receive(:parse).and_raise('Unknown')
95
+ end
96
+
97
+ it 'adds Unknown API error to message' do
98
+ data = {'from' => 'joe@test.com',
99
+ 'to' => 'bob@example.com',
100
+ 'subject' => 'Test',
101
+ 'text' => 'Test Data'}
102
+ @mg_obj.post("#{@domain}/messages", data)
103
+ rescue Mailgun::CommunicationError => err
104
+ expect(err.message).to eq('message: Unknown API error')
105
+ else
106
+ fail
107
+ end
108
+ end
90
109
  end
91
110
 
92
111
  describe 'The method put()' do
@@ -5,7 +5,7 @@ http_interactions:
5
5
  uri: https://api:<APIKEY>@api.mailgun.net/v3/DOMAIN.TEST/bounces
6
6
  body:
7
7
  encoding: US-ASCII
8
- string: address=integration-test-email%40DOMAIN.TEST&code=550&error=Integration%20Test
8
+ string: address=integration-test%2Bemail%40DOMAIN.TEST&code=550&error=Integration%20Test
9
9
  headers:
10
10
  Accept:
11
11
  - "*/*; q=0.5, application/xml"
@@ -42,13 +42,13 @@ http_interactions:
42
42
  - Content-Type, x-requested-with
43
43
  body:
44
44
  encoding: UTF-8
45
- string: '{"address":"integration-test-email@DOMAIN.TEST","message":"Address
45
+ string: '{"address":"integration-test+email@DOMAIN.TEST","message":"Address
46
46
  has been added to the bounces table"}'
47
- http_version:
47
+ http_version:
48
48
  recorded_at: Fri, 08 Jan 2016 20:33:29 GMT
49
49
  - request:
50
50
  method: get
51
- uri: https://api:<APIKEY>@api.mailgun.net/v3/DOMAIN.TEST/bounces/integration-test-email@DOMAIN.TEST
51
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/DOMAIN.TEST/bounces/integration-test+email@DOMAIN.TEST
52
52
  body:
53
53
  encoding: US-ASCII
54
54
  string: ''
@@ -84,9 +84,9 @@ http_interactions:
84
84
  - Content-Type, x-requested-with
85
85
  body:
86
86
  encoding: UTF-8
87
- string: '{"address":"integration-test-email@DOMAIN.TEST","code":"550","error":"Integration
87
+ string: '{"address":"integration-test+email@DOMAIN.TEST","code":"550","error":"Integration
88
88
  Test","created_at":"Fri, 08 Jan 2016 20:33:28 UTC"}'
89
- http_version:
89
+ http_version:
90
90
  recorded_at: Fri, 08 Jan 2016 20:33:29 GMT
91
91
  - request:
92
92
  method: get
@@ -126,13 +126,13 @@ http_interactions:
126
126
  - Content-Type, x-requested-with
127
127
  body:
128
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:
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%2Bemaill%40DOMAIN.TEST\u0026limit=100","previous":"https://api.mailgun.net/v3/DOMAIN.TEST/bounces?page=previous\u0026address=integration-test%2Bemail%40DOMAIN.TEST\u0026limit=100"}}'
131
+ http_version:
132
132
  recorded_at: Fri, 08 Jan 2016 20:33:29 GMT
133
133
  - request:
134
134
  method: delete
135
- uri: https://api:<APIKEY>@api.mailgun.net/v3/DOMAIN.TEST/bounces/integration-test-email@DOMAIN.TEST
135
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/DOMAIN.TEST/bounces/integration-test+email@DOMAIN.TEST
136
136
  body:
137
137
  encoding: US-ASCII
138
138
  string: ''
@@ -168,8 +168,8 @@ http_interactions:
168
168
  - Content-Type, x-requested-with
169
169
  body:
170
170
  encoding: UTF-8
171
- string: '{"address":"integration-test-email@DOMAIN.TEST","message":"Bounced
171
+ string: '{"address":"integration-test+email@DOMAIN.TEST","message":"Bounced
172
172
  address has been removed"}'
173
- http_version:
173
+ http_version:
174
174
  recorded_at: Fri, 08 Jan 2016 20:33:30 GMT
175
175
  recorded_with: VCR 3.0.1
File without changes
File without changes
@@ -357,4 +357,54 @@ http_interactions:
357
357
  }
358
358
  http_version:
359
359
  recorded_at: Fri, 15 Jan 2016 20:12:54 GMT
360
- recorded_with: VCR 3.0.1
360
+ - request:
361
+ method: put
362
+ uri: https://api.mailgun.net/v3/domains/integration-test.domain.invalid
363
+ body:
364
+ encoding: UTF-8
365
+ string: spam_action=block&web_scheme=https&wildcard=true
366
+ headers:
367
+ Accept:
368
+ - "*/*"
369
+ User-Agent:
370
+ - rest-client/2.1.0 (darwin21.6.0 x86_64) ruby/2.5.1p57
371
+ Content-Length:
372
+ - '48'
373
+ Content-Type:
374
+ - application/x-www-form-urlencoded
375
+ Accept-Encoding:
376
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
377
+ Host:
378
+ - api.mailgun.net
379
+ Authorization:
380
+ - Basic YXBpOmQ5MTViNWNkYjlhNTgzNjg1ZDhmM2ZiMWJlYzBmMjBmLTA3YmM3YjA1LWZhNDgxNmEx
381
+ response:
382
+ status:
383
+ code: 200
384
+ message: OK
385
+ headers:
386
+ Access-Control-Allow-Credentials:
387
+ - 'true'
388
+ Access-Control-Allow-Origin:
389
+ - "*"
390
+ Cache-Control:
391
+ - no-store
392
+ Content-Length:
393
+ - '445'
394
+ Content-Type:
395
+ - application/json; charset=utf-8
396
+ Date:
397
+ - Mon, 17 Apr 2023 13:03:16 GMT
398
+ Strict-Transport-Security:
399
+ - max-age=63072000; includeSubDomains
400
+ X-Xss-Protection:
401
+ - 1; mode=block
402
+ body:
403
+ encoding: UTF-8
404
+ string: '{"message":"Domain has been updated","domain":{"created_at":"Mon, 25
405
+ Jan 2021 10:11:26 GMT","id":"600e994e20b1a14a5990856d","is_disabled":false,"name":"integration-test.domain.invalid","require_tls":false,"skip_verification":false,"smtp_login":"postmaster@DOMAIN.TEST","spam_action":"block","state":"active","type":"sandbox","web_prefix":"email","web_scheme":"https","wildcard":true}}
406
+
407
+ '
408
+ http_version:
409
+ recorded_at: Mon, 17 Apr 2023 13:04:47 GMT
410
+ recorded_with: VCR 3.0.3
File without changes