ohmysmtp-rails 0.1.6 → 0.2.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: 523762bd4817881c5212cc60c53c8296454d0ac29c29d0cf20dd2350beb47cb7
4
- data.tar.gz: 85d60684a427afe9afd4320ba40fabcfc93324af60384f80b8b5bebd5c8df082
3
+ metadata.gz: a597f7e583471f790c1e7b669ad4e9b5f1327675cc176f28016eab512cb0c7dc
4
+ data.tar.gz: 631b23bdb932677707e24ddc4009c708843702d0ec2f44fc9b658c1beaccca2c
5
5
  SHA512:
6
- metadata.gz: cb9f127dc921ae6a0e2a9a9f6bc81e79f42bd59c792f05338c43e75b5ab37e711ddee2ab1d923fed37f6d103a3b2063aa706e606f1643384821ff43b226e2b1e
7
- data.tar.gz: b4a59456d2706587ca69a15dfc5d22fbbba37c1ad6e8c73880eefce41e7a61d2e68ba3bc52594ca544cca33c91b7310cf063663dc228cdd5eb8b010ce9b130e4
6
+ metadata.gz: 908d2acb45d4b64fe17b2091da1b9289dd614f7c6d4f4a61698f17c39fab396a123994932e1281720a993a6a430b73baec18eec654bcfdb639a046f6bf22c63a
7
+ data.tar.gz: 9cf4965645ce0f8d51320d8441516b311a5d833b8257159c1cd19d003a22a993a025056712dc02cb29b088c234ba73022ef86297766ed2e450c0e6cf13e390ad
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
4
4
  [![Gem Version](https://badge.fury.io/rb/ohmysmtp-rails.svg)](https://badge.fury.io/rb/ohmysmtp-rails)
5
-
5
+ [![OhMySMTP Rails](https://circleci.com/gh/ohmysmtp/ohmysmtp-rails.svg?style=svg)](https://app.circleci.com/pipelines/github/ohmysmtp/ohmysmtp-rails)
6
6
 
7
7
  [OhMySMTP](https://ohmysmtp.com) lets you send transactional emails from your app over an easy to use API.
8
8
 
@@ -106,6 +106,10 @@ end
106
106
 
107
107
  Note that this should always be a string, even if using an array of multiple tags.
108
108
 
109
+ ## List-Unsubscribe
110
+
111
+ To add a List-Unsubscribe header: ``
112
+
109
113
  ## Support
110
114
 
111
115
  For support please check the [OhMySMTP Documentation](https://docs.ohmysmtp.com) or contact us at support@ohmysmtp.com
@@ -1,5 +1,5 @@
1
1
  module OhMySMTP
2
2
  module Rails
3
- VERSION = '0.1.6'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
@@ -12,7 +12,7 @@ module OhMySMTP
12
12
 
13
13
  def initialize(values)
14
14
  check_api_token(values)
15
- self.settings = {}.merge!(values)
15
+ self.settings = { return_response: true }.merge!(values)
16
16
  end
17
17
 
18
18
  def deliver!(mail)
@@ -20,17 +20,20 @@ module OhMySMTP
20
20
  result = HTTParty.post(
21
21
  'https://app.ohmysmtp.com/api/v1/send',
22
22
  body: {
23
- from: mail.from_address.to_s,
23
+ from: mail.header[:from]&.address_list&.addresses&.first.to_s,
24
24
  to: mail.to.join(','),
25
25
  subject: mail.subject,
26
26
  htmlbody: mail.html_part ? mail.html_part.body.decoded : mail.body.to_s,
27
- textbody: mail.multipart? ? (mail.text_part ? mail.text_part.body.decoded : nil) : nil,
27
+ textbody: if mail.multipart?
28
+ mail.text_part ? mail.text_part.body.decoded : nil
29
+ end,
28
30
  cc: mail.cc&.join(','),
29
31
  bcc: mail.bcc&.join(','),
30
32
  replyto: mail.reply_to,
33
+ list_unsubscribe: mail.header['list_unsubscribe'].to_s,
31
34
  attachments: format_attachments(mail.attachments),
32
35
  tags: mail.header['tags'].to_s
33
- }.compact.to_json,
36
+ }.delete_if { |_key, value| value.blank? }.to_json,
34
37
  headers: {
35
38
  'User-Agent' => "OhMySMTP Rails Gem v#{OhMySMTP::Rails::VERSION}",
36
39
  'Accept' => 'application/json',
@@ -57,7 +60,7 @@ module OhMySMTP
57
60
  end
58
61
 
59
62
  def handle_response(result)
60
- return unless result.code != 200
63
+ return result unless result.code != 200
61
64
 
62
65
  # TODO: Improved error handling
63
66
  res = result.parsed_response
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ohmysmtp-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OhMySMTP
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-30 00:00:00.000000000 Z
11
+ date: 2021-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rails
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: actionmailer
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -53,47 +39,33 @@ dependencies:
53
39
  - !ruby/object:Gem::Version
54
40
  version: 0.18.1
55
41
  - !ruby/object:Gem::Dependency
56
- name: byebug
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: pry
42
+ name: rails
71
43
  requirement: !ruby/object:Gem::Requirement
72
44
  requirements:
73
45
  - - ">="
74
46
  - !ruby/object:Gem::Version
75
- version: '0'
47
+ version: 6.1.4.1
76
48
  type: :development
77
49
  prerelease: false
78
50
  version_requirements: !ruby/object:Gem::Requirement
79
51
  requirements:
80
52
  - - ">="
81
53
  - !ruby/object:Gem::Version
82
- version: '0'
54
+ version: 6.1.4.1
83
55
  - !ruby/object:Gem::Dependency
84
56
  name: sqlite3
85
57
  requirement: !ruby/object:Gem::Requirement
86
58
  requirements:
87
59
  - - ">="
88
60
  - !ruby/object:Gem::Version
89
- version: '0'
61
+ version: 1.4.2
90
62
  type: :development
91
63
  prerelease: false
92
64
  version_requirements: !ruby/object:Gem::Requirement
93
65
  requirements:
94
66
  - - ">="
95
67
  - !ruby/object:Gem::Version
96
- version: '0'
68
+ version: 1.4.2
97
69
  description: The OhMySMTP Rails Gem is a plug in for ActionMailer to send emails via
98
70
  OhMySMTP to make sending emails from Rails apps super simple.
99
71
  email: