hanami-mailer 1.3.0.beta1 → 1.3.0

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: edf954374f4e9a8c4a0a1527760dddc38cd4fd1ffb4111513566e1c9a882a33e
4
- data.tar.gz: 58fb4113c25a774caf30b6290f7cd9f1602fe1e123ddb380f355481f9661f3bd
3
+ metadata.gz: 52f0c61d4de8af3cfa11ee5ba09337c5e1091f04f23ccf3c149a8e13c71bf71b
4
+ data.tar.gz: aa1009dd9bc9036c72e657763fc7d1892dc0769f2b3bf89f9ac5ed5e8299d0d7
5
5
  SHA512:
6
- metadata.gz: bd07d7bd3b12582cf4b30d5d0a6d106e1d57b2ada08c28195aa879160dbbe839296bd60086b2756b190b0c5893a95a8f13b36af8467976e27abdb1411a9b9a55
7
- data.tar.gz: 531c2b67149ecba1e3cee6a9ec735816c8a49485efe42bc884eac0716b934680f68e929ebfbf386a42ef6fe1b43b5df227aceeb79a6df2c986f0d07bc75ee09b
6
+ metadata.gz: 6559982652477d33fc96333a51a188580ef564152ba66b694f28ce7f01d5895b5a3e0da1549d98de197cd83d951735b6ad0ec2ce8a6f16559cdb41986f7e4967
7
+ data.tar.gz: a512a7528eca16fc7ff933884b5eadeb69a337ceee9539e1a9990847b9540e245ab21c35347af9fc9900f13d2dbb870950d23bae2b0f29e61413c064a3e050a7
@@ -1,6 +1,10 @@
1
1
  # Hanami::Mailer
2
2
  Mail for Ruby applications
3
3
 
4
+ ## v1.3.0 - 2018-10-24
5
+ ### Added
6
+ - [Ben Bachhuber] Added support for `reply_to`
7
+
4
8
  ## v1.3.0.beta1 - 2018-08-08
5
9
  ### Added
6
10
  - [Luca Guidi] Official support for JRuby 9.2.0.0
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
  spec.required_ruby_version = '>= 2.3.0'
21
21
 
22
- spec.add_dependency 'hanami-utils', '~> 1.3.beta'
22
+ spec.add_dependency 'hanami-utils', '~> 1.3'
23
23
  spec.add_dependency 'tilt', '~> 2.0', '>= 2.0.1'
24
24
  spec.add_dependency 'mail', '~> 2.6'
25
25
 
@@ -225,6 +225,7 @@ module Hanami
225
225
  mail.deliver
226
226
  rescue ArgumentError => e
227
227
  raise MissingDeliveryDataError if e.message =~ /SMTP (From|To) address/
228
+
228
229
  raise
229
230
  end
230
231
 
@@ -283,11 +284,12 @@ module Hanami
283
284
  # rubocop:disable Metrics/AbcSize
284
285
  def build
285
286
  Mail.new.tap do |m|
286
- m.from = __dsl(:from)
287
- m.to = __dsl(:to)
288
- m.cc = __dsl(:cc)
289
- m.bcc = __dsl(:bcc)
290
- m.subject = __dsl(:subject)
287
+ m.from = __dsl(:from)
288
+ m.to = __dsl(:to)
289
+ m.cc = __dsl(:cc)
290
+ m.bcc = __dsl(:bcc)
291
+ m.reply_to = __dsl(:reply_to)
292
+ m.subject = __dsl(:subject)
291
293
 
292
294
  m.charset = charset
293
295
  m.html_part = __part(:html)
@@ -11,11 +11,12 @@ module Hanami
11
11
  # @api private
12
12
  def self.extended(base)
13
13
  base.class_eval do
14
- @from = nil
15
- @to = nil
16
- @cc = nil
17
- @bcc = nil
18
- @subject = nil
14
+ @from = nil
15
+ @to = nil
16
+ @cc = nil
17
+ @bcc = nil
18
+ @reply_to = nil
19
+ @subject = nil
19
20
  end
