mailgun-ruby 1.3.7 → 1.3.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0041dce1e0fc1dc9f5166d4095a8d39dadf26be5b5b7892f1b8005b60a471a1f
4
- data.tar.gz: 4356cf2e9093a066e28ff7fab036af94294eb4515137d0f802f001093b2d477f
3
+ metadata.gz: 4e49ed622ba4de1537cb0cce86e10625246d662647775395b90b8474d9a9851b
4
+ data.tar.gz: fa6b6dc8b656f7019b99d1d9acda02d83f2ff341ff117872489e016d5bbdacc4
5
5
  SHA512:
6
- metadata.gz: 3420a656e1d4ef615a665743190b593a46a5ea13f778bf65a2b1d32746a30fb2ed08adde9d6651aeaacfa7fc8e815cc0cf51a510fd7c2b83e8a20c8b3cb34391
7
- data.tar.gz: 864f0bfc57d6e06112eb410870bd88d6a7aa81a1b8f71bbb88206a6b768fcc1346635d76c2ffa059469911baed7e911e4f96e3cb6793192794511719e31dba99
6
+ metadata.gz: aaca70334ed6dfd48266275f8cb31b0e6a48897a7ab92c16212aa3d2e767963a80458375b26dcf4e2bcb0307752dce4c70332c8cbc965d983bceb17ddf8b86f3
7
+ data.tar.gz: c431cdf136b5cec3af1bbbd282c44ba599882f8b7e0ada6dace5db9a9584e77b7ffff78251e5681ed155233ea948af89900e4b80895ed2d2254673303f9c138c
data/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.3.8] - 2025-07-23
6
+
7
+ - Respond with error message for 400 Bad Request
8
+
9
+ ## [1.3.7] - 2025-06-29
10
+
11
+ - Use proxy_url passed to constructor (https://github.com/mailgun/mailgun-ruby/pull/342)
12
+ - Refactor to use UserNotifier instead of UserMailer for consistency (https://github.com/mailgun/mailgun-ruby/pull/323)
13
+ - Add option to specify api key and host when initializing Address api (https://github.com/mailgun/mailgun-ruby/pull/328)
14
+ - Remove base64 dependency (https://github.com/mailgun/mailgun-ruby/pull/313)
15
+ - DE-1547: Support for the logs API (https://github.com/mailgun/mailgun-ruby/pull/356)
16
+
5
17
  ## [1.3.6] - 2025-05-30
6
18
 
7
19
  ### Fixed
data/README.md CHANGED
@@ -19,7 +19,7 @@ gem install mailgun-ruby
19
19
  Gemfile:
20
20
 
21
21
  ```ruby
22
- gem 'mailgun-ruby', '~>1.3.7'
22
+ gem 'mailgun-ruby', '~>1.3.9'
23
23
  ```
24
24
 
25
25
  Usage
@@ -103,7 +103,7 @@ module Mailgun
103
103
  perform_data_validation(working_domain, data)
104
104
 
105
105
  if test_mode? then
106
- Mailgun::Client.deliveries << data
106
+ Mailgun::Client.deliveries << data.dup
107
107
  return Response.from_hash(
108
108
  {
109
109
  :body => "{\"id\": \"test-mode-mail-#{SecureRandom.uuid}@localhost\", \"message\": \"Queued. Thank you.\"}",
@@ -121,7 +121,8 @@ module Mailgun
121
121
 
122
122
  if data.key?(:message)
123
123
  if data[:message].is_a?(String)
124
- data[:message] = convert_string_to_file(data[:message])
124
+ file = convert_string_to_file(data[:message])
125
+ data[:message] = Faraday::Multipart::FilePart.new(file, 'multipart/form-data')
125
126
  end
126
127
  return post("#{working_domain}/messages.mime", data)
127
128
  end
@@ -46,11 +46,11 @@ module Mailgun
46
46
  @status = if response.nil?
47
47
  NOCODE
48
48
  else
49
- response.status
49
+ response[:status]
50
50
  end
51
51
 
52
52
  begin
53
- json = JSON.parse(response.body)
53
+ json = JSON.parse(response[:body])
54
54
  api_message = json['message'] || json['Error'] || json['error']
55
55
  rescue JSON::ParserError
56
56
  api_message = response.response_body
@@ -1,4 +1,4 @@
1
1
  # It's the version. Yeay!
2
2
  module Mailgun
3
- VERSION = '1.3.7'
3
+ VERSION = '1.3.9'
4
4
  end
@@ -27,7 +27,7 @@ describe 'Client exceptions', vcr: vcr_opts do
27
27
  :text => 'INTEGRATION TESTING'
28
28
  })
29
29
  rescue Mailgun::CommunicationError => err
30
- expect(err.message).to eq('the server responded with status 404')
30
+ expect(err.message).to eq('the server responded with status 404: Domain not found: not-our-doma.in')
31
31
  else
32
32
  fail
33
33
  end
@@ -75,7 +75,7 @@ describe 'Client exceptions', vcr: vcr_opts do
75
75
  :text => 'INTEGRATION TESTING'
76
76
  })
77
77
  rescue Mailgun::BadRequest => err
78
- expect(err.message).to eq('the server responded with status 400')
78
+ expect(err.message).to eq('the server responded with status 400: to parameter is not a valid address. please check documentation')
79
79
  else
80
80
  fail
81
81
  end
@@ -5,13 +5,13 @@ RSpec.describe Mailgun::CommunicationError do
5
5
  context "when the Response body doesn't have a `message` property" do
6
6
  it "doesn't raise an error" do
7
7
  expect do
8
- described_class.new('Boom!', Mailgun::Response.from_hash({ status: 401, body: '{}' }))
8
+ described_class.new('Boom!', { status: 401, body: '{}' })
9
9
  end.not_to raise_error
10
10
  end
11
11
 
12
12
  context "when the Response body has an `Error` property" do
13
13
  it "uses the `Error` property as the API message" do
14
- subject = described_class.new('Boom!', Mailgun::Response.from_hash({ status: 401, body: '{"Error":"unauthorized"}' }))
14
+ subject = described_class.new('Boom!', { status: 401, body: '{"Error":"unauthorized"}' })
15
15
 
16
16
  expect(subject.message).to eq("Boom!: unauthorized")
17
17
  end
@@ -19,7 +19,7 @@ RSpec.describe Mailgun::CommunicationError do
19
19
 
20
20
  context "when the Response body has an `error` property" do
21
21
  it "uses the `Error` property as the API message" do
22
- subject = described_class.new('Boom!', Mailgun::Response.from_hash({ status: 401, body: '{"error":"not found"}' }))
22
+ subject = described_class.new('Boom!', { status: 401, body: '{"error":"not found"}' })
23
23
 
24
24
  expect(subject.message).to eq("Boom!: not found")
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailgun-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.7
4
+ version: 1.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mailgun
8
8
  - Travis Swientek
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-06-29 00:00:00.000000000 Z
11
+ date: 2025-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler