courier_rails 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/gem-push.yml +18 -2
- data/CHANGELOG.md +3 -1
- data/CONTRIBUTING.md +28 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +197 -0
- data/README.md +4 -4
- data/Rakefile +2 -4
- data/courier_rails.gemspec +15 -12
- data/lib/courier_rails.rb +5 -4
- data/lib/courier_rails/data_options.rb +2 -6
- data/lib/courier_rails/delivery_method.rb +20 -33
- data/lib/courier_rails/exceptions.rb +1 -2
- data/lib/courier_rails/railtie.rb +1 -1
- data/lib/courier_rails/version.rb +1 -1
- metadata +35 -6
- data/.rubocop.yml +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d56a0b2f52123b72806477763af890b1976d06589baedf2b8851afe706fa05e
|
4
|
+
data.tar.gz: 280ca834964c5035f939b205c27b7e755a069ed57ee750fcec32de60134093b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5dece4418a09f9cda1e4f669721906d045f00fc8798970ce3ca73033a5d39c059930f4efb75cb7e8671046daaea0904b6d5e1245d9ab64bf392bf6cd358f7466
|
7
|
+
data.tar.gz: 5560debe54fd938b526170b557feca5bff602ab2c712d109840544374fd051a71d2c74f6a5616e7a370e7c8af68f2106acda8d930f03143da68bb27ddecb5c69
|
@@ -9,17 +9,33 @@ on:
|
|
9
9
|
branches: [main]
|
10
10
|
|
11
11
|
jobs:
|
12
|
+
test:
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- name: Set up Ruby 2.7
|
18
|
+
uses: actions/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: 2.7.x
|
21
|
+
- name: Install dependencies
|
22
|
+
run: bundle install
|
23
|
+
- name: Run tests
|
24
|
+
# Skipping rubocop for now
|
25
|
+
# run: bundle exec rake
|
26
|
+
run: bundle exec rspec spec
|
12
27
|
build:
|
13
28
|
name: Build + Publish
|
29
|
+
needs: test
|
14
30
|
if: startsWith(github.ref, 'refs/tags/v')
|
15
31
|
runs-on: ubuntu-latest
|
16
32
|
|
17
33
|
steps:
|
18
34
|
- uses: actions/checkout@v2
|
19
|
-
- name: Set up Ruby 2.
|
35
|
+
- name: Set up Ruby 2.7
|
20
36
|
uses: actions/setup-ruby@v1
|
21
37
|
with:
|
22
|
-
ruby-version: 2.
|
38
|
+
ruby-version: 2.7.x
|
23
39
|
|
24
40
|
- name: Publish to RubyGems
|
25
41
|
run: |
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
5
5
|
|
6
6
|
## [Unreleased][unreleased]
|
7
7
|
|
8
|
+
## v0.1.3 - 2020-12-17
|
9
|
+
|
8
10
|
Initial release.
|
9
11
|
|
10
|
-
[unreleased]: https://github.com/trycourier/courier-ruby-rails/compare/
|
12
|
+
[unreleased]: https://github.com/trycourier/courier-ruby-rails/compare/v0.1.3...HEAD
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/trycourier/courier-ruby-rails.
|
4
|
+
|
5
|
+
## Local development
|
6
|
+
|
7
|
+
- Fork this repository
|
8
|
+
- Clone your fork
|
9
|
+
- Run `bundle install`
|
10
|
+
- Write code!
|
11
|
+
- Test your code using `bundle exec rspec spec`
|
12
|
+
|
13
|
+
## Releasing New Versions
|
14
|
+
|
15
|
+
To publish Courier Rails to RUBYGEMS.ORG
|
16
|
+
|
17
|
+
- Update the CHANGELOG.md
|
18
|
+
- Bump the package version in `lib/courier_rails/version.rb`
|
19
|
+
- Submit a PR to merge changes into main
|
20
|
+
- Create and push a new version tag
|
21
|
+
|
22
|
+
```bash
|
23
|
+
git tag -a v<VERSION> -m v<VERSION>
|
24
|
+
git push origin v<VERSION>
|
25
|
+
```
|
26
|
+
|
27
|
+
- Wait for GitHub Action to test and deploy
|
28
|
+
- Confirm you are able to successfully install the new version by running `gem install courier_rails`
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,197 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
courier_rails (0.1.3)
|
5
|
+
rails (~> 6.0.0)
|
6
|
+
trycourier
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actioncable (6.0.3.4)
|
12
|
+
actionpack (= 6.0.3.4)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (>= 0.6.1)
|
15
|
+
actionmailbox (6.0.3.4)
|
16
|
+
actionpack (= 6.0.3.4)
|
17
|
+
activejob (= 6.0.3.4)
|
18
|
+
activerecord (= 6.0.3.4)
|
19
|
+
activestorage (= 6.0.3.4)
|
20
|
+
activesupport (= 6.0.3.4)
|
21
|
+
mail (>= 2.7.1)
|
22
|
+
actionmailer (6.0.3.4)
|
23
|
+
actionpack (= 6.0.3.4)
|
24
|
+
actionview (= 6.0.3.4)
|
25
|
+
activejob (= 6.0.3.4)
|
26
|
+
mail (~> 2.5, >= 2.5.4)
|
27
|
+
rails-dom-testing (~> 2.0)
|
28
|
+
actionpack (6.0.3.4)
|
29
|
+
actionview (= 6.0.3.4)
|
30
|
+
activesupport (= 6.0.3.4)
|
31
|
+
rack (~> 2.0, >= 2.0.8)
|
32
|
+
rack-test (>= 0.6.3)
|
33
|
+
rails-dom-testing (~> 2.0)
|
34
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
35
|
+
actiontext (6.0.3.4)
|
36
|
+
actionpack (= 6.0.3.4)
|
37
|
+
activerecord (= 6.0.3.4)
|
38
|
+
activestorage (= 6.0.3.4)
|
39
|
+
activesupport (= 6.0.3.4)
|
40
|
+
nokogiri (>= 1.8.5)
|
41
|
+
actionview (6.0.3.4)
|
42
|
+
activesupport (= 6.0.3.4)
|
43
|
+
builder (~> 3.1)
|
44
|
+
erubi (~> 1.4)
|
45
|
+
rails-dom-testing (~> 2.0)
|
46
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
47
|
+
activejob (6.0.3.4)
|
48
|
+
activesupport (= 6.0.3.4)
|
49
|
+
globalid (>= 0.3.6)
|
50
|
+
activemodel (6.0.3.4)
|
51
|
+
activesupport (= 6.0.3.4)
|
52
|
+
activerecord (6.0.3.4)
|
53
|
+
activemodel (= 6.0.3.4)
|
54
|
+
activesupport (= 6.0.3.4)
|
55
|
+
activestorage (6.0.3.4)
|
56
|
+
actionpack (= 6.0.3.4)
|
57
|
+
activejob (= 6.0.3.4)
|
58
|
+
activerecord (= 6.0.3.4)
|
59
|
+
marcel (~> 0.3.1)
|
60
|
+
activesupport (6.0.3.4)
|
61
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
62
|
+
i18n (>= 0.7, < 2)
|
63
|
+
minitest (~> 5.1)
|
64
|
+
tzinfo (~> 1.1)
|
65
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
66
|
+
addressable (2.7.0)
|
67
|
+
public_suffix (>= 2.0.2, < 5.0)
|
68
|
+
ast (2.4.1)
|
69
|
+
builder (3.2.4)
|
70
|
+
concurrent-ruby (1.1.8)
|
71
|
+
crack (0.4.4)
|
72
|
+
crass (1.0.6)
|
73
|
+
diff-lcs (1.4.4)
|
74
|
+
erubi (1.10.0)
|
75
|
+
globalid (0.4.2)
|
76
|
+
activesupport (>= 4.2.0)
|
77
|
+
hashdiff (1.0.1)
|
78
|
+
i18n (1.8.7)
|
79
|
+
concurrent-ruby (~> 1.0)
|
80
|
+
loofah (2.9.0)
|
81
|
+
crass (~> 1.0.2)
|
82
|
+
nokogiri (>= 1.5.9)
|
83
|
+
mail (2.7.1)
|
84
|
+
mini_mime (>= 0.1.1)
|
85
|
+
marcel (0.3.3)
|
86
|
+
mimemagic (~> 0.3.2)
|
87
|
+
method_source (1.0.0)
|
88
|
+
mimemagic (0.3.5)
|
89
|
+
mini_mime (1.0.2)
|
90
|
+
minitest (5.14.3)
|
91
|
+
nio4r (2.5.4)
|
92
|
+
nokogiri (1.11.1-x86_64-darwin)
|
93
|
+
racc (~> 1.4)
|
94
|
+
parallel (1.20.1)
|
95
|
+
parser (2.7.2.0)
|
96
|
+
ast (~> 2.4.1)
|
97
|
+
public_suffix (4.0.6)
|
98
|
+
racc (1.5.2)
|
99
|
+
rack (2.2.3)
|
100
|
+
rack-test (1.1.0)
|
101
|
+
rack (>= 1.0, < 3)
|
102
|
+
rails (6.0.3.4)
|
103
|
+
actioncable (= 6.0.3.4)
|
104
|
+
actionmailbox (= 6.0.3.4)
|
105
|
+
actionmailer (= 6.0.3.4)
|
106
|
+
actionpack (= 6.0.3.4)
|
107
|
+
actiontext (= 6.0.3.4)
|
108
|
+
actionview (= 6.0.3.4)
|
109
|
+
activejob (= 6.0.3.4)
|
110
|
+
activemodel (= 6.0.3.4)
|
111
|
+
activerecord (= 6.0.3.4)
|
112
|
+
activestorage (= 6.0.3.4)
|
113
|
+
activesupport (= 6.0.3.4)
|
114
|
+
bundler (>= 1.3.0)
|
115
|
+
railties (= 6.0.3.4)
|
116
|
+
sprockets-rails (>= 2.0.0)
|
117
|
+
rails-dom-testing (2.0.3)
|
118
|
+
activesupport (>= 4.2.0)
|
119
|
+
nokogiri (>= 1.6)
|
120
|
+
rails-html-sanitizer (1.3.0)
|
121
|
+
loofah (~> 2.3)
|
122
|
+
railties (6.0.3.4)
|
123
|
+
actionpack (= 6.0.3.4)
|
124
|
+
activesupport (= 6.0.3.4)
|
125
|
+
method_source
|
126
|
+
rake (>= 0.8.7)
|
127
|
+
thor (>= 0.20.3, < 2.0)
|
128
|
+
rainbow (3.0.0)
|
129
|
+
rake (13.0.1)
|
130
|
+
regexp_parser (2.0.0)
|
131
|
+
rexml (3.2.4)
|
132
|
+
rspec (3.10.0)
|
133
|
+
rspec-core (~> 3.10.0)
|
134
|
+
rspec-expectations (~> 3.10.0)
|
135
|
+
rspec-mocks (~> 3.10.0)
|
136
|
+
rspec-core (3.10.0)
|
137
|
+
rspec-support (~> 3.10.0)
|
138
|
+
rspec-expectations (3.10.0)
|
139
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
140
|
+
rspec-support (~> 3.10.0)
|
141
|
+
rspec-mocks (3.10.0)
|
142
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
143
|
+
rspec-support (~> 3.10.0)
|
144
|
+
rspec-support (3.10.0)
|
145
|
+
rubocop (1.4.2)
|
146
|
+
parallel (~> 1.10)
|
147
|
+
parser (>= 2.7.1.5)
|
148
|
+
rainbow (>= 2.2.2, < 4.0)
|
149
|
+
regexp_parser (>= 1.8)
|
150
|
+
rexml
|
151
|
+
rubocop-ast (>= 1.1.1)
|
152
|
+
ruby-progressbar (~> 1.7)
|
153
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
154
|
+
rubocop-ast (1.3.0)
|
155
|
+
parser (>= 2.7.1.5)
|
156
|
+
rubocop-performance (1.9.1)
|
157
|
+
rubocop (>= 0.90.0, < 2.0)
|
158
|
+
rubocop-ast (>= 0.4.0)
|
159
|
+
ruby-progressbar (1.10.1)
|
160
|
+
sprockets (4.0.2)
|
161
|
+
concurrent-ruby (~> 1.0)
|
162
|
+
rack (> 1, < 3)
|
163
|
+
sprockets-rails (3.2.2)
|
164
|
+
actionpack (>= 4.0)
|
165
|
+
activesupport (>= 4.0)
|
166
|
+
sprockets (>= 3.0.0)
|
167
|
+
standard (0.10.2)
|
168
|
+
rubocop (= 1.4.2)
|
169
|
+
rubocop-performance (= 1.9.1)
|
170
|
+
thor (1.1.0)
|
171
|
+
thread_safe (0.3.6)
|
172
|
+
trycourier (1.1.0)
|
173
|
+
tzinfo (1.2.9)
|
174
|
+
thread_safe (~> 0.1)
|
175
|
+
unicode-display_width (1.7.0)
|
176
|
+
webmock (3.11.0)
|
177
|
+
addressable (>= 2.3.6)
|
178
|
+
crack (>= 0.3.2)
|
179
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
180
|
+
websocket-driver (0.7.3)
|
181
|
+
websocket-extensions (>= 0.1.0)
|
182
|
+
websocket-extensions (0.1.5)
|
183
|
+
zeitwerk (2.4.2)
|
184
|
+
|
185
|
+
PLATFORMS
|
186
|
+
ruby
|
187
|
+
x86_64-darwin-19
|
188
|
+
|
189
|
+
DEPENDENCIES
|
190
|
+
courier_rails!
|
191
|
+
rake (~> 13.0)
|
192
|
+
rspec (~> 3.0)
|
193
|
+
standard
|
194
|
+
webmock (>= 1.24.2)
|
195
|
+
|
196
|
+
BUNDLED WITH
|
197
|
+
2.2.1
|
data/README.md
CHANGED
@@ -56,7 +56,7 @@ The unique identification key of a notification template to be sent. If the noti
|
|
56
56
|
|
57
57
|
### recipient (optional)
|
58
58
|
|
59
|
-
The unique identification key attached to a recipient and their profile. If empty, the code will auto-generate a unique key.
|
59
|
+
The unique identification key attached to a recipient and their profile. The value should be a string, all other values will be converted to a string. If empty, the code will either use the email provided in the to or auto-generate a unique key.
|
60
60
|
|
61
61
|
### profile (optional)
|
62
62
|
|
@@ -85,8 +85,8 @@ When calling the `deliver!` method on the mail object returned from your mailer.
|
|
85
85
|
|
86
86
|
```ruby
|
87
87
|
result = MyMailer.welcome_message(user).deliver!
|
88
|
-
puts result.code
|
89
|
-
puts result.message_id
|
88
|
+
puts result.code # Status Code
|
89
|
+
puts result.message_id # Message ID
|
90
90
|
```
|
91
91
|
|
92
92
|
## Development
|
@@ -97,7 +97,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
97
97
|
|
98
98
|
## Contributing
|
99
99
|
|
100
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/trycourier/courier_rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/trycourier/courier_rails/blob/master/CODE_OF_CONDUCT.md).
|
100
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/trycourier/courier_rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/trycourier/courier_rails/blob/master/CODE_OF_CONDUCT.md). See [CONTRIBUTING.md](CONTRIBUTING.md) for more info.
|
101
101
|
|
102
102
|
## License
|
103
103
|
|
data/Rakefile
CHANGED
data/courier_rails.gemspec
CHANGED
@@ -3,15 +3,15 @@
|
|
3
3
|
require_relative "lib/courier_rails/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name
|
7
|
-
spec.version
|
8
|
-
spec.authors
|
9
|
-
spec.email
|
10
|
-
|
11
|
-
spec.summary
|
12
|
-
spec.description
|
13
|
-
spec.homepage
|
14
|
-
spec.license
|
6
|
+
spec.name = "courier_rails"
|
7
|
+
spec.version = CourierRails::VERSION
|
8
|
+
spec.authors = ["Aydrian Howard"]
|
9
|
+
spec.email = ["aydrian@trycourier.com"]
|
10
|
+
|
11
|
+
spec.summary = "Courier for Rails"
|
12
|
+
spec.description = "Delivery Method for Rails ActionMailer to send notifications using the Courier API"
|
13
|
+
spec.homepage = "https://github.com/trycourier/courier-ruby-rails"
|
14
|
+
spec.license = "MIT"
|
15
15
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
16
16
|
|
17
17
|
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
@@ -25,16 +25,19 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
26
26
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
27
27
|
end
|
28
|
-
spec.bindir
|
29
|
-
spec.executables
|
28
|
+
spec.bindir = "exe"
|
29
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
30
30
|
spec.require_paths = ["lib"]
|
31
31
|
|
32
32
|
# Uncomment to register a new dependency of your gem
|
33
33
|
# spec.add_dependency "example-gem", "~> 1.0"
|
34
34
|
# spec.add_dependency "rails", ">= 4.0", "< 6.1"
|
35
|
-
spec.add_dependency "rails", "~> 6.
|
35
|
+
spec.add_dependency "rails", "~> 6.0.0"
|
36
36
|
spec.add_dependency "trycourier"
|
37
37
|
|
38
|
+
spec.add_development_dependency "rspec", "~> 3.2"
|
39
|
+
spec.add_development_dependency "webmock", ">=1.24.2"
|
40
|
+
|
38
41
|
# For more information and examples about making a new gem, checkout our
|
39
42
|
# guide at: https://bundler.io/guides/creating_gem.html
|
40
43
|
end
|
data/lib/courier_rails.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require_relative "courier_rails/data_options"
|
3
4
|
require_relative "courier_rails/delivery_method"
|
4
5
|
require_relative "courier_rails/railtie"
|
@@ -6,7 +7,7 @@ require_relative "courier_rails/version"
|
|
6
7
|
|
7
8
|
module CourierRails
|
8
9
|
class << self
|
9
|
-
|
10
|
+
attr_writer :configuration
|
10
11
|
end
|
11
12
|
|
12
13
|
def self.configuration
|
@@ -26,10 +27,10 @@ module CourierRails
|
|
26
27
|
end
|
27
28
|
|
28
29
|
def set_defaults
|
29
|
-
if ENV.has_key?("COURIER_AUTH_TOKEN")
|
30
|
-
|
30
|
+
@api_key = if ENV.has_key?("COURIER_AUTH_TOKEN")
|
31
|
+
ENV["COURIER_AUTH_TOKEN"]
|
31
32
|
else
|
32
|
-
|
33
|
+
""
|
33
34
|
end
|
34
35
|
end
|
35
36
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module CourierRails
|
2
2
|
module DataOptions
|
3
|
-
|
4
3
|
def self.included(base)
|
5
4
|
base.class_eval do
|
6
5
|
prepend InstanceMethods
|
@@ -8,8 +7,7 @@ module CourierRails
|
|
8
7
|
end
|
9
8
|
|
10
9
|
module InstanceMethods
|
11
|
-
|
12
|
-
def mail(headers={}, &block)
|
10
|
+
def mail(headers = {}, &block)
|
13
11
|
headers = headers.clone
|
14
12
|
courier_data = headers.delete(:courier_data)
|
15
13
|
courier_data ||= {}
|
@@ -18,8 +16,6 @@ module CourierRails
|
|
18
16
|
message.courier_data = courier_data
|
19
17
|
end
|
20
18
|
end
|
21
|
-
|
22
19
|
end
|
23
|
-
|
24
20
|
end
|
25
|
-
end
|
21
|
+
end
|
@@ -20,9 +20,7 @@ module CourierRails
|
|
20
20
|
prepare_data_from courier_data
|
21
21
|
prepare_brand_from courier_data
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
result
|
23
|
+
perfom_send_request
|
26
24
|
end
|
27
25
|
|
28
26
|
private
|
@@ -32,58 +30,47 @@ module CourierRails
|
|
32
30
|
@client = Courier::Client.new CourierRails.configuration.api_key
|
33
31
|
end
|
34
32
|
|
35
|
-
def find_courier_data_from
|
33
|
+
def find_courier_data_from(mail)
|
36
34
|
mail.courier_data
|
37
35
|
end
|
38
36
|
|
39
|
-
def prepare_event_from
|
37
|
+
def prepare_event_from(courier_data)
|
40
38
|
if courier_data.has_key?(:event)
|
41
39
|
@payload["event"] = courier_data[:event]
|
42
40
|
else
|
43
|
-
raise
|
41
|
+
raise StandardError, "Must specify :event key in courier_data."
|
44
42
|
end
|
45
43
|
end
|
46
44
|
|
47
|
-
def prepare_recipient_from
|
48
|
-
if courier_data.has_key?(:recipient)
|
49
|
-
|
45
|
+
def prepare_recipient_from(mail, courier_data)
|
46
|
+
@payload["recipient"] = if courier_data.has_key?(:recipient)
|
47
|
+
courier_data[:recipient].to_s
|
48
|
+
elsif !mail.to.nil?
|
49
|
+
mail.to.first
|
50
50
|
else
|
51
|
-
|
51
|
+
SecureRandom.uuid
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
def prepare_profile_from
|
55
|
+
def prepare_profile_from(mail, courier_data)
|
56
56
|
profile = {}
|
57
|
-
if courier_data.has_key?(:profile)
|
58
|
-
profile = courier_data[:profile]
|
59
|
-
end
|
57
|
+
profile = courier_data[:profile] if courier_data.has_key?(:profile)
|
60
58
|
|
61
|
-
|
62
|
-
profile["email"] = mail.to.first
|
63
|
-
end
|
59
|
+
profile[:email] = mail.to.first unless mail.to.nil?
|
64
60
|
|
65
|
-
|
66
|
-
@payload["profile"] = profile
|
67
|
-
end
|
61
|
+
@payload["profile"] = profile unless profile.empty?
|
68
62
|
end
|
69
63
|
|
70
|
-
def prepare_data_from
|
71
|
-
if courier_data.has_key?(:data)
|
72
|
-
@payload["data"] = courier_data[:data]
|
73
|
-
end
|
64
|
+
def prepare_data_from(courier_data)
|
65
|
+
@payload["data"] = courier_data[:data] if courier_data.has_key?(:data)
|
74
66
|
end
|
75
67
|
|
76
|
-
def prepare_brand_from
|
77
|
-
if courier_data.has_key?(:brand)
|
78
|
-
@payload["brand"] = courier_data[:brand]
|
79
|
-
end
|
68
|
+
def prepare_brand_from(courier_data)
|
69
|
+
@payload["brand"] = courier_data[:brand] if courier_data.has_key?(:brand)
|
80
70
|
end
|
81
71
|
|
82
72
|
def perfom_send_request
|
83
|
-
|
84
|
-
|
85
|
-
result
|
73
|
+
client.send(@payload)
|
86
74
|
end
|
87
|
-
|
88
75
|
end
|
89
|
-
end
|
76
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: courier_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aydrian Howard
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 6.
|
19
|
+
version: 6.0.0
|
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: 6.
|
26
|
+
version: 6.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: trycourier
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +38,34 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.2'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: webmock
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.24.2
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.24.2
|
41
69
|
description: Delivery Method for Rails ActionMailer to send notifications using the
|
42
70
|
Courier API
|
43
71
|
email:
|
@@ -51,10 +79,11 @@ files:
|
|
51
79
|
- ".github/workflows/gem-push.yml"
|
52
80
|
- ".gitignore"
|
53
81
|
- ".rspec"
|
54
|
-
- ".rubocop.yml"
|
55
82
|
- CHANGELOG.md
|
56
83
|
- CODE_OF_CONDUCT.md
|
84
|
+
- CONTRIBUTING.md
|
57
85
|
- Gemfile
|
86
|
+
- Gemfile.lock
|
58
87
|
- LICENSE.txt
|
59
88
|
- README.md
|
60
89
|
- Rakefile
|
@@ -89,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
118
|
- !ruby/object:Gem::Version
|
90
119
|
version: '0'
|
91
120
|
requirements: []
|
92
|
-
rubygems_version: 3.
|
121
|
+
rubygems_version: 3.1.4
|
93
122
|
signing_key:
|
94
123
|
specification_version: 4
|
95
124
|
summary: Courier for Rails
|