20
21
  end
21
22
 
@@ -319,6 +320,95 @@ module Hanami
319
320
  end
320
321
  end
321
322
 
323
+ # Sets the reply_to for mail messages
324
+ #
325
+ # It accepts a hardcoded value as a string or array of strings.
326
+ # For dynamic values, you can specify a symbol that represents an instance
327
+ # method.
328
+ #
329
+ # This value is optional.
330
+ #
331
+ # When a value is given, it specifies the reply_to for the email.
332
+ # When a value is not given, it returns the reply_to of the email.
333
+ #
334
+ # This is part of a DSL, for this reason when this method is called with
335
+ # an argument, it will set the corresponding class variable. When
336
+ # called without, it will return the already set value, or the default.
337
+ #
338
+ # @overload reply_to(value)
339
+ # Sets the reply_to
340
+ # @param value [String, Array, Symbol] the hardcoded value or method name
341
+ # @return [NilClass]
342
+ #
343
+ # @overload reply_to
344
+ # Returns the reply_to
345
+ # @return [String, Array, Symbol] the recipient
346
+ #
347
+ # @since 1.3.0
348
+ #
349
+ # @example Hardcoded value (String)
350
+ # require 'hanami/mailer'
351
+ #
352
+ # class WelcomeMailer
353
+ # include Hanami::Mailer
354
+ #
355
+ # to "user@example.com"
356
+ # reply_to "other.user@example.com"
357
+ # end
358
+ #
359
+ # @example Hardcoded value (Array)
360
+ # require 'hanami/mailer'
361
+ #
362
+ # class WelcomeMailer
363
+ # include Hanami::Mailer
364
+ #
365
+ # to ["user-1@example.com", "user-2@example.com"]
366
+ # reply_to ["other.user-1@example.com", "other.user-2@example.com"]
367
+ # end
368
+ #
369
+ # @example Method (Symbol)
370
+ # require 'hanami/mailer'
371
+ #
372
+ # class WelcomeMailer
373
+ # include Hanami::Mailer
374
+ # to "user@example.com"
375
+ # reply_to :email_address
376
+ #
377
+ # private
378
+ #
379
+ # def email_address
380
+ # user.email
381
+ # end
382
+ # end
383
+ #
384
+ # other_user = User.new(name: 'L')
385
+ # WelcomeMailer.deliver(user: other_user)
386
+ #
387
+ # @example Method that returns a collection of recipients
388
+ # require 'hanami/mailer'
389
+ #
390
+ # class WelcomeMailer
391
+ # include Hanami::Mailer
392
+ # to "user@example.com"
393
+ # reply_to :recipients
394
+ #
395
+ # private
396
+ #
397
+ # def recipients
398
+ # users.map(&:email)
399
+ # end
400
+ # end
401
+ #
402
+ # other_users = [User.new(name: 'L'), User.new(name: 'MG')]
403
+ # WelcomeMailer.deliver(users: other_users)
404
+ def reply_to(value = nil)
405
+ if value.nil?
406
+ @reply_to
407
+ else
408
+ @reply_to = value
409
+ end
410
+ end
411
+
322
412
  # Sets the recipient for mail messages
323
413
  #
324
414
  # It accepts a hardcoded value as a string or array of strings.
@@ -1,6 +1,6 @@
1
1
  module Hanami
2
2
  module Mailer
3
3
  # @since 0.1.0
4
- VERSION = '1.3.0.beta1'.freeze
4
+ VERSION = '1.3.0'.freeze
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami-mailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0.beta1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-08 00:00:00.000000000 Z
11
+ date: 2018-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hanami-utils
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.3.beta
19
+ version: '1.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.3.beta
26
+ version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: tilt
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -134,9 +134,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
134
134
  version: 2.3.0
135
135
  required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  requirements:
137
- - - ">"
137
+ - - ">="
138
138
  - !ruby/object:Gem::Version
139
- version: 1.3.1
139
+ version: '0'
140
140
  requirements: []
141
141
  rubyforge_project:
142
142
  rubygems_version: 2.7.7