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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba2c61b94c146d06e1ae964a44adfe0e9ea735aba61cc08a4f143a9aa996e644
4
- data.tar.gz: 76741f9fb56cb30271eb7662d5ee45cafb76d5c08d29307fa21fd459f6021b03
3
+ metadata.gz: 3824447d13539969e56a4f92c0758acaa3ed8d83107d32400158e86cef25ca7b
4
+ data.tar.gz: efb48ecdc22f5beeff51484a2e5453797cd7d8f66c3913009d9e614cb37ecb91
5
5
  SHA512:
6
- metadata.gz: e6404733589f64b3544eac060e1ed18a80372fc9c2793170af47d641fc5388639caf12c3425be00ec6ae9be6d6951bbbfd4f5a0e1b220eac3ca118c5e8b885ff
7
- data.tar.gz: c4e360f86a0256926573fa0f2f4cc2620ccbdd90fd712e794a48c08e9eba955005998cb48cfb745d683faf23b7fbff56bf6d0b4e351c3265ef97166b41f81808
6
+ metadata.gz: 32bf21cc891b61b3afb61f89648d3f000068d81c0edd0b2a9b928b0ce748a9224fa3ce86a28eeabb73247f1762a689fc93b957dfaa85f8f3b976a5bb070eddd5
7
+ data.tar.gz: b74850e669c2b90b8e7433a390a7a69aa0db9b9ae73758cc743a72040137f629246bbd11cf29234273d13ae833392c3890047601532689756201ad702dd3ae84
@@ -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
@@ -3,5 +3,5 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in mailgun.gemspec
4
4
  gemspec
5
5
 
6
- gem 'mime-types'
6
+ gem 'mini_mime'
7
7
  gem 'json', '~> 2.1', platform: :mri_19
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.8'
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
@@ -1,4 +1,4 @@
1
- require 'mime/types'
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 = MIME::Types.type_for(attachment.path)
476
- content_type = mime_types.empty? ? 'application/octet-stream' : mime_types[0].content_type
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
 
@@ -1,4 +1,4 @@
1
1
  # It's the version. Yeay!
2
2
  module Mailgun
3
- VERSION = '1.3.8'
3
+ VERSION = '1.3.10'
4
4
  end
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.2.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', '~> 2.0.0'
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 'mime-types'
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
- vcr_opts = { :cassette_name => "instance" }
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
- vcr_opts = { :cassette_name => "exceptions" }
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 eq('the server responded with status 404: Domain not found: not-our-doma.in')
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
- vcr_opts = { :cassette_name => "exceptions-invalid-api-key" }
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 eq('the server responded with status 401 - Invalid Domain or API key')
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
- vcr_opts = { :cassette_name => "exceptions-invalid-data" }
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 eq('the server responded with status 400: to parameter is not a valid address. please check documentation')
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
- vcr_opts = { :cassette_name => "exceptions-not-allowed" }
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
- vcr_opts = { :cassette_name => "send_message" }
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'
@@ -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.2
1054
+ - mailgun-sdk-ruby/1.3.10
1010
1055
  Accept:
1011
1056
  - "*/*"
1012
1057
  Authorization:
1013
- - Basic xxx
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
- - '58'
1073
+ - '39'
1029
1074
  Content-Type:
1030
- - application/json; charset=utf-8
1075
+ - application/json
1031
1076
  Date:
1032
- - Wed, 26 Feb 2025 21:57:39 GMT
1077
+ - Thu, 28 Aug 2025 14:47:08 GMT
1033
1078
  Strict-Transport-Security:
1034
1079
  - max-age=63072000; includeSubDomains
1035
- X-Mailgun-Key-Id:
1036
- - c02fd0ba-d8dbad66
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: Wed, 26 Feb 2025 21:57:39 GMT
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.8
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-07-23 00:00:00.000000000 Z
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: 2.0.0
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: 2.0.0
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: mime-types
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.2.2
313
+ version: 2.6.10
314
314
  required_rubygems_version: !ruby/object:Gem::Requirement
315
315
  requirements:
316
316
  - - ">="