mailgun-ruby 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 64d4a0d5c1b85d58db90763fc5dbcd0f813f29bf30b328fdda6b7a019fbeb445
4
- data.tar.gz: 2ddef97a1b88cd9d45c5e2d1b41df3b61e7b3a09a5dcbe4c3b0a62191335aeed
3
+ metadata.gz: eeb68d33e0686c3074e829fa7c33c1a9300c31bd9db3b7fde74abfdbdd681a31
4
+ data.tar.gz: dc0cd7912abb804476731ba487186a362595f7806d88f50bbbe2296da8eb0b5b
5
5
  SHA512:
6
- metadata.gz: 18df9ff784b8c39376420fcebe0b16a195318e63b70e6b6f5fb6139fd4cbd276ef1647844de6fd12c1e272906862ddfcdc85bb59ab29460dee6e0e02ec872ee8
7
- data.tar.gz: 25547234506d03d471ea3f3bbfb46eb6c10e104147f6fc7cbe3b3228b966d31b5a3e53f423554c22f45360c119c5c015659b819559ef8d664c7c5ac47be09d00
6
+ metadata.gz: 9469121fbdd8341af7cc6ee395d35d8f487f556b67d8b6a0d2b6cd874f4bb1828384f9aff7c6751377fa56182b7c890947e40444f09d583d97aca8f90c41c642
7
+ data.tar.gz: 2f2b70e53e187c28ea3fcf3d3abc3f208886baca01732af0bb233c154bd171565790279620fe392259f3fa74151276d4e281389606d35ce60047b6f9a922a7cf
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.2.4'
22
+ gem 'mailgun-ruby', '~>1.2.5'
23
23
  ```
24
24
 
25
25
  Usage
@@ -15,7 +15,8 @@ module Mailgun
15
15
  api_version = 'v3',
16
16
  ssl = true,
17
17
  test_mode = false,
18
- timeout = nil)
18
+ timeout = nil,
19
+ proxy_url = nil)
19
20
 
20
21
  rest_client_params = {
21
22
  user: 'api',
@@ -25,6 +26,7 @@ module Mailgun
25
26
  rest_client_params[:timeout] = timeout if timeout
26
27
 
27
28
  endpoint = endpoint_generator(api_host, api_version, ssl)
29
+ RestClient.proxy = proxy_url
28
30
  @http_client = RestClient::Resource.new(endpoint, rest_client_params)
29
31
  @test_mode = test_mode
30
32
  end
@@ -64,13 +66,13 @@ module Mailgun
64
66
  # containing required parameters for the requested resource.
65
67
  # @return [Mailgun::Response] A Mailgun::Response object.
66
68
  def send_message(working_domain, data)
67
- fail ParameterError.new('Missing working domain', working_domain) unless working_domain
69
+ perform_data_validation(working_domain, data)
68
70
 
69
71
  if test_mode? then
70
72
  Mailgun::Client.deliveries << data
71
73
  return Response.from_hash(
72
74
  {
73
- :body => '{"id": "test-mode-mail@localhost", "message": "Queued. Thank you."}',
75
+ :body => "{\"id\": \"test-mode-mail-#{SecureRandom.uuid}@localhost\", \"message\": \"Queued. Thank you.\"}",
74
76
  :code => 200,
75
77
  }
76
78
  )
@@ -202,5 +204,17 @@ module Mailgun
202
204
  CommunicationError.new(e.message)
203
205
  end
204
206
 
207
+ def perform_data_validation(working_domain, data)
208
+ message = data.respond_to?(:message) ? data.message : data
209
+ fail ParameterError.new('Missing working domain', working_domain) unless working_domain
210
+ fail ParameterError.new(
211
+ 'Missing `to` recipient, message should containg at least 1 recipient',
212
+ working_domain
213
+ ) if message.fetch('to', []).empty? && message.fetch(:to, []).empty?
214
+ fail ParameterError.new(
215
+ 'Missing a `from` sender, message should containg at least 1 `from` sender',
216
+ working_domain
217
+ ) if message.fetch('from', []).empty? && message.fetch(:from, []).empty?
218
+ end
205
219
  end
206
220
  end
@@ -34,6 +34,7 @@ module Mailgun
34
34
 
35
35
  # Public: fallback if there is no response code on the object
36
36
  NOCODE = 000
37
+ FORBIDDEN = 'Forbidden'
37
38
 
38
39
  # Public: initialization of new error given a message and/or object
39
40
  #
@@ -51,6 +52,7 @@ module Mailgun
51
52
  rescue NoMethodError
52
53
  api_message = "Unknown API error"
53
54
  end
55
+ api_message = api_message + ' - Invalid Domain or API key' if api_message == FORBIDDEN
54
56
 
55
57
  message = message || ''
56
58
  message = message + ': ' + api_message
@@ -198,7 +198,9 @@ module Mailgun
198
198
  # @param [Boolean] tracking Boolean true or false.
199
199
  # @return [void]
200
200
  def track_opens(mode)
201
- set_single('o:tracking-opens', bool_lookup(mode))
201
+ value = bool_lookup(mode)
202
+ set_single('o:tracking-opens', value)
203
+ set_multi_simple('o:tracking', value)
202
204
  end
203
205
 
204
206
  # Deprecated: 'set_open_tracking' is deprecated. Please use 'track_opens' instead.
@@ -212,7 +214,9 @@ module Mailgun
212
214
  # @param [String] mode True, False, or HTML (for HTML only tracking)
213
215
  # @return [void]
214
216
  def track_clicks(mode)
215
- set_single('o:tracking-clicks', bool_lookup(mode))
217
+ value = bool_lookup(mode)
218
+ set_single('o:tracking-clicks', value)
219
+ set_multi_simple('o:tracking', value)
216
220
  end
217
221
 
218
222
  # Depreciated: 'set_click_tracking. is deprecated. Please use 'track_clicks' instead.
@@ -308,6 +312,38 @@ module Mailgun
308
312
  message_id data
309
313
  end
310
314
 
315
+ # Set name of a template stored via template API. See Templates for more information
316
+ # https://documentation.mailgun.com/en/latest/api-templates.html
317
+ #
318
+ # @param [String] tag A defined template name to use. Passing nil or
319
+ # empty string will delete template key and value from @message hash.
320
+ # @return [void]
321
+ def template(template_name = nil)
322
+ key = 'template'
323
+ return @message.delete(key) if template_name.to_s.empty?
324
+ set_single(key, template_name)
325
+ end
326
+
327
+ # Set specific template version.
328
+ #
329
+ # @param [String] tag A defined template name to use. Passing nil or
330
+ # empty string will delete template key and value from @message hash.
331
+ # @return [void]
332
+ def template_version(version = nil)
333
+ key = 't:version'
334
+ return @message.delete(key) if version.to_s.empty?
335
+ set_single(key, version)
336
+ end
337
+
338
+ # Turn off or on template rendering in the text part
339
+ # of the message in case of template sending.
340
+ #
341
+ # @param [Boolean] tracking Boolean true or false.
342
+ # @return [void]
343
+ def template_text(mode)
344
+ set_single('t:text', bool_lookup(mode))
345
+ end
346
+
311
347
  private
312
348
 
313
349
  # Sets a single value in the message hash where "multidict" features are not needed.
@@ -347,6 +383,7 @@ module Mailgun
347
383
  def bool_lookup(value)
348
384
  return 'yes' if %w(true yes yep).include? value.to_s.downcase
349
385
  return 'no' if %w(false no nope).include? value.to_s.downcase
386
+ warn 'WARN: for bool type actions next values are prefered: true yes yep | false no nope | htmlonly'
350
387
  value
351
388
  end
352
389
 
@@ -1,4 +1,4 @@
1
1
  # It's the version. Yeay!
2
2
  module Mailgun
3
- VERSION = '1.2.4'
3
+ VERSION = '1.2.5'
4
4
  end
@@ -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 mime-version ]
14
+ IGNORED_HEADERS = %w[ to from subject reply-to mime-version template ]
15
15
 
16
16
  # [Hash] config ->
17
17
  # Requires *at least* `api_key` and `domain` keys.
@@ -47,8 +47,11 @@ module Railgun
47
47
  end
48
48
 
49
49
  def deliver!(mail)
50
+ @mg_domain = set_mg_domain(mail)
51
+ mail[:domain] = nil if mail[:domain].present?
52
+
50
53
  mg_message = Railgun.transform_for_mailgun(mail)
51
- response = @mg_client.send_message(@domain, mg_message)
54
+ response = @mg_client.send_message(@mg_domain, mg_message)
52
55
 
53
56
  if response.code == 200 then
54
57
  mg_id = response.to_h['id']
@@ -61,6 +64,14 @@ module Railgun
61
64
  @mg_client
62
65
  end
63
66
 
67
+ private
68
+
69
+ # Set @mg_domain from mail[:domain] header if present, then remove it to prevent being sent.
70
+ def set_mg_domain(mail)
71
+ return mail[:domain].value if mail[:domain]
72
+ domain
73
+ end
74
+
64
75
  end
65
76
 
66
77
  module_function
@@ -78,16 +89,16 @@ module Railgun
78
89
  def transform_for_mailgun(mail)
79
90
  message = build_message_object(mail)
80
91
 
81
- # v:* attributes (variables)
82
- mail.mailgun_variables.try(:each) do |k, v|
83
- message["v:#{k}"] = JSON.dump(v)
84
- end
85
-
86
92
  # o:* attributes (options)
87
93
  mail.mailgun_options.try(:each) do |k, v|
88
94
  message["o:#{k}"] = v.dup
89
95
  end
90
96
 
97
+ # t:* attributes (options)
98
+ mail.mailgun_template_variables.try(:each) do |k, v|
99
+ message["t:#{k}"] = v.dup
100
+ end
101
+
91
102
  # support for using ActionMailer's `headers()` inside of the mailer
92
103
  # note: this will filter out parameters such as `from`, `to`, and so forth
93
104
  # as they are accepted as POST parameters on the message endpoint.
@@ -153,6 +164,7 @@ module Railgun
153
164
 
154
165
  mb.from mail[:from]
155
166
  mb.reply_to(mail[:reply_to].to_s) if mail[:reply_to].present?
167
+ mb.template(mail[:template].to_s) if mail[:template].present?
156
168
  mb.subject mail.subject
157
169
  mb.body_html extract_body_html(mail)
158
170
  mb.body_text extract_body_text(mail)
@@ -172,6 +184,11 @@ module Railgun
172
184
  end
173
185
  end
174
186
 
187
+ # v:* attributes (variables)
188
+ mail.mailgun_variables.try(:each) do |name, value|
189
+ mb.variable(name, value)
190
+ end
191
+
175
192
  return mb.message if mail.attachments.empty?
176
193
 
177
194
  mail.attachments.each do |attach|
@@ -233,5 +250,4 @@ module Railgun
233
250
  return mail.html_part if mail.multipart?
234
251
  (mail.mime_type =~ /^text\/html$/i) && mail
235
252
  end
236
-
237
253
  end
@@ -11,7 +11,8 @@ module Mail
11
11
  attr_accessor :mailgun_variables,
12
12
  :mailgun_options,
13
13
  :mailgun_recipient_variables,
14
- :mailgun_headers
14
+ :mailgun_headers,
15
+ :mailgun_template_variables
15
16
 
16
17
  end
17
18
  end
@@ -0,0 +1,67 @@
1
+ require 'spec_helper'
2
+ require 'json'
3
+ require 'logger'
4
+ require 'railgun'
5
+ require 'mailgun'
6
+ require 'mailgun/exceptions/exceptions'
7
+
8
+ ActionMailer::Base.raise_delivery_errors = true
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, from, subject, headers)
16
+ headers(headers)
17
+ mail(to: address, from: from, 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
+ end
23
+
24
+ vcr_opts = { :cassette_name => 'message_deliver' }
25
+
26
+ describe 'Message deliver', vcr: vcr_opts do
27
+ let(:domain) { TESTDOMAIN }
28
+ let(:config) do
29
+ {
30
+ api_key: APIKEY,
31
+ domain: domain
32
+ }
33
+ end
34
+ let(:mail) { UnitTestMailer.plain_message("bob@#{domain}", "bob@#{domain}", 'subject', {}) }
35
+
36
+ it 'successfully delivers message' do
37
+ result = Railgun::Mailer.new(config).deliver!(mail)
38
+ result.to_h!
39
+
40
+ expect(result.body['message']).to eq('Queued. Thank you.')
41
+ expect(result.body).to include('id')
42
+ expect(result.code).to eq(200)
43
+ end
44
+ end
45
+
46
+ vcr_opts = { :cassette_name => 'mailer_invalid_domain' }
47
+
48
+ describe 'Invalid domain', vcr: vcr_opts do
49
+ let(:domain) { 'not-our-doma.in' }
50
+ let(:config) do
51
+ {
52
+ api_key: APIKEY,
53
+ domain: domain
54
+ }
55
+ end
56
+ let(:mail) { UnitTestMailer.plain_message("bob@#{domain}", 'sally@not-our-doma.in' 'subject', {}) }
57
+
58
+ it 'raises expected error' do
59
+
60
+ Railgun::Mailer.new(config).deliver!(mail)
61
+ rescue Mailgun::CommunicationError => err
62
+ expect(err.message).to eq('401 Unauthorized: Forbidden - Invalid Domain or API key')
63
+ else
64
+ fail
65
+
66
+ end
67
+ end
@@ -63,6 +63,9 @@ describe 'The method send_message()', vcr: vcr_opts do
63
63
  :to => "bob@#{@domain}",
64
64
  :subject => "Test",
65
65
  :text => "Test Data" }
66
+ uuid = 'uuid'
67
+
68
+ allow(SecureRandom).to receive(:uuid).and_return(uuid)
66
69
 
67
70
  result = @mg_obj.send_message(@domain, data)
68
71
 
@@ -72,7 +75,7 @@ describe 'The method send_message()', vcr: vcr_opts do
72
75
  expect(result.body).to include("id")
73
76
 
74
77
  expect(result.code).to eq(200)
75
- expect(result.body['id']).to eq("test-mode-mail@localhost")
78
+ expect(result.body['id']).to eq("test-mode-mail-#{uuid}@localhost")
76
79
  expect(result.body['message']).to eq("Queued. Thank you.")
77
80
  end
78
81
 
@@ -23,6 +23,7 @@ module Mailgun
23
23
  end
24
24
 
25
25
  def send_message(working_domain, data)
26
+ perform_data_validation(working_domain, data)
26
27
  case data
27
28
  when Hash
28
29
  if data.has_key?(:message)
@@ -75,6 +76,21 @@ module Mailgun
75
76
 
76
77
  private
77
78
 
79
+ def perform_data_validation(working_domain, data)
80
+ fail ParameterError.new('Missing working domain', working_domain) unless working_domain
81
+ return true unless data.is_a?(Hash) && data.present?
82
+ message = data.respond_to?(:message) ? data.message : data
83
+
84
+ fail ParameterError.new(
85
+ 'Missing `to` recipient, message should containg at least 1 recipient',
86
+ working_domain
87
+ ) if message.fetch('to', []).empty? && message.fetch(:to, []).empty?
88
+ fail ParameterError.new(
89
+ 'Missing a `from` sender, message should containg at least 1 `from` sender',
90
+ working_domain
91
+ ) if message.fetch('from', []).empty? && message.fetch(:from, []).empty?
92
+ end
93
+
78
94
  def response_generator(resource_endpoint)
79
95
  if resource_endpoint == "messages"
80
96
  t = Time.now
@@ -37,8 +37,11 @@ describe 'The method send_message()' do
37
37
  end
38
38
 
39
39
  it 'opens the message MIME and sends the MIME message.' do
40
- data = {'to' => 'joe@test.com',
41
- 'message' => 'Sample Data/mime.txt'}
40
+ data = {
41
+ 'to' => 'joe@test.com',
42
+ 'message' => 'Sample Data/mime.txt',
43
+ 'from' => 'joe@test.com'
44
+ }
42
45
  result = @mg_obj.send_message("testdomain.com", data)
43
46
 
44
47
  result.to_h!
@@ -46,6 +49,25 @@ describe 'The method send_message()' do
46
49
  expect(result.body).to include("message")
47
50
  expect(result.body).to include("id")
48
51
  end
52
+
53
+ context 'when domain is missing' do
54
+ it 'shows failure message' do
55
+ expect(@mg_obj).to receive(:fail)
56
+ @mg_obj.send_message(nil, {})
57
+ end
58
+ end
59
+
60
+ context 'when to is missing' do
61
+ it 'shows failure message' do
62
+ data = {
63
+ 'to' => '',
64
+ 'message' => 'Sample Data/mime.txt',
65
+ 'from' => 'joe@test.com'
66
+ }
67
+ expect(@mg_obj).to receive(:fail)
68
+ @mg_obj.send_message("testdomain.com", data)
69
+ end
70
+ end
49
71
  end
50
72
 
51
73
  describe 'The method post()' do
@@ -72,61 +72,76 @@ describe 'The method add_recipient' do
72
72
  @address_3 = 'sam@example.com'
73
73
  @variables_3 = {'first' => 'Sam', 'last' => 'Doe', 'tracking' => 'GHI123'}
74
74
  end
75
-
76
- it 'adds 1,000 recipients to the message body and validates counter is incremented then reset' do
77
- recipient_type = :to
78
- 1000.times do
79
- @mb_obj.add_recipient(recipient_type, @address_1, @variables_1)
75
+ context 'when from is present' do
76
+ before(:each) do
77
+ @mb_obj.from('example@email.com')
80
78
  end
81
79
 
82
- expect(@mb_obj.counters[:recipients][recipient_type]).to eq(1000)
83
-
84
- @mb_obj.add_recipient(recipient_type, @address_1, @variables_1)
85
-
86
- expect(@mb_obj.counters[:recipients][recipient_type]).to eq(1)
87
- end
80
+ it 'adds 1,000 recipients to the message body and validates counter is incremented then reset' do
81
+ recipient_type = :to
82
+ 1000.times do
83
+ @mb_obj.add_recipient(recipient_type, @address_1, @variables_1)
84
+ end
88
85
 
89
- it 'adds recipients to the message, calls finalize, and cleans up' do
90
- recipient_type = :to
91
- 1000.times do
86
+ expect(@mb_obj.counters[:recipients][recipient_type]).to eq(1000)
87
+
92
88
  @mb_obj.add_recipient(recipient_type, @address_1, @variables_1)
89
+
90
+ expect(@mb_obj.counters[:recipients][recipient_type]).to eq(1)
93
91
  end
94
92
 
95
- expect(@mb_obj.counters[:recipients][recipient_type]).to eq(1000)
96
- @mb_obj.finalize
93
+ it 'adds recipients to the message, calls finalize, and cleans up' do
94
+ recipient_type = :to
95
+ 1000.times do
96
+ @mb_obj.add_recipient(recipient_type, @address_1, @variables_1)
97
+ end
97
98
 
98
- expect(@mb_obj.recipient_variables).to eq({})
99
- expect(@mb_obj.message['recipient-variables'].length).to eq(0)
100
- expect(@mb_obj.message[:to].length).to eq(0)
101
- expect(@mb_obj.counters[:recipients][recipient_type]).to eq(0)
102
- end
99
+ expect(@mb_obj.counters[:recipients][recipient_type]).to eq(1000)
100
+ @mb_obj.finalize
103
101
 
104
- it 'adds 5,005 recipients to the message body and validates we receive message_ids back' do
105
- recipient_type = :to
106
- 5005.times do
107
- @mb_obj.add_recipient(recipient_type, @address_1, @variables_1)
102
+ expect(@mb_obj.recipient_variables).to eq({})
103
+ expect(@mb_obj.message['recipient-variables'].length).to eq(0)
104
+ expect(@mb_obj.message[:to].length).to eq(0)
105
+ expect(@mb_obj.counters[:recipients][recipient_type]).to eq(0)
108
106
  end
109
- @mb_obj.finalize
110
107
 
111
- expect(@mb_obj.message_ids.length).to eq(6)
112
- end
108
+ it 'adds 5,005 recipients to the message body and validates we receive message_ids back' do
109
+ recipient_type = :to
110
+ 5005.times do
111
+ @mb_obj.add_recipient(recipient_type, @address_1, @variables_1)
112
+ end
113
+ @mb_obj.finalize
113
114
 
114
- it 'sets recipient-variables, for batch expansion' do
115
- recipient_type = :to
116
- @mb_obj.add_recipient(recipient_type, @address_1, @variables_1)
115
+ expect(@mb_obj.message_ids.length).to eq(6)
116
+ end
117
117
 
118
- expect(@mb_obj.recipient_variables[@address_1]).to eq(@variables_1)
118
+ it 'sets recipient-variables, for batch expansion' do
119
+ recipient_type = :to
120
+ @mb_obj.add_recipient(recipient_type, @address_1, @variables_1)
121
+
122
+ expect(@mb_obj.recipient_variables[@address_1]).to eq(@variables_1)
123
+ end
124
+
125
+ it 'sets multiple recipient-variables, for batch expansion' do
126
+ recipient_type = :to
127
+ @mb_obj.add_recipient(recipient_type, @address_1, @variables_1)
128
+ @mb_obj.add_recipient(recipient_type, @address_2, @variables_2)
129
+ @mb_obj.add_recipient(recipient_type, @address_3, @variables_3)
130
+
131
+ expect(@mb_obj.recipient_variables[@address_1]).to eq(@variables_1)
132
+ expect(@mb_obj.recipient_variables[@address_2]).to eq(@variables_2)
133
+ expect(@mb_obj.recipient_variables[@address_3]).to eq(@variables_3)
134
+ end
119
135
  end
120
136
 
121
- it 'sets multiple recipient-variables, for batch expansion' do
122
- recipient_type = :to
123
- @mb_obj.add_recipient(recipient_type, @address_1, @variables_1)
124
- @mb_obj.add_recipient(recipient_type, @address_2, @variables_2)
125
- @mb_obj.add_recipient(recipient_type, @address_3, @variables_3)
126
-
127
- expect(@mb_obj.recipient_variables[@address_1]).to eq(@variables_1)
128
- expect(@mb_obj.recipient_variables[@address_2]).to eq(@variables_2)
129
- expect(@mb_obj.recipient_variables[@address_3]).to eq(@variables_3)
137
+ context 'when from is empty' do
138
+ it 'shows error message' do
139
+ recipient_type = :to
140
+ @mb_obj.add_recipient(recipient_type, @address_1, @variables_1)
141
+ @mb_obj.add_recipient(recipient_type, @address_2, @variables_2)
142
+ expect(@mb_client).to receive(:fail)
143
+ @mb_obj.finalize
144
+ end
130
145
  end
131
146
 
132
147
  end
@@ -313,7 +313,7 @@ describe 'The method set_test_mode' do
313
313
  it 'warns of set_test_mode deprecation' do
314
314
  @mb_obj = Mailgun::MessageBuilder.new
315
315
  expect(@mb_obj).to receive :warn
316
- @mb_obj.set_test_mode 'warn on set_test_mode'
316
+ @mb_obj.set_test_mode 'Yes'
317
317
  end
318
318
  end
319
319
 
@@ -355,7 +355,7 @@ describe 'The method set_dkim' do
355
355
  it 'warns of set_dkim deprecation' do
356
356
  @mb_obj = Mailgun::MessageBuilder.new
357
357
  expect(@mb_obj).to receive :warn
358
- @mb_obj.set_dkim 'warn on set_dkim'
358
+ @mb_obj.set_dkim 'Yes'
359
359
  end
360
360
  end
361
361
 
@@ -449,7 +449,7 @@ describe 'The method set_open_tracking' do
449
449
  it 'warns of set_open_tracking deprecation' do
450
450
  @mb_obj = Mailgun::MessageBuilder.new
451
451
  expect(@mb_obj).to receive :warn
452
- @mb_obj.set_open_tracking 'warn on set_open_tracking'
452
+ @mb_obj.set_open_tracking 'Yes'
453
453
  end
454
454
  end
455
455
 
@@ -461,6 +461,7 @@ describe 'The method track_opens' do
461
461
  @mb_obj.track_opens('Yes')
462
462
 
463
463
  expect(@mb_obj.message["o:tracking-opens"]).to eq("yes")
464
+ expect(@mb_obj.message["o:tracking"]).to eq(["yes"])
464
465
 
465
466
  @mb_obj.track_opens('No')
466
467
 
@@ -480,7 +481,7 @@ describe 'The method set_click_tracking' do
480
481
  it 'warns of set_click_tracking deprecation' do
481
482
  @mb_obj = Mailgun::MessageBuilder.new
482
483
  expect(@mb_obj).to receive :warn
483
- @mb_obj.set_click_tracking 'warn on set_click_tracking'
484
+ @mb_obj.set_click_tracking 'Yes'
484
485
  end
485
486
  end
486
487
 
@@ -492,6 +493,7 @@ describe 'The method track_clicks' do
492
493
  @mb_obj.track_clicks('Yes')
493
494
 
494
495
  expect(@mb_obj.message["o:tracking-clicks"]).to eq("yes")
496
+ expect(@mb_obj.message["o:tracking"]).to eq(["yes"])
495
497
 
496
498
  @mb_obj.track_clicks('No')
497
499
 
@@ -509,6 +511,13 @@ describe 'The method track_clicks' do
509
511
 
510
512
  expect(@mb_obj.message["o:tracking-clicks"]).to eq("html")
511
513
  end
514
+
515
+ context 'when unexpected value is provided' do
516
+ it 'warns about prefered values' do
517
+ expect(@mb_obj).to receive :warn
518
+ @mb_obj.track_clicks('random')
519
+ end
520
+ end
512
521
  end
513
522
 
514
523
  describe 'The method set_delivery_time' do
@@ -621,3 +630,103 @@ describe 'The method message_id' do
621
630
  expect(@mb_obj.message.has_key?('h:Message-Id')).to eq(false)
622
631
  end
623
632
  end
633
+
634
+ describe 'The method template' do
635
+ before(:each) do
636
+ @mb_obj = Mailgun::MessageBuilder.new
637
+ end
638
+ context 'when template name is passed' do
639
+ it 'sets `template` to the message' do
640
+ template_name = 'template.name'
641
+ @mb_obj.template(template_name)
642
+
643
+ expect(@mb_obj.message['template']).to eq(template_name)
644
+ end
645
+ end
646
+
647
+ context 'when multiple values are passed' do
648
+ it 'sets the last value as message template' do
649
+ template_name_1 = 'template.name_1'
650
+ template_name_2 = 'template.name_2'
651
+
652
+ @mb_obj.template(template_name_1)
653
+ @mb_obj.template(template_name_2)
654
+
655
+ expect(@mb_obj.message['template']).to eq(template_name_2)
656
+ end
657
+ end
658
+
659
+ context 'when template name is not passed' do
660
+ it 'it deletes `template` key from the message' do
661
+ @mb_obj.template('template.name')
662
+
663
+ expect(@mb_obj.message.has_key?('template')).to eq(true)
664
+
665
+ @mb_obj.template
666
+
667
+ expect(@mb_obj.message.has_key?('template')).to eq(false)
668
+ end
669
+ end
670
+ end
671
+
672
+ describe 'The method template_version' do
673
+ before(:each) do
674
+ @mb_obj = Mailgun::MessageBuilder.new
675
+ end
676
+ context 'when template version is passed' do
677
+ it 'adds `t:version` key value to the message' do
678
+ version = 'version_1'
679
+ @mb_obj.template_version(version)
680
+
681
+ expect(@mb_obj.message['t:version']).to eq(version)
682
+ end
683
+ end
684
+
685
+ context 'when multiple values are passed' do
686
+ it 'adds the last value as `t:version` key value to the message' do
687
+ version_1 = 'version_1'
688
+ version_2 = 'version_2'
689
+
690
+ @mb_obj.template_version(version_1)
691
+ @mb_obj.template_version(version_2)
692
+
693
+ expect(@mb_obj.message['t:version']).to eq(version_2)
694
+ end
695
+ end
696
+
697
+ context 'when version is not passed' do
698
+ it 'it deletes `t:version` key from the message' do
699
+ @mb_obj.template_version('version')
700
+
701
+ expect(@mb_obj.message.has_key?('t:version')).to eq(true)
702
+
703
+ @mb_obj.template_version
704
+
705
+ expect(@mb_obj.message.has_key?('t:version')).to eq(false)
706
+ end
707
+ end
708
+ end
709
+
710
+ describe 'The method template_text' do
711
+ before(:each) do
712
+ @mb_obj = Mailgun::MessageBuilder.new
713
+ end
714
+
715
+ it 'enables/disables rendering in the text part of the message in case of template sending' do
716
+ @mb_obj.template_text('Yes')
717
+
718
+ expect(@mb_obj.message["t:text"]).to eq("yes")
719
+
720
+ @mb_obj.template_text('No')
721
+
722
+ expect(@mb_obj.message["t:text"]).to eq("no")
723
+
724
+ @mb_obj.template_text(true)
725
+
726
+ expect(@mb_obj.message["t:text"]).to eq("yes")
727
+
728
+ @mb_obj.template_text(false)
729
+
730
+ expect(@mb_obj.message["t:text"]).to eq("no")
731
+ end
732
+ end
@@ -31,6 +31,18 @@ class UnitTestMailer < ActionMailer::Base
31
31
  end
32
32
  end
33
33
 
34
+ def message_with_template(address, subject, template_name)
35
+ mail(to: address, subject: subject, template: template_name) do |format|
36
+ format.text { render plain: "Test!" }
37
+ end
38
+ end
39
+
40
+ def message_with_domain(address, subject, domain)
41
+ mail(to: address, subject: subject, domain: domain) do |format|
42
+ format.text { render plain: "Test!" }
43
+ end
44
+ end
45
+
34
46
  end
35
47
 
36
48
  describe 'Railgun::Mailer' do
@@ -45,6 +57,31 @@ describe 'Railgun::Mailer' do
45
57
  expect(@mailer_obj.mailgun_client).to be_a(Mailgun::Client)
46
58
  end
47
59
 
60
+ context 'when config does not have api_key or domain' do
61
+ it 'raises configuration error' do
62
+ config = {
63
+ api_key: {}
64
+ }
65
+
66
+ expect { Railgun::Mailer.new(config) }.to raise_error(Railgun::ConfigurationError)
67
+ end
68
+ end
69
+
70
+ context 'when fake_message_send is present in config' do
71
+ it 'enables test mode' do
72
+ config = {
73
+ api_key: {},
74
+ domain: {},
75
+ fake_message_send: true
76
+ }
77
+ client_double = double(Mailgun::Client)
78
+ allow(Mailgun::Client).to receive(:new).and_return(client_double)
79
+ expect(client_double).to receive(:enable_test_mode!)
80
+
81
+ Railgun::Mailer.new(config)
82
+ end
83
+ end
84
+
48
85
  it 'properly creates a message body' do
49
86
  message = UnitTestMailer.plain_message('test@example.org', 'Test!', {})
50
87
  body = Railgun.transform_for_mailgun(message)
@@ -157,6 +194,43 @@ describe 'Railgun::Mailer' do
157
194
  expect(body['h:x-source']).to eq('unit tests')
158
195
  end
159
196
 
197
+ context 'when mailgun_variables are present' do
198
+ it 'accepts valid JSON and stores it as message[param].' do
199
+ message = UnitTestMailer.plain_message('test@example.org', '', {}).tap do |message|
200
+ message.mailgun_variables = {
201
+ 'my-data' => '{"key":"value"}'
202
+ }
203
+ end
204
+ body = Railgun.transform_for_mailgun(message)
205
+ expect(body["v:my-data"]).to be_kind_of(String)
206
+ expect(body["v:my-data"].to_s).to eq('{"key":"value"}')
207
+ end
208
+
209
+ it 'accepts a hash and appends as data to the message.' do
210
+ message = UnitTestMailer.plain_message('test@example.org', '', {}).tap do |message|
211
+ message.mailgun_variables = {
212
+ 'my-data' => {'key' => 'value'}
213
+ }
214
+ end
215
+ body = Railgun.transform_for_mailgun(message)
216
+
217
+ expect(body["v:my-data"]).to be_kind_of(String)
218
+ expect(body["v:my-data"].to_s).to eq('{"key":"value"}')
219
+ end
220
+
221
+ it 'accepts string values' do
222
+ message = UnitTestMailer.plain_message('test@example.org', '', {}).tap do |message|
223
+ message.mailgun_variables = {
224
+ 'my-data' => 'String Value.'
225
+ }
226
+ end
227
+ body = Railgun.transform_for_mailgun(message)
228
+
229
+ expect(body["v:my-data"]).to be_kind_of(String)
230
+ expect(body["v:my-data"].to_s).to eq('String Value.')
231
+ end
232
+ end
233
+
160
234
  it 'properly adds attachments' do
161
235
  message = UnitTestMailer.message_with_attachment('test@example.org', '')
162
236
  body = Railgun.transform_for_mailgun(message)
@@ -239,4 +313,76 @@ describe 'Railgun::Mailer' do
239
313
  expect(body['h:x-neat-header']).to include('bar')
240
314
  expect(body['h:x-neat-header']).to include('zoop')
241
315
  end
316
+
317
+ context 'when message with template' do
318
+ it 'adds template header to message from mailer params' do
319
+ template_name = 'template.name'
320
+ message = UnitTestMailer.message_with_template('test@example.org', '', template_name)
321
+
322
+ body = Railgun.transform_for_mailgun(message)
323
+
324
+ expect(body).to include('template')
325
+ expect(body['template']).to eq(template_name)
326
+ end
327
+
328
+ context 'when mailgun_template_variables are assigned' do
329
+ it 'adds template variables to message body' do
330
+ message = UnitTestMailer.message_with_template('test@example.org', '', 'template.name')
331
+ version = 'version_1'
332
+ message.mailgun_template_variables ||= {
333
+ 'version' => version,
334
+ 'text' => 'yes'
335
+ }
336
+
337
+ body = Railgun.transform_for_mailgun(message)
338
+
339
+ expect(body).to include('t:version')
340
+ expect(body['t:version']).to eq('version_1')
341
+ expect(body).to include('t:text')
342
+ expect(body['t:text']).to eq('yes')
343
+ end
344
+ end
345
+ end
346
+
347
+ describe 'deliver!' do
348
+ let(:config) do
349
+ {
350
+ api_key: 'api_key',
351
+ domain: 'domain'
352
+ }
353
+ end
354
+ let(:mail) { UnitTestMailer.plain_message('test@example.org', '', {}) }
355
+ let(:response) do
356
+ response = Struct.new(:code, :id)
357
+ response.new(200, rand(50..100))
358
+ end
359
+
360
+ it 'initiates client message send' do
361
+ result = { from: 'test@example.org' }
362
+ allow(Railgun).to receive(:transform_for_mailgun).and_return(result)
363
+
364
+ expect_any_instance_of(Mailgun::Client).to receive(:send_message)
365
+ .with(config[:domain], result)
366
+ .and_return(response)
367
+ Railgun::Mailer.new(config).deliver!(mail)
368
+ end
369
+
370
+ it 'returns response' do
371
+ expect_any_instance_of(Mailgun::Client).to receive(:send_message).and_return(response)
372
+ expect(Railgun::Mailer.new(config).deliver!(mail)).to eq(response)
373
+ end
374
+
375
+ context 'when domain is provided in arguments' do
376
+ let(:new_domain) { 'new_domain' }
377
+ let(:mail) { UnitTestMailer.message_with_domain('test@example.org', '', new_domain) }
378
+
379
+ it 'uses provided domain' do
380
+ result = { from: 'test@example.org' }
381
+ allow(Railgun).to receive(:transform_for_mailgun).and_return(result)
382
+ expect_any_instance_of(Mailgun::Client).to receive(:send_message)
383
+ .with(new_domain, result).and_return(response)
384
+ Railgun::Mailer.new(config).deliver!(mail)
385
+ end
386
+ end
387
+ end
242
388
  end
@@ -0,0 +1,109 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.mailgun.net/v3/not-our-doma.in/messages
6
+ body:
7
+ encoding: US-ASCII
8
+ string: from[]=sally%40not-our-doma.in&subject[]=subject&html[]=%3Cp%3ETest%21%3C%2Fp%3E&text[]=Test%21&to[]=bob%40DOMAIN.TEST&h%3Acontent-type=multipart%2Falternative%3B+boundary%3D%22--%3D%3D_mimepart_6098fb5a12edf_78633ff4e00521889696a%22%3B+charset%3DUTF-8
9
+ headers:
10
+ Accept:
11
+ - "*/*"
12
+ User-Agent:
13
+ - rest-client/2.1.0 (darwin18.7.0 x86_64) ruby/2.2.2p95
14
+ Content-Length:
15
+ - '262'
16
+ Content-Type:
17
+ - application/x-www-form-urlencoded
18
+ Accept-Encoding:
19
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
20
+ Host:
21
+ - api.mailgun.net
22
+ Authorization:
23
+ - Basic YXBpOmQ5MTViNWNkYjlhNTgzNjg1ZDhmM2ZiMWJlYzBmMjBmLTA3YmM3YjA1LWZhNDgxNmEx
24
+ response:
25
+ status:
26
+ code: 401
27
+ message: UNAUTHORIZED
28
+ headers:
29
+ Access-Control-Allow-Headers:
30
+ - Content-Type, x-requested-with, Authorization
31
+ Access-Control-Allow-Methods:
32
+ - GET, POST, PUT, DELETE, OPTIONS
33
+ Access-Control-Allow-Origin:
34
+ - "*"
35
+ Access-Control-Max-Age:
36
+ - '600'
37
+ Cache-Control:
38
+ - no-store
39
+ Content-Type:
40
+ - text/html; charset=utf-8
41
+ Date:
42
+ - Mon, 10 May 2021 09:22:34 GMT
43
+ Server:
44
+ - nginx
45
+ Www-Authenticate:
46
+ - Basic realm="MG API"
47
+ Content-Length:
48
+ - '9'
49
+ Connection:
50
+ - keep-alive
51
+ body:
52
+ encoding: UTF-8
53
+ string: Forbidden
54
+ http_version:
55
+ recorded_at: Mon, 10 May 2021 09:22:34 GMT
56
+ - request:
57
+ method: post
58
+ uri: https://api.mailgun.net/v3/not-our-doma.in/messages
59
+ body:
60
+ encoding: US-ASCII
61
+ string: from[]=sally%40not-our-doma.in&subject[]=subject&html[]=%3Cp%3ETest%21%3C%2Fp%3E&text[]=Test%21&to[]=bob%40DOMAIN.TEST&h%3Acontent-type=multipart%2Falternative%3B+boundary%3D%22--%3D%3D_mimepart_6098fb5a12edf_78633ff4e00521889696a%22%3B+charset%3DUTF-8
62
+ headers:
63
+ Accept:
64
+ - "*/*"
65
+ User-Agent:
66
+ - rest-client/2.1.0 (darwin18.7.0 x86_64) ruby/2.2.2p95
67
+ Content-Length:
68
+ - '262'
69
+ Content-Type:
70
+ - application/x-www-form-urlencoded
71
+ Accept-Encoding:
72
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
73
+ Host:
74
+ - api.mailgun.net
75
+ Authorization:
76
+ - Basic YXBpOmQ5MTViNWNkYjlhNTgzNjg1ZDhmM2ZiMWJlYzBmMjBmLTA3YmM3YjA1LWZhNDgxNmEx
77
+ response:
78
+ status:
79
+ code: 401
80
+ message: UNAUTHORIZED
81
+ headers:
82
+ Access-Control-Allow-Headers:
83
+ - Content-Type, x-requested-with, Authorization
84
+ Access-Control-Allow-Methods:
85
+ - GET, POST, PUT, DELETE, OPTIONS
86
+ Access-Control-Allow-Origin:
87
+ - "*"
88
+ Access-Control-Max-Age:
89
+ - '600'
90
+ Cache-Control:
91
+ - no-store
92
+ Content-Type:
93
+ - text/html; charset=utf-8
94
+ Date:
95
+ - Mon, 10 May 2021 09:22:40 GMT
96
+ Server:
97
+ - nginx
98
+ Www-Authenticate:
99
+ - Basic realm="MG API"
100
+ Content-Length:
101
+ - '9'
102
+ Connection:
103
+ - keep-alive
104
+ body:
105
+ encoding: UTF-8
106
+ string: Forbidden
107
+ http_version:
108
+ recorded_at: Mon, 10 May 2021 09:22:40 GMT
109
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,149 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.mailgun.net/v3/DOMAIN.TEST/messages
6
+ body:
7
+ encoding: US-ASCII
8
+ string: from[]=bob%40DOMAIN.TEST&subject[]=subject&html[]=%3Cp%3ETest%21%3C%2Fp%3E&text[]=Test%21&to[]=bob%40DOMAIN.TEST&h%3Acontent-type=multipart%2Falternative%3B+boundary%3D%22--%3D%3D_mimepart_6098f913d64ca_62833fd4d74521802775%22%3B+charset%3DUTF-8
9
+ headers:
10
+ Accept:
11
+ - "*/*"
12
+ User-Agent:
13
+ - rest-client/2.1.0 (darwin18.7.0 x86_64) ruby/2.2.2p95
14
+ Content-Length:
15
+ - '261'
16
+ Content-Type:
17
+ - application/x-www-form-urlencoded
18
+ Accept-Encoding:
19
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
20
+ Host:
21
+ - api.mailgun.net
22
+ Authorization:
23
+ - Basic YXBpOmQ5MTViNWNkYjlhNTgzNjg1ZDhmM2ZiMWJlYzBmMjBmLTA3YmM3YjA1LWZhNDgxNmEx
24
+ response:
25
+ status:
26
+ code: 200
27
+ message: OK
28
+ headers:
29
+ Access-Control-Allow-Credentials:
30
+ - 'true'
31
+ Access-Control-Allow-Headers:
32
+ - Content-Type, x-requested-with, Authorization
33
+ Access-Control-Allow-Methods:
34
+ - GET, POST, PUT, DELETE, OPTIONS
35
+ Access-Control-Allow-Origin:
36
+ - "*"
37
+ Access-Control-Max-Age:
38
+ - '600'
39
+ Cache-Control:
40
+ - no-store
41
+ Content-Disposition:
42
+ - inline
43
+ Content-Type:
44
+ - application/json
45
+ Date:
46
+ - Mon, 10 May 2021 09:12:52 GMT
47
+ Server:
48
+ - nginx
49
+ Strict-Transport-Security:
50
+ - max-age=63072000; includeSubDomains
51
+ X-Ratelimit-Limit:
52
+ - '2000000'
53
+ X-Ratelimit-Remaining:
54
+ - '1999999'
55
+ X-Ratelimit-Reset:
56
+ - '1620637982656'
57
+ X-Recipient-Limit:
58
+ - '1000000'
59
+ X-Recipient-Remaining:
60
+ - '999999'
61
+ X-Recipient-Reset:
62
+ - '1620637982657'
63
+ Content-Length:
64
+ - '136'
65
+ Connection:
66
+ - keep-alive
67
+ body:
68
+ encoding: UTF-8
69
+ string: |-
70
+ {
71
+ "id": "<20210510091252.1.D6347B73DA43962E@DOMAIN.TEST>",
72
+ "message": "Queued. Thank you."
73
+ }
74
+ http_version:
75
+ recorded_at: Mon, 10 May 2021 09:12:52 GMT
76
+ - request:
77
+ method: post
78
+ uri: https://api.mailgun.net/v3/DOMAIN.TEST/messages
79
+ body:
80
+ encoding: US-ASCII
81
+ string: from[]=bob%40DOMAIN.TEST&subject[]=subject&html[]=%3Cp%3ETest%21%3C%2Fp%3E&text[]=Test%21&to[]=bob%40DOMAIN.TEST&h%3Amessage-id=%3C20210510091252.1.D6347B73DA43962E%40DOMAIN.TEST%3E&h%3Acontent-type=multipart%2Falternative%3B+boundary%3D%22--%3D%3D_mimepart_6098f913d64ca_62833fd4d74521802775%22%3B+charset%3DUTF-8
82
+ headers:
83
+ Accept:
84
+ - "*/*"
85
+ User-Agent:
86
+ - rest-client/2.1.0 (darwin18.7.0 x86_64) ruby/2.2.2p95
87
+ Content-Length:
88
+ - '370'
89
+ Content-Type:
90
+ - application/x-www-form-urlencoded
91
+ Accept-Encoding:
92
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
93
+ Host:
94
+ - api.mailgun.net
95
+ Authorization:
96
+ - Basic YXBpOmQ5MTViNWNkYjlhNTgzNjg1ZDhmM2ZiMWJlYzBmMjBmLTA3YmM3YjA1LWZhNDgxNmEx
97
+ response:
98
+ status:
99
+ code: 200
100
+ message: OK
101
+ headers:
102
+ Access-Control-Allow-Credentials:
103
+ - 'true'
104
+ Access-Control-Allow-Headers:
105
+ - Content-Type, x-requested-with, Authorization
106
+ Access-Control-Allow-Methods:
107
+ - GET, POST, PUT, DELETE, OPTIONS
108
+ Access-Control-Allow-Origin:
109
+ - "*"
110
+ Access-Control-Max-Age:
111
+ - '600'
112
+ Cache-Control:
113
+ - no-store
114
+ Content-Disposition:
115
+ - inline
116
+ Content-Type:
117
+ - application/json
118
+ Date:
119
+ - Mon, 10 May 2021 09:12:56 GMT
120
+ Server:
121
+ - nginx
122
+ Strict-Transport-Security:
123
+ - max-age=63072000; includeSubDomains
124
+ X-Ratelimit-Limit:
125
+ - '2000000'
126
+ X-Ratelimit-Remaining:
127
+ - '1999998'
128
+ X-Ratelimit-Reset:
129
+ - '1620637982656'
130
+ X-Recipient-Limit:
131
+ - '1000000'
132
+ X-Recipient-Remaining:
133
+ - '999998'
134
+ X-Recipient-Reset:
135
+ - '1620637982657'
136
+ Content-Length:
137
+ - '136'
138
+ Connection:
139
+ - keep-alive
140
+ body:
141
+ encoding: UTF-8
142
+ string: |-
143
+ {
144
+ "id": "<20210510091252.1.D6347B73DA43962E@DOMAIN.TEST>",
145
+ "message": "Queued. Thank you."
146
+ }
147
+ http_version:
148
+ recorded_at: Mon, 10 May 2021 09:12:56 GMT
149
+ recorded_with: VCR 3.0.3
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailgun-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mailgun
8
8
  - Travis Swientek
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-04-05 00:00:00.000000000 Z
12
+ date: 2021-06-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -192,6 +192,7 @@ files:
192
192
  - spec/integration/events_spec.rb
193
193
  - spec/integration/list_members_spec.rb
194
194
  - spec/integration/list_spec.rb
195
+ - spec/integration/mailer_spec.rb
195
196
  - spec/integration/mailgun_spec.rb
196
197
  - spec/integration/messages/sample_data/mime.txt
197
198
  - spec/integration/routes_spec.rb
@@ -220,8 +221,10 @@ files:
220
221
  - vcr_cassettes/events.yml
221
222
  - vcr_cassettes/exceptions.yml
222
223
  - vcr_cassettes/list_members.yml
224
+ - vcr_cassettes/mailer_invalid_domain.yml
223
225
  - vcr_cassettes/mailing_list.todo.yml
224
226
  - vcr_cassettes/mailing_list.yml
227
+ - vcr_cassettes/message_deliver.yml
225
228
  - vcr_cassettes/routes.yml
226
229
  - vcr_cassettes/send_message.yml
227
230
  - vcr_cassettes/stats.yml
@@ -232,7 +235,7 @@ homepage: http://www.mailgun.com
232
235
  licenses:
233
236
  - Apache-2.0
234
237
  metadata: {}
235
- post_install_message:
238
+ post_install_message:
236
239
  rdoc_options: []
237
240
  require_paths:
238
241
  - lib
@@ -247,8 +250,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
250
  - !ruby/object:Gem::Version
248
251
  version: '0'
249
252
  requirements: []
250
- rubygems_version: 3.0.9
251
- signing_key:
253
+ rubygems_version: 3.0.3
254
+ signing_key:
252
255
  specification_version: 4
253
256
  summary: Mailgun's Official Ruby SDK
254
257
  test_files:
@@ -260,6 +263,7 @@ test_files:
260
263
  - spec/integration/events_spec.rb
261
264
  - spec/integration/list_members_spec.rb
262
265
  - spec/integration/list_spec.rb
266
+ - spec/integration/mailer_spec.rb
263
267
  - spec/integration/mailgun_spec.rb
264
268
  - spec/integration/messages/sample_data/mime.txt
265
269
  - spec/integration/routes_spec.rb