mailgun-ruby 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/mailgun/client.rb +2 -0
- data/lib/mailgun/messages/message_builder.rb +6 -2
- data/lib/mailgun/version.rb +1 -1
- data/lib/railgun/mailer.rb +1 -1
- data/lib/railgun/railtie.rb +3 -2
- data/spec/unit/messages/message_builder_spec.rb +7 -3
- data/spec/unit/railgun/mailer_spec.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64d4a0d5c1b85d58db90763fc5dbcd0f813f29bf30b328fdda6b7a019fbeb445
|
4
|
+
data.tar.gz: 2ddef97a1b88cd9d45c5e2d1b41df3b61e7b3a09a5dcbe4c3b0a62191335aeed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18df9ff784b8c39376420fcebe0b16a195318e63b70e6b6f5fb6139fd4cbd276ef1647844de6fd12c1e272906862ddfcdc85bb59ab29460dee6e0e02ec872ee8
|
7
|
+
data.tar.gz: 25547234506d03d471ea3f3bbfb46eb6c10e104147f6fc7cbe3b3228b966d31b5a3e53f423554c22f45360c119c5c015659b819559ef8d664c7c5ac47be09d00
|
data/README.md
CHANGED
data/lib/mailgun/client.rb
CHANGED
@@ -64,6 +64,8 @@ module Mailgun
|
|
64
64
|
# containing required parameters for the requested resource.
|
65
65
|
# @return [Mailgun::Response] A Mailgun::Response object.
|
66
66
|
def send_message(working_domain, data)
|
67
|
+
fail ParameterError.new('Missing working domain', working_domain) unless working_domain
|
68
|
+
|
67
69
|
if test_mode? then
|
68
70
|
Mailgun::Client.deliveries << data
|
69
71
|
return Response.from_hash(
|
@@ -270,8 +270,12 @@ module Mailgun
|
|
270
270
|
# @return [void]
|
271
271
|
def variable(name, data)
|
272
272
|
fail(Mailgun::ParameterError, 'Variable name must be specified') if name.to_s.empty?
|
273
|
-
|
274
|
-
|
273
|
+
begin
|
274
|
+
jsondata = make_json data
|
275
|
+
set_single("v:#{name}", jsondata)
|
276
|
+
rescue Mailgun::ParameterError
|
277
|
+
set_single("v:#{name}", data)
|
278
|
+
end
|
275
279
|
end
|
276
280
|
|
277
281
|
# Add custom parameter to the message. A custom parameter is any parameter that
|
data/lib/mailgun/version.rb
CHANGED
data/lib/railgun/mailer.rb
CHANGED
@@ -11,7 +11,7 @@ module Railgun
|
|
11
11
|
class Mailer
|
12
12
|
|
13
13
|
# List of the headers that will be ignored when copying headers from `mail.header_fields`
|
14
|
-
IGNORED_HEADERS = %w[ to from subject reply-to ]
|
14
|
+
IGNORED_HEADERS = %w[ to from subject reply-to mime-version ]
|
15
15
|
|
16
16
|
# [Hash] config ->
|
17
17
|
# Requires *at least* `api_key` and `domain` keys.
|
data/lib/railgun/railtie.rb
CHANGED
@@ -2,8 +2,9 @@ require 'railgun/mailer'
|
|
2
2
|
|
3
3
|
module Railgun
|
4
4
|
class Railtie < ::Rails::Railtie
|
5
|
-
|
6
|
-
|
5
|
+
ActiveSupport.on_load(:action_mailer) do
|
6
|
+
add_delivery_method :mailgun, Railgun::Mailer
|
7
|
+
ActiveSupport.run_load_hooks(:mailgun_mailer, Railgun::Mailer)
|
7
8
|
end
|
8
9
|
end
|
9
10
|
end
|
@@ -567,9 +567,13 @@ describe 'The method variable' do
|
|
567
567
|
expect(@mb_obj.message["v:my-data"]).to be_kind_of(String)
|
568
568
|
expect(@mb_obj.message["v:my-data"].to_s).to eq('{"key":"value"}')
|
569
569
|
end
|
570
|
-
it '
|
571
|
-
data = '
|
572
|
-
|
570
|
+
it 'accepts string values' do
|
571
|
+
data = 'String Value.'
|
572
|
+
|
573
|
+
@mb_obj.variable('my-data', data)
|
574
|
+
|
575
|
+
expect(@mb_obj.message["v:my-data"]).to be_kind_of(String)
|
576
|
+
expect(@mb_obj.message["v:my-data"].to_s).to eq('String Value.')
|
573
577
|
end
|
574
578
|
end
|
575
579
|
|
@@ -191,6 +191,19 @@ describe 'Railgun::Mailer' do
|
|
191
191
|
expect(body['h:reply-to']).to eq('dude@example.com.au')
|
192
192
|
end
|
193
193
|
|
194
|
+
it 'ignores `mime-version` in headers' do
|
195
|
+
message = UnitTestMailer.plain_message('test@example.org', '', {
|
196
|
+
'mime-version' => '1.0',
|
197
|
+
})
|
198
|
+
message.mailgun_headers = {
|
199
|
+
'Mime-Version' => '1.1',
|
200
|
+
}
|
201
|
+
message.headers({'MIME-VERSION' => '1.2'})
|
202
|
+
|
203
|
+
body = Railgun.transform_for_mailgun(message)
|
204
|
+
expect(body).not_to include('h:mime-version')
|
205
|
+
end
|
206
|
+
|
194
207
|
it 'treats `headers()` names as case-insensitve' do
|
195
208
|
message = UnitTestMailer.plain_message('test@example.org', '', {
|
196
209
|
'X-BIG-VALUE' => 1,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailgun-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mailgun
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-04-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|