mailgun-ruby 1.3.8 → 1.3.10
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/.github/workflows/ci.yml +2 -2
- data/CHANGELOG.md +5 -0
- data/Gemfile +1 -1
- data/README.md +1 -1
- data/lib/mailgun/client.rb +3 -2
- data/lib/mailgun/messages/message_builder.rb +3 -3
- data/lib/mailgun/version.rb +1 -1
- data/mailgun.gemspec +3 -3
- data/spec/integration/mailgun_spec.rb +12 -21
- data/vcr_cassettes/domains.yml +53 -8
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3824447d13539969e56a4f92c0758acaa3ed8d83107d32400158e86cef25ca7b
|
4
|
+
data.tar.gz: efb48ecdc22f5beeff51484a2e5453797cd7d8f66c3913009d9e614cb37ecb91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32bf21cc891b61b3afb61f89648d3f000068d81c0edd0b2a9b928b0ce748a9224fa3ce86a28eeabb73247f1762a689fc93b957dfaa85f8f3b976a5bb070eddd5
|
7
|
+
data.tar.gz: b74850e669c2b90b8e7433a390a7a69aa0db9b9ae73758cc743a72040137f629246bbd11cf29234273d13ae833392c3890047601532689756201ad702dd3ae84
|
data/.github/workflows/ci.yml
CHANGED
@@ -15,7 +15,7 @@ jobs:
|
|
15
15
|
runs-on: ubuntu-latest
|
16
16
|
strategy:
|
17
17
|
matrix:
|
18
|
-
ruby-version: ['3.1', '3.4']
|
18
|
+
ruby-version: [ '2.6', '2.7', '3.0', '3.1', '3.4' ]
|
19
19
|
|
20
20
|
steps:
|
21
21
|
- uses: actions/checkout@v4
|
@@ -25,4 +25,4 @@ jobs:
|
|
25
25
|
ruby-version: ${{ matrix.ruby-version }}
|
26
26
|
bundler-cache: true
|
27
27
|
- name: Run tests
|
28
|
-
run: bundle exec rake
|
28
|
+
run: bundle exec rake spec:all
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
+
## [1.3.9] - 2025-07-28
|
6
|
+
|
7
|
+
- Fix messages.mime broken by @alex-leb in (https://github.com/mailgun/mailgun-ruby/pull/361)
|
8
|
+
- Fix BatchMessage modifies stored test deliveries by @alex-leb in (https://github.com/mailgun/mailgun-ruby/pull/362)
|
9
|
+
|
5
10
|
## [1.3.8] - 2025-07-23
|
6
11
|
|
7
12
|
- Respond with error message for 400 Bad Request
|
data/Gemfile
CHANGED
data/README.md
CHANGED
data/lib/mailgun/client.rb
CHANGED
@@ -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
|
-
|
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
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'mini_mime'
|
2
2
|
require 'time'
|
3
3
|
require 'faraday/multipart'
|
4
4
|
|
@@ -472,8 +472,8 @@ module Mailgun
|
|
472
472
|
) unless attachment.respond_to?(:read)
|
473
473
|
|
474
474
|
if attachment.respond_to?(:path) && !attachment.respond_to?(:content_type)
|
475
|
-
mime_types =
|
476
|
-
content_type = mime_types.
|
475
|
+
mime_types = MiniMime.lookup_by_filename(attachment.path)
|
476
|
+
content_type = mime_types.nil? ? 'application/octet-stream' : mime_types.content_type
|
477
477
|
attachment.instance_eval "def content_type; '#{content_type}'; end"
|
478
478
|
end
|
479
479
|
|
data/lib/mailgun/version.rb
CHANGED
data/mailgun.gemspec
CHANGED
@@ -25,18 +25,18 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
26
26
|
spec.require_paths = ["lib"]
|
27
27
|
|
28
|
-
spec.required_ruby_version = '>= 2.
|
28
|
+
spec.required_ruby_version = '>= 2.6.10'
|
29
29
|
|
30
30
|
spec.add_development_dependency 'bundler', '>= 1.16.2'
|
31
31
|
spec.add_development_dependency 'rspec', '~> 3.13.0'
|
32
|
-
spec.add_development_dependency 'rspec-its', '~>
|
32
|
+
spec.add_development_dependency 'rspec-its', '~> 1.3.1'
|
33
33
|
spec.add_development_dependency 'rake', '~> 12.3.2'
|
34
34
|
spec.add_development_dependency 'webmock', '~> 3.7'
|
35
35
|
spec.add_development_dependency 'pry', '~> 0.15.2'
|
36
36
|
spec.add_development_dependency 'vcr', '~> 3.0.3'
|
37
37
|
spec.add_development_dependency 'simplecov', '~> 0.16.1'
|
38
38
|
spec.add_development_dependency 'rails'
|
39
|
-
spec.add_dependency '
|
39
|
+
spec.add_dependency 'mini_mime'
|
40
40
|
spec.add_dependency 'faraday', "~> 2.1"
|
41
41
|
spec.add_dependency 'faraday-multipart', '~> 1.1.0'
|
42
42
|
|
@@ -2,17 +2,13 @@ require 'spec_helper'
|
|
2
2
|
require 'mailgun'
|
3
3
|
require 'mailgun/exceptions/exceptions'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
describe 'Mailgun instantiation', vcr: vcr_opts do
|
5
|
+
describe 'Mailgun instantiation', vcr: { :cassette_name => "instance" } do
|
8
6
|
it 'instantiates an HttpClient object' do
|
9
7
|
expect {@mg_obj = Mailgun::Client.new(APIKEY, APIHOST, APIVERSION, SSL)}.not_to raise_error
|
10
8
|
end
|
11
9
|
end
|
12
10
|
|
13
|
-
|
14
|
-
|
15
|
-
describe 'Client exceptions', vcr: vcr_opts do
|
11
|
+
describe 'Client exceptions', vcr: { :cassette_name => "exceptions" } do
|
16
12
|
before(:all) do
|
17
13
|
@mg_obj = Mailgun::Client.new(APIKEY, APIHOST, APIVERSION, SSL)
|
18
14
|
@domain = TESTDOMAIN || 'DOMAIN.TEST'
|
@@ -27,16 +23,15 @@ describe 'Client exceptions', vcr: vcr_opts do
|
|
27
23
|
:text => 'INTEGRATION TESTING'
|
28
24
|
})
|
29
25
|
rescue Mailgun::CommunicationError => err
|
30
|
-
expect(err.message).to
|
26
|
+
expect(err.message).to include('404')
|
27
|
+
expect(err.message).to include('Domain not found: not-our-doma.in')
|
31
28
|
else
|
32
29
|
fail
|
33
30
|
end
|
34
31
|
end
|
35
32
|
end
|
36
33
|
|
37
|
-
|
38
|
-
|
39
|
-
describe 'Client exceptions', vcr: vcr_opts do
|
34
|
+
describe 'Client exceptions', vcr: { :cassette_name => "exceptions-invalid-api-key" } do
|
40
35
|
before(:all) do
|
41
36
|
@mg_obj = Mailgun::Client.new(APIKEY, APIHOST, APIVERSION, SSL)
|
42
37
|
@domain = TESTDOMAIN || 'DOMAIN.TEST'
|
@@ -51,16 +46,15 @@ describe 'Client exceptions', vcr: vcr_opts do
|
|
51
46
|
:text => 'INTEGRATION TESTING'
|
52
47
|
})
|
53
48
|
rescue Mailgun::Unauthorized => err
|
54
|
-
expect(err.message).to
|
49
|
+
expect(err.message).to include('401')
|
50
|
+
expect(err.message).to include('Invalid Domain or API key')
|
55
51
|
else
|
56
52
|
fail
|
57
53
|
end
|
58
54
|
end
|
59
55
|
end
|
60
56
|
|
61
|
-
|
62
|
-
|
63
|
-
describe 'Client exceptions', vcr: vcr_opts do
|
57
|
+
describe 'Client exceptions', vcr: { :cassette_name => "exceptions-invalid-data" } do
|
64
58
|
before(:all) do
|
65
59
|
@mg_obj = Mailgun::Client.new(APIKEY, APIHOST, APIVERSION, SSL)
|
66
60
|
@domain = TESTDOMAIN || 'DOMAIN.TEST'
|
@@ -75,16 +69,15 @@ describe 'Client exceptions', vcr: vcr_opts do
|
|
75
69
|
:text => 'INTEGRATION TESTING'
|
76
70
|
})
|
77
71
|
rescue Mailgun::BadRequest => err
|
78
|
-
expect(err.message).to
|
72
|
+
expect(err.message).to include('400')
|
73
|
+
expect(err.message).to include('to parameter is not a valid address. please check documentation')
|
79
74
|
else
|
80
75
|
fail
|
81
76
|
end
|
82
77
|
end
|
83
78
|
end
|
84
79
|
|
85
|
-
|
86
|
-
|
87
|
-
describe 'Client exceptions', vcr: vcr_opts do
|
80
|
+
describe 'Client exceptions', vcr: { :cassette_name => "exceptions-not-allowed" } do
|
88
81
|
before(:all) do
|
89
82
|
@mg_obj = Mailgun::Client.new(APIKEY, APIHOST, APIVERSION, SSL)
|
90
83
|
@domain = TESTDOMAIN || 'DOMAIN.TEST'
|
@@ -106,9 +99,7 @@ describe 'Client exceptions', vcr: vcr_opts do
|
|
106
99
|
end
|
107
100
|
end
|
108
101
|
|
109
|
-
|
110
|
-
|
111
|
-
describe 'The method send_message()', vcr: vcr_opts do
|
102
|
+
describe 'The method send_message()', vcr: { :cassette_name => "send_message" } do
|
112
103
|
before(:all) do
|
113
104
|
@mg_obj = Mailgun::Client.new(APIKEY, APIHOST, APIVERSION, SSL)
|
114
105
|
@domain = TESTDOMAIN || 'DOMAIN.TEST'
|
data/vcr_cassettes/domains.yml
CHANGED
@@ -998,6 +998,51 @@ http_interactions:
|
|
998
998
|
'
|
999
999
|
http_version:
|
1000
1000
|
recorded_at: Wed, 26 Feb 2025 21:54:43 GMT
|
1001
|
+
- request:
|
1002
|
+
method: delete
|
1003
|
+
uri: https://api.mailgun.net/v1/dkim/keys?params=%7B:signing_domain=%3E%22integration-test.domain.invalid%22,%20:selector=%3E%22test%22%7D
|
1004
|
+
body:
|
1005
|
+
encoding: US-ASCII
|
1006
|
+
string: ''
|
1007
|
+
headers:
|
1008
|
+
User-Agent:
|
1009
|
+
- mailgun-sdk-ruby/1.3.10
|
1010
|
+
Accept:
|
1011
|
+
- "*/*"
|
1012
|
+
Authorization:
|
1013
|
+
- Basic YXBpOg==
|
1014
|
+
Accept-Encoding:
|
1015
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
1016
|
+
response:
|
1017
|
+
status:
|
1018
|
+
code: 200
|
1019
|
+
message: OK
|
1020
|
+
headers:
|
1021
|
+
Access-Control-Allow-Credentials:
|
1022
|
+
- 'true'
|
1023
|
+
Access-Control-Allow-Origin:
|
1024
|
+
- "*"
|
1025
|
+
Cache-Control:
|
1026
|
+
- no-store
|
1027
|
+
Content-Length:
|
1028
|
+
- '39'
|
1029
|
+
Content-Type:
|
1030
|
+
- application/json
|
1031
|
+
Date:
|
1032
|
+
- Thu, 28 Aug 2025 12:45:35 GMT
|
1033
|
+
Strict-Transport-Security:
|
1034
|
+
- max-age=63072000; includeSubDomains
|
1035
|
+
Www-Authenticate:
|
1036
|
+
- Basic realm="MG API"
|
1037
|
+
X-Xss-Protection:
|
1038
|
+
- 1; mode=block
|
1039
|
+
body:
|
1040
|
+
encoding: UTF-8
|
1041
|
+
string: '{"message":"success"}
|
1042
|
+
|
1043
|
+
'
|
1044
|
+
http_version:
|
1045
|
+
recorded_at: Thu, 28 Aug 2025 12:45:35 GMT
|
1001
1046
|
- request:
|
1002
1047
|
method: delete
|
1003
1048
|
uri: https://api.mailgun.net/v1/dkim/keys?params=%7Bsigning_domain:%20%22integration-test.domain.invalid%22,%20selector:%20%22test%22%7D
|
@@ -1006,11 +1051,11 @@ http_interactions:
|
|
1006
1051
|
string: ''
|
1007
1052
|
headers:
|
1008
1053
|
User-Agent:
|
1009
|
-
- mailgun-sdk-ruby/1.3.
|
1054
|
+
- mailgun-sdk-ruby/1.3.10
|
1010
1055
|
Accept:
|
1011
1056
|
- "*/*"
|
1012
1057
|
Authorization:
|
1013
|
-
- Basic
|
1058
|
+
- Basic YXBpOg==
|
1014
1059
|
Accept-Encoding:
|
1015
1060
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
1016
1061
|
response:
|
@@ -1025,15 +1070,15 @@ http_interactions:
|
|
1025
1070
|
Cache-Control:
|
1026
1071
|
- no-store
|
1027
1072
|
Content-Length:
|
1028
|
-
- '
|
1073
|
+
- '39'
|
1029
1074
|
Content-Type:
|
1030
|
-
- application/json
|
1075
|
+
- application/json
|
1031
1076
|
Date:
|
1032
|
-
-
|
1077
|
+
- Thu, 28 Aug 2025 14:47:08 GMT
|
1033
1078
|
Strict-Transport-Security:
|
1034
1079
|
- max-age=63072000; includeSubDomains
|
1035
|
-
|
1036
|
-
-
|
1080
|
+
Www-Authenticate:
|
1081
|
+
- Basic realm="MG API"
|
1037
1082
|
X-Xss-Protection:
|
1038
1083
|
- 1; mode=block
|
1039
1084
|
body:
|
@@ -1042,5 +1087,5 @@ http_interactions:
|
|
1042
1087
|
|
1043
1088
|
'
|
1044
1089
|
http_version:
|
1045
|
-
recorded_at:
|
1090
|
+
recorded_at: Thu, 28 Aug 2025 14:47:08 GMT
|
1046
1091
|
recorded_with: VCR 3.0.3
|
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.
|
4
|
+
version: 1.3.10
|
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-
|
11
|
+
date: 2025-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 1.3.1
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 1.3.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,7 +137,7 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: mini_mime
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - ">="
|
@@ -310,7 +310,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
310
310
|
requirements:
|
311
311
|
- - ">="
|
312
312
|
- !ruby/object:Gem::Version
|
313
|
-
version: 2.
|
313
|
+
version: 2.6.10
|
314
314
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
315
315
|
requirements:
|
316
316
|
- - ">="
|