mailgun-ruby 1.1.10 → 1.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -5
- data/Gemfile +1 -1
- data/README.md +15 -0
- data/docs/Domains.md +0 -0
- data/docs/Webhooks.md +0 -0
- data/docs/railgun/Overview.md +11 -0
- data/docs/railgun/Parameters.md +83 -0
- data/lib/mailgun/client.rb +4 -2
- data/lib/mailgun/version.rb +1 -1
- data/lib/railgun/mailer.rb +40 -3
- data/mailgun.gemspec +11 -11
- data/spec/integration/email_validation_spec.rb +8 -0
- data/spec/integration/events_spec.rb +1 -1
- data/spec/spec_helper.rb +3 -1
- data/spec/unit/{railgun_spec.rb → railgun/content_type_spec.rb} +0 -0
- data/spec/unit/railgun/mailer_spec.rb +166 -0
- metadata +25 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e1995893ce0728f97a28d1b563b4169169d3e871b6c315da1dc0d76cec17d6a
|
4
|
+
data.tar.gz: 383bea571efa4bde52d6c6204ee2b3f477aa3d90ed1eef54a483d98b62a081e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6e4b5d442810888c03ec4ad214fd896d1198ef8d36f1ad2f92ff3895a02eff39e27fc9b78f8c6050bff75e374fe1e29595d86a50258fad778de766bfef15ec9
|
7
|
+
data.tar.gz: 4665963f9b08fc5ff8143d3eda4618825c7abf9dfc2ced3ff4962618cfcd98125fc809e326c9a45ad0517b08ed711ee62f82ffce38baac205be9b87b59085bbd
|
data/.travis.yml
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
language: ruby
|
2
2
|
sudo: false
|
3
3
|
rvm:
|
4
|
-
- 2.
|
5
|
-
- 2.
|
6
|
-
- 2.
|
7
|
-
- 2.
|
4
|
+
- 2.2.2
|
5
|
+
- 2.2.10
|
6
|
+
- 2.3.7
|
7
|
+
- 2.4.4
|
8
|
+
- 2.5.1
|
8
9
|
script:
|
9
10
|
- bundle install
|
10
11
|
- bundle exec rake spec
|
@@ -17,7 +18,7 @@ deploy:
|
|
17
18
|
gemspec: mailgun.gemspec
|
18
19
|
on:
|
19
20
|
tags: true
|
20
|
-
condition: "$TRAVIS_RUBY_VERSION == 2.
|
21
|
+
condition: "$TRAVIS_RUBY_VERSION == 2.5.1"
|
21
22
|
notifications:
|
22
23
|
slack:
|
23
24
|
rooms:
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -77,6 +77,21 @@ and replace `api-myapikey` and `mydomain.com` with your secret API key and domai
|
|
77
77
|
}
|
78
78
|
```
|
79
79
|
|
80
|
+
To specify Mailgun options such as campaign or tags:
|
81
|
+
```ruby
|
82
|
+
class UserMailer < ApplicationMailer
|
83
|
+
def welcome_email
|
84
|
+
mail(to: params[:to], subject: "Welcome!").tap do |message|
|
85
|
+
message.mailgun_options = {
|
86
|
+
"tag" => ["abtest-option-a", "beta-user"],
|
87
|
+
"tracking-opens" => true,
|
88
|
+
"tracking-clicks" => "htmlonly"
|
89
|
+
}
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
```
|
94
|
+
|
80
95
|
To get the Mailgun `message_id` after ActionMailer has successfully delivered the email:
|
81
96
|
|
82
97
|
```ruby
|
data/docs/Domains.md
CHANGED
File without changes
|
data/docs/Webhooks.md
CHANGED
File without changes
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Overview
|
2
|
+
========
|
3
|
+
|
4
|
+
Railgun is a Rails add-on that allows ActionMailer to send via the Mailgun API.
|
5
|
+
|
6
|
+
See [railgun-sample](https://github.com/pirogoeth/railgun-sample/) for examples of integrating Railgun with your Rails app.
|
7
|
+
|
8
|
+
|
9
|
+
## Table of Contents
|
10
|
+
|
11
|
+
- [Parameters](/docs/railgun/Parameters.md)
|
@@ -0,0 +1,83 @@
|
|
1
|
+
Parameters
|
2
|
+
==========
|
3
|
+
|
4
|
+
When sending messages via Railgun, it is often useful to set options, headers, and variables
|
5
|
+
that should be added to the `POST` request against the messages endpoint.
|
6
|
+
|
7
|
+
|
8
|
+
## Options
|
9
|
+
|
10
|
+
See [Mailgun Docs | Sending](https://documentation.mailgun.com/en/latest/api-sending.html#sending) for available options.
|
11
|
+
|
12
|
+
---
|
13
|
+
|
14
|
+
To set options on a message:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
# app/controllers/some_controller.rb
|
18
|
+
|
19
|
+
message = YourMailer.your_message(@args)
|
20
|
+
|
21
|
+
message.mailgun_options ||= {
|
22
|
+
"tracking-opens" => "true",
|
23
|
+
"tracking-clicks" => "htmlonly",
|
24
|
+
"tag" => "some,tags",
|
25
|
+
}
|
26
|
+
```
|
27
|
+
|
28
|
+
|
29
|
+
## Variables
|
30
|
+
|
31
|
+
See [Mailgun Docs | Attaching Data to Messages](https://documentation.mailgun.com/en/latest/user_manual.html#attaching-data-to-messages) for more information.
|
32
|
+
|
33
|
+
---
|
34
|
+
|
35
|
+
To set variables on a message:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
# app/controllers/some_controller.rb
|
39
|
+
|
40
|
+
message = YourMailer.your_message(@args)
|
41
|
+
|
42
|
+
message.mailgun_variables ||= {
|
43
|
+
"user_info" => {"id" => "1", "name" => "tstark"},
|
44
|
+
}
|
45
|
+
```
|
46
|
+
|
47
|
+
|
48
|
+
## Headers
|
49
|
+
|
50
|
+
See [Mailgun Docs | Sending](https://documentation.mailgun.com/en/latest/api-sending.html#sending) for more information.
|
51
|
+
|
52
|
+
---
|
53
|
+
|
54
|
+
To set headers on a message *from a controller*:
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
# app/controllers/some_controller.rb
|
58
|
+
|
59
|
+
message = YourMailer.your_message(@args)
|
60
|
+
|
61
|
+
message.mailgun_headers ||= {
|
62
|
+
"X-Sent-From-Rails" => "true",
|
63
|
+
}
|
64
|
+
```
|
65
|
+
|
66
|
+
To set headers on a message *from a mailer*:
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
# app/mailers/your_mailer.rb
|
70
|
+
|
71
|
+
class YourMailer < ApplicationMailer
|
72
|
+
# ...
|
73
|
+
|
74
|
+
def your_message(args)
|
75
|
+
headers({
|
76
|
+
"X-Sent-From-Rails" => "true",
|
77
|
+
})
|
78
|
+
|
79
|
+
mail to: "some-address@example.org", ...
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
```
|
data/lib/mailgun/client.rb
CHANGED
@@ -14,13 +14,15 @@ module Mailgun
|
|
14
14
|
api_host = 'api.mailgun.net',
|
15
15
|
api_version = 'v3',
|
16
16
|
ssl = true,
|
17
|
-
test_mode = false
|
17
|
+
test_mode = false,
|
18
|
+
timeout = nil)
|
18
19
|
|
19
20
|
endpoint = endpoint_generator(api_host, api_version, ssl)
|
20
21
|
@http_client = RestClient::Resource.new(endpoint,
|
21
22
|
user: 'api',
|
22
23
|
password: api_key,
|
23
|
-
user_agent: "mailgun-sdk-ruby/#{Mailgun::VERSION}"
|
24
|
+
user_agent: "mailgun-sdk-ruby/#{Mailgun::VERSION}",
|
25
|
+
timeout: timeout)
|
24
26
|
@test_mode = test_mode
|
25
27
|
end
|
26
28
|
|
data/lib/mailgun/version.rb
CHANGED
data/lib/railgun/mailer.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'action_mailer'
|
2
|
+
require 'json'
|
2
3
|
require 'mailgun'
|
3
4
|
require 'rails'
|
4
5
|
require 'railgun/errors'
|
@@ -9,6 +10,9 @@ module Railgun
|
|
9
10
|
# Mailgun.
|
10
11
|
class Mailer
|
11
12
|
|
13
|
+
# List of the headers that will be ignored when copying headers from `mail.header_fields`
|
14
|
+
IGNORED_HEADERS = %w[ to from subject ]
|
15
|
+
|
12
16
|
# [Hash] config ->
|
13
17
|
# Requires *at least* `api_key` and `domain` keys.
|
14
18
|
attr_accessor :config, :domain, :settings
|
@@ -47,7 +51,7 @@ module Railgun
|
|
47
51
|
end
|
48
52
|
|
49
53
|
def mailgun_client
|
50
|
-
@
|
54
|
+
@mg_client
|
51
55
|
end
|
52
56
|
|
53
57
|
end
|
@@ -66,7 +70,7 @@ module Railgun
|
|
66
70
|
|
67
71
|
# v:* attributes (variables)
|
68
72
|
mail.mailgun_variables.try(:each) do |k, v|
|
69
|
-
message["v:#{k}"] = v
|
73
|
+
message["v:#{k}"] = JSON.dump(v)
|
70
74
|
end
|
71
75
|
|
72
76
|
# o:* attributes (options)
|
@@ -74,8 +78,36 @@ module Railgun
|
|
74
78
|
message["o:#{k}"] = v
|
75
79
|
end
|
76
80
|
|
81
|
+
# support for using ActionMailer's `headers()` inside of the mailer
|
82
|
+
# note: this will filter out parameters such as `from`, `to`, and so forth
|
83
|
+
# as they are accepted as POST parameters on the message endpoint.
|
84
|
+
|
85
|
+
msg_headers = Hash.new
|
86
|
+
|
77
87
|
# h:* attributes (headers)
|
78
88
|
mail.mailgun_headers.try(:each) do |k, v|
|
89
|
+
msg_headers[k] = v
|
90
|
+
end
|
91
|
+
|
92
|
+
mail.header_fields.each do |field|
|
93
|
+
msg_headers[field.name] = field.value
|
94
|
+
end
|
95
|
+
|
96
|
+
msg_headers.each do |k, v|
|
97
|
+
if Railgun::Mailer::IGNORED_HEADERS.include? k.downcase
|
98
|
+
Rails.logger.debug("[railgun] ignoring header (using envelope instead): #{k}")
|
99
|
+
next
|
100
|
+
end
|
101
|
+
|
102
|
+
# Cover cases like `cc`, `bcc` where parameters are valid
|
103
|
+
# headers BUT they are submitted as separate POST params
|
104
|
+
# and already exist on the message because of the call to
|
105
|
+
# `build_message_object`.
|
106
|
+
if message.include? k.downcase
|
107
|
+
Rails.logger.debug("[railgun] ignoring header (already set): #{k}")
|
108
|
+
next
|
109
|
+
end
|
110
|
+
|
79
111
|
message["h:#{k}"] = v
|
80
112
|
end
|
81
113
|
|
@@ -84,7 +116,12 @@ module Railgun
|
|
84
116
|
|
85
117
|
# reject blank values
|
86
118
|
message.delete_if do |k, v|
|
87
|
-
|
119
|
+
return true if v.nil?
|
120
|
+
|
121
|
+
# if it's an array remove empty elements
|
122
|
+
v.delete_if { |i| i.respond_to?(:empty?) && i.empty? } if v.is_a?(Array)
|
123
|
+
|
124
|
+
v.respond_to?(:empty?) && v.empty?
|
88
125
|
end
|
89
126
|
|
90
127
|
return message
|
data/mailgun.gemspec
CHANGED
@@ -22,16 +22,16 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
|
-
spec.required_ruby_version = '>= 2.
|
26
|
-
|
27
|
-
spec.add_development_dependency 'bundler', '~> 1.
|
28
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
29
|
-
spec.add_development_dependency 'rake', '~>
|
30
|
-
spec.add_development_dependency 'webmock', '~>
|
31
|
-
spec.add_development_dependency 'pry', '~> 0.
|
32
|
-
spec.add_development_dependency 'vcr', '~> 3.0'
|
33
|
-
spec.add_development_dependency 'simplecov', '~> 0.
|
34
|
-
spec.add_development_dependency
|
35
|
-
spec.add_dependency 'rest-client', '~> 2.0'
|
25
|
+
spec.required_ruby_version = '>= 2.2.2'
|
26
|
+
|
27
|
+
spec.add_development_dependency 'bundler', '~> 1.16.2'
|
28
|
+
spec.add_development_dependency 'rspec', '~> 3.8.0'
|
29
|
+
spec.add_development_dependency 'rake', '~> 12.3.1'
|
30
|
+
spec.add_development_dependency 'webmock', '~> 3.4.2'
|
31
|
+
spec.add_development_dependency 'pry', '~> 0.11.3'
|
32
|
+
spec.add_development_dependency 'vcr', '~> 3.0.3'
|
33
|
+
spec.add_development_dependency 'simplecov', '~> 0.16.1'
|
34
|
+
spec.add_development_dependency 'rails'
|
35
|
+
spec.add_dependency 'rest-client', '~> 2.0.2'
|
36
36
|
|
37
37
|
end
|
@@ -28,7 +28,11 @@ describe 'For the email validation endpoint', order: :defined, vcr: vcr_opts do
|
|
28
28
|
expected = {
|
29
29
|
"address" => "alice@mailgun.net",
|
30
30
|
"did_you_mean" => nil,
|
31
|
+
"is_disposable_address" => false,
|
32
|
+
"is_role_address" => false,
|
31
33
|
"is_valid" => true,
|
34
|
+
"mailbox_verification" => "true",
|
35
|
+
"reason" => nil,
|
32
36
|
"parts" => {
|
33
37
|
"display_name" => nil,
|
34
38
|
"domain" => "mailgun.net",
|
@@ -50,7 +54,11 @@ describe 'For the email validation endpoint', order: :defined, vcr: vcr_opts do
|
|
50
54
|
expected = {
|
51
55
|
"address" => "example.org",
|
52
56
|
"did_you_mean" => nil,
|
57
|
+
"is_disposable_address" => false,
|
58
|
+
"is_role_address" => false,
|
53
59
|
"is_valid" => false,
|
60
|
+
"mailbox_verification" => "unknown",
|
61
|
+
"reason" => "Validation failed for 'example.org', reason: 'malformed address; missing @ sign'",
|
54
62
|
"parts" => {
|
55
63
|
"display_name" => nil,
|
56
64
|
"domain" => nil,
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'rubygems'
|
2
|
+
require 'base64'
|
2
3
|
require 'bundler'
|
3
4
|
require 'bundler/setup'
|
4
5
|
Bundler.setup(:development)
|
@@ -37,9 +38,10 @@ TESTDOMAIN = envs['MAILGUN_TESTDOMAIN']
|
|
37
38
|
VCR.configure do |c|
|
38
39
|
c.cassette_library_dir = 'vcr_cassettes'
|
39
40
|
c.hook_into :webmock
|
40
|
-
c.configure_rspec_metadata!
|
41
41
|
c.default_cassette_options = { record: :new_episodes }
|
42
42
|
c.filter_sensitive_data('<APIKEY>') { APIKEY }
|
43
43
|
c.filter_sensitive_data('DOMAIN.TEST') { TESTDOMAIN }
|
44
44
|
c.filter_sensitive_data('<PUBKEY>') { PUB_APIKEY }
|
45
|
+
|
46
|
+
c.configure_rspec_metadata!
|
45
47
|
end
|
File without changes
|
@@ -0,0 +1,166 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'logger'
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'mailgun'
|
5
|
+
require 'railgun'
|
6
|
+
|
7
|
+
ActionMailer::Base.raise_delivery_errors = true
|
8
|
+
ActionMailer::Base.delivery_method = :test
|
9
|
+
Rails.logger = Logger.new('/dev/null')
|
10
|
+
Rails.logger.level = Logger::DEBUG
|
11
|
+
|
12
|
+
class UnitTestMailer < ActionMailer::Base
|
13
|
+
default from: 'unittest@example.org'
|
14
|
+
|
15
|
+
def plain_message(address, subject, headers)
|
16
|
+
headers(headers)
|
17
|
+
mail(to: address, subject: subject) do |format|
|
18
|
+
format.text { render plain: "Test!" }
|
19
|
+
format.html { render html: "<p>Test!</p>".html_safe }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def message_with_attachment(address, subject)
|
24
|
+
attachments['info.txt'] = {
|
25
|
+
:content => File.read('docs/railgun/Overview.md'),
|
26
|
+
:mime_type => 'text/plain',
|
27
|
+
}
|
28
|
+
mail(to: address, subject: subject) do |format|
|
29
|
+
format.text { render plain: "Test!" }
|
30
|
+
format.html { render html: "<p>Test!</p>".html_safe }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
describe 'Railgun::Mailer' do
|
37
|
+
|
38
|
+
it 'has a mailgun_client property which returns a Mailgun::Client' do
|
39
|
+
config = {
|
40
|
+
api_key: {},
|
41
|
+
domain: {}
|
42
|
+
}
|
43
|
+
@mailer_obj = Railgun::Mailer.new(config)
|
44
|
+
|
45
|
+
expect(@mailer_obj.mailgun_client).to be_a(Mailgun::Client)
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'properly creates a message body' do
|
49
|
+
message = UnitTestMailer.plain_message('test@example.org', 'Test!', {})
|
50
|
+
body = Railgun.transform_for_mailgun(message)
|
51
|
+
|
52
|
+
[:from, :subject, :text, :html, 'to'].each do |param|
|
53
|
+
expect(body).to include(param)
|
54
|
+
end
|
55
|
+
|
56
|
+
expect(body[:from][0].value).to eq('unittest@example.org')
|
57
|
+
expect(body['to']).to eq(['test@example.org'])
|
58
|
+
expect(body[:subject]).to eq(['Test!'])
|
59
|
+
expect(body[:text]).to eq(['Test!'])
|
60
|
+
expect(body[:html]).to eq(['<p>Test!</p>'.html_safe])
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'adds options to message body' do
|
64
|
+
message = UnitTestMailer.plain_message('test@example.org', '', {})
|
65
|
+
message.mailgun_options ||= {
|
66
|
+
'tracking-opens' => 'true',
|
67
|
+
}
|
68
|
+
|
69
|
+
body = Railgun.transform_for_mailgun(message)
|
70
|
+
|
71
|
+
expect(body).to include('o:tracking-opens')
|
72
|
+
expect(body['o:tracking-opens']).to eq('true')
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'adds variables to message body' do
|
76
|
+
message = UnitTestMailer.plain_message('test@example.org', '', {})
|
77
|
+
message.mailgun_variables ||= {
|
78
|
+
'user' => {:id => '1', :name => 'tstark'},
|
79
|
+
}
|
80
|
+
|
81
|
+
body = Railgun.transform_for_mailgun(message)
|
82
|
+
|
83
|
+
expect(body).to include('v:user')
|
84
|
+
|
85
|
+
var_body = JSON.load(body['v:user'])
|
86
|
+
expect(var_body).to include('id')
|
87
|
+
expect(var_body).to include('name')
|
88
|
+
expect(var_body['id']).to eq('1')
|
89
|
+
expect(var_body['name']).to eq('tstark')
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'adds headers to message body' do
|
93
|
+
message = UnitTestMailer.plain_message('test@example.org', '', {})
|
94
|
+
message.mailgun_headers ||= {
|
95
|
+
'X-Unit-Test' => 'true',
|
96
|
+
}
|
97
|
+
|
98
|
+
body = Railgun.transform_for_mailgun(message)
|
99
|
+
|
100
|
+
expect(body).to include('h:X-Unit-Test')
|
101
|
+
expect(body['h:X-Unit-Test']).to eq('true')
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'adds headers to message body from mailer' do
|
105
|
+
message = UnitTestMailer.plain_message('test@example.org', '', {
|
106
|
+
'X-Unit-Test-2' => 'true',
|
107
|
+
})
|
108
|
+
|
109
|
+
body = Railgun.transform_for_mailgun(message)
|
110
|
+
|
111
|
+
expect(body).to include('h:X-Unit-Test-2')
|
112
|
+
expect(body['h:X-Unit-Test-2']).to eq('true')
|
113
|
+
end
|
114
|
+
|
115
|
+
it 'properly handles headers that are passed as separate POST params' do
|
116
|
+
message = UnitTestMailer.plain_message('test@example.org', 'Test!', {
|
117
|
+
# `From`, `To`, and `Subject` are set on the envelope, so they should be ignored as headers
|
118
|
+
'From' => 'units@example.net',
|
119
|
+
'To' => 'user@example.com',
|
120
|
+
'Subject' => 'This should disappear',
|
121
|
+
# If `Bcc` or `Cc` are set as headers, they should be carried over as POST params, not headers
|
122
|
+
'Bcc' => ['list@example.org'],
|
123
|
+
'Cc' => ['admin@example.com'],
|
124
|
+
# This is an arbitrary header and should be carried over properly
|
125
|
+
'X-Source' => 'unit tests',
|
126
|
+
})
|
127
|
+
|
128
|
+
body = Railgun.transform_for_mailgun(message)
|
129
|
+
|
130
|
+
['From', 'To', 'Subject'].each do |header|
|
131
|
+
expect(body).not_to include("h:#{header}")
|
132
|
+
end
|
133
|
+
|
134
|
+
['bcc', 'cc', 'to', 'h:X-Source'].each do |param|
|
135
|
+
expect(body).to include(param)
|
136
|
+
end
|
137
|
+
|
138
|
+
expect(body[:from][0].value).to eq('unittest@example.org')
|
139
|
+
expect(body['to']).to eq(['test@example.org'])
|
140
|
+
expect(body[:subject]).to eq(['Test!'])
|
141
|
+
expect(body[:text]).to eq(['Test!'])
|
142
|
+
expect(body[:html]).to eq(['<p>Test!</p>'.html_safe])
|
143
|
+
expect(body['bcc']).to eq(['list@example.org'])
|
144
|
+
expect(body['cc']).to eq(['admin@example.com'])
|
145
|
+
expect(body['h:X-Source']).to eq('unit tests')
|
146
|
+
end
|
147
|
+
|
148
|
+
it 'properly adds attachments' do
|
149
|
+
message = UnitTestMailer.message_with_attachment('test@example.org', '')
|
150
|
+
body = Railgun.transform_for_mailgun(message)
|
151
|
+
|
152
|
+
expect(body).to include(:attachment)
|
153
|
+
attachment = body[:attachment][0]
|
154
|
+
|
155
|
+
expect(attachment.filename).to eq('info.txt')
|
156
|
+
expect(attachment.content_type).to eq('text/plain')
|
157
|
+
end
|
158
|
+
|
159
|
+
it 'delivers!' do
|
160
|
+
message = UnitTestMailer.plain_message('test@example.org', '', {})
|
161
|
+
message.deliver_now
|
162
|
+
|
163
|
+
expect(ActionMailer::Base.deliveries).to include(message)
|
164
|
+
end
|
165
|
+
|
166
|
+
end
|
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.1.
|
4
|
+
version: 1.1.11
|
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: 2018-
|
12
|
+
date: 2018-10-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -17,98 +17,98 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: 1.16.2
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
27
|
+
version: 1.16.2
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rspec
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: 3.8.0
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
41
|
+
version: 3.8.0
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rake
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
48
|
+
version: 12.3.1
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
55
|
+
version: 12.3.1
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: webmock
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
62
|
+
version: 3.4.2
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: 3.4.2
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: pry
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: 0.11.3
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
83
|
+
version: 0.11.3
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: vcr
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
88
|
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
90
|
+
version: 3.0.3
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version:
|
97
|
+
version: 3.0.3
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: simplecov
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
102
|
- - "~>"
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version:
|
104
|
+
version: 0.16.1
|
105
105
|
type: :development
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
109
|
- - "~>"
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version:
|
111
|
+
version: 0.16.1
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: rails
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,14 +129,14 @@ dependencies:
|
|
129
129
|
requirements:
|
130
130
|
- - "~>"
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version:
|
132
|
+
version: 2.0.2
|
133
133
|
type: :runtime
|
134
134
|
prerelease: false
|
135
135
|
version_requirements: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
137
|
- - "~>"
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version:
|
139
|
+
version: 2.0.2
|
140
140
|
description: Mailgun's Official Ruby SDK for interacting with the Mailgun API.
|
141
141
|
email: support@mailgunhq.com
|
142
142
|
executables: []
|
@@ -160,6 +160,8 @@ files:
|
|
160
160
|
- docs/Snippets.md
|
161
161
|
- docs/Suppressions.md
|
162
162
|
- docs/Webhooks.md
|
163
|
+
- docs/railgun/Overview.md
|
164
|
+
- docs/railgun/Parameters.md
|
163
165
|
- lib/mailgun-ruby.rb
|
164
166
|
- lib/mailgun.rb
|
165
167
|
- lib/mailgun/address.rb
|
@@ -207,7 +209,8 @@ files:
|
|
207
209
|
- spec/unit/messages/sample_data/mailgun_icon.png
|
208
210
|
- spec/unit/messages/sample_data/mime.txt
|
209
211
|
- spec/unit/messages/sample_data/rackspace_logo.jpg
|
210
|
-
- spec/unit/
|
212
|
+
- spec/unit/railgun/content_type_spec.rb
|
213
|
+
- spec/unit/railgun/mailer_spec.rb
|
211
214
|
- vcr_cassettes/bounces.yml
|
212
215
|
- vcr_cassettes/complaints.yml
|
213
216
|
- vcr_cassettes/domains.todo.yml
|
@@ -236,7 +239,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
236
239
|
requirements:
|
237
240
|
- - ">="
|
238
241
|
- !ruby/object:Gem::Version
|
239
|
-
version: 2.
|
242
|
+
version: 2.2.2
|
240
243
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
241
244
|
requirements:
|
242
245
|
- - ">="
|
@@ -274,4 +277,5 @@ test_files:
|
|
274
277
|
- spec/unit/messages/sample_data/mailgun_icon.png
|
275
278
|
- spec/unit/messages/sample_data/mime.txt
|
276
279
|
- spec/unit/messages/sample_data/rackspace_logo.jpg
|
277
|
-
- spec/unit/
|
280
|
+
- spec/unit/railgun/content_type_spec.rb
|
281
|
+
- spec/unit/railgun/mailer_spec.rb
|