sendwithus_ruby_action_mailer 0.1.2 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/README.md +15 -2
- data/lib/sendwithus_ruby_action_mailer/base.rb +6 -1
- data/lib/sendwithus_ruby_action_mailer/mail_params.rb +18 -1
- data/lib/sendwithus_ruby_action_mailer/version.rb +1 -1
- data/sendwithus_ruby_action_mailer.gemspec +1 -1
- data/test/lib/sendwithus_ruby_action_mailer/mail_params_test.rb +2 -2
- metadata +19 -18
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NDU4Zjc5OWU0YmRkMTM3N2U2YmRkZGMxZTIyZTM1ZmI5OGI3ZWMyZg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4836500f0c202f57c8c1af9703690e488b999fa0
|
4
|
+
data.tar.gz: 198d34d6fcaff0e0ce4d466de087d5d0feaa72bb
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
NGFkOTViNDY2ODc2ODY1NGE4ZWQxZDgxNTM0ZGJiMmQzOGRjZjM2MWJlODQy
|
11
|
-
ZWQ2MmNhMDk4ZjFiMjY3ODQ0OTY3NDZhNWJhMjQxMTBhNGM2MmM=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MWUxYjg0N2MwNzEwYmFmZjMxZWFhZGM0NTYwYzdkN2Y1YTY1ODQwNmUxYjc3
|
14
|
-
Zjk5OWRmOTY1YTQ2MzBhYzZhNmIzMzkwMmIxNTE0ODViOTI4NDMwY2Y3NWQ1
|
15
|
-
YjFhY2MzN2NmZTIzNjAzMWNmYWJkOWZhMjZiMTM3ZDM3ZDBmMzk=
|
6
|
+
metadata.gz: 098832db5ddc29570bcff1e7b7d2bf8e96eabd8447eedddc3e72d41ceaf8c2d58b4b8d22c30b41893e4890fd6f437f22696ea562d1f55b62a2fa7f4cdc390ee2
|
7
|
+
data.tar.gz: 43ddb9c5bdab56aca888348984fb9bcf6841e0ce7cb2f52a22ba77338eeae2e9efcfdc5a5a35d09f8a7808a9fe1cfb7187dc71ee542bfd5665bfca5e983e0ca5
|
data/README.md
CHANGED
@@ -59,8 +59,11 @@ class Notifier < SendWithUsMailer::Base
|
|
59
59
|
from_name: 'Billing',
|
60
60
|
from_address: 'billing@example.com',
|
61
61
|
reply_to: 'support@example.com',
|
62
|
-
bcc: [{:address => "name@example.com"},{:address => "name2@example.com"}],
|
63
|
-
version_name: '
|
62
|
+
bcc: [{:address => "name@example.com"}, {:address => "name2@example.com"}],
|
63
|
+
version_name: 'version-A',
|
64
|
+
locale: 'en-US',
|
65
|
+
files: ["/path/to/file"]
|
66
|
+
)
|
64
67
|
end
|
65
68
|
end
|
66
69
|
`````
|
@@ -98,6 +101,16 @@ class Notifier < SendWithUsMailer::Base
|
|
98
101
|
end
|
99
102
|
`````
|
100
103
|
|
104
|
+
## Using Sidekiq
|
105
|
+
|
106
|
+
Because SendWithUsMailer is not a subclass of ActionMailer (`SendWithUsMailer.is_a? ActionMailer` returns `false`), [Sidekiq's delayed ActionMailer extension](https://github.com/mperham/sidekiq/wiki/Delayed-extensions) will not automatically be included in the SendWithUsMailer, meaning that `YourMailer.delay.your_email` will not work without additional configuration. You can include Sidekiq's delayed ActionMailer in the SendWithUsMailer by putting the following line in `config/initializers/send_with_us.rb` along with your API config:
|
107
|
+
|
108
|
+
`````Ruby
|
109
|
+
::SendWithUsMailer::Base.extend(Sidekiq::Extensions::ActionMailer)
|
110
|
+
`````
|
111
|
+
|
112
|
+
That will cause Sidekiq to actually deliver the emails for jobs it processes offline. Relevant code in [Sidekiq::Extensions::ActionMailer](https://github.com/mperham/sidekiq/blob/master/lib/sidekiq/extensions/action_mailer.rb) and [SendWithUsMailer::Base](https://github.com/sendwithus/sendwithus_ruby_action_mailer/blob/master/lib/sendwithus_ruby_action_mailer/base.rb) should help explain why this is necessary.
|
113
|
+
|
101
114
|
## Contributing
|
102
115
|
|
103
116
|
1. Fork it
|
@@ -77,6 +77,11 @@ module SendWithUsMailer
|
|
77
77
|
super
|
78
78
|
end
|
79
79
|
end
|
80
|
+
|
81
|
+
# Add our mailer_methods to the set of methods the mailer responds to.
|
82
|
+
def respond_to?(method_name, include_all = false)
|
83
|
+
mailer_methods.include?(method_name.to_sym) || super
|
84
|
+
end
|
80
85
|
end
|
81
86
|
|
82
87
|
#----------------------- Instance methods ----------------------------
|
@@ -141,4 +146,4 @@ module SendWithUsMailer
|
|
141
146
|
@message.assign(key, value)
|
142
147
|
end
|
143
148
|
end
|
144
|
-
end
|
149
|
+
end
|
@@ -11,6 +11,8 @@ module SendWithUsMailer
|
|
11
11
|
@cc = []
|
12
12
|
@bcc = []
|
13
13
|
@version_name = ""
|
14
|
+
@locale = ""
|
15
|
+
@files = []
|
14
16
|
end
|
15
17
|
|
16
18
|
def assign(key, value) #:nodoc:
|
@@ -38,6 +40,10 @@ module SendWithUsMailer
|
|
38
40
|
@bcc.concat(value)
|
39
41
|
when :version_name
|
40
42
|
@version_name = value
|
43
|
+
when :locale
|
44
|
+
@locale = value
|
45
|
+
when :files
|
46
|
+
@files.concat(value)
|
41
47
|
end
|
42
48
|
end
|
43
49
|
end
|
@@ -49,7 +55,18 @@ module SendWithUsMailer
|
|
49
55
|
# In particular, the +api_key+ must be set (following the guidelines in the
|
50
56
|
# +send_with_us+ documentation).
|
51
57
|
def deliver
|
52
|
-
SendWithUs::Api.new.
|
58
|
+
SendWithUs::Api.new.send_email(
|
59
|
+
@email_id,
|
60
|
+
@to,
|
61
|
+
data: @email_data,
|
62
|
+
from: @from,
|
63
|
+
cc: @cc,
|
64
|
+
bcc: @bcc,
|
65
|
+
esp_account: "",
|
66
|
+
version_name: @version_name,
|
67
|
+
locale: @locale,
|
68
|
+
files: @files
|
69
|
+
)
|
53
70
|
end
|
54
71
|
end
|
55
72
|
end
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
21
21
|
gem.require_paths = ["lib"]
|
22
22
|
|
23
|
-
gem.add_runtime_dependency 'send_with_us'
|
23
|
+
gem.add_runtime_dependency 'send_with_us', '>= 1.9.0'
|
24
24
|
gem.add_development_dependency 'rake'
|
25
25
|
gem.add_development_dependency 'minitest-colorize'
|
26
26
|
gem.add_development_dependency 'mocha'
|
metadata
CHANGED
@@ -1,74 +1,75 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sendwithus_ruby_action_mailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicholas Rempel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: send_with_us
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.9.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:
|
26
|
+
version: 1.9.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest-colorize
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: mocha
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
description:
|
70
|
-
|
71
|
-
|
69
|
+
description: |-
|
70
|
+
A convenient way to use the Send With Us email
|
71
|
+
service with a Ruby on Rails app. SendWilthUsMailer implements a
|
72
|
+
mailer API similar to the ActionMailer railtie.
|
72
73
|
email:
|
73
74
|
- nick@sendwithus.com
|
74
75
|
executables: []
|
@@ -99,17 +100,17 @@ require_paths:
|
|
99
100
|
- lib
|
100
101
|
required_ruby_version: !ruby/object:Gem::Requirement
|
101
102
|
requirements:
|
102
|
-
- -
|
103
|
+
- - '>='
|
103
104
|
- !ruby/object:Gem::Version
|
104
105
|
version: '0'
|
105
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
107
|
requirements:
|
107
|
-
- -
|
108
|
+
- - '>='
|
108
109
|
- !ruby/object:Gem::Version
|
109
110
|
version: '0'
|
110
111
|
requirements: []
|
111
112
|
rubyforge_project:
|
112
|
-
rubygems_version: 2.
|
113
|
+
rubygems_version: 2.0.14
|
113
114
|
signing_key:
|
114
115
|
specification_version: 4
|
115
116
|
summary: An ActionMailer look alike for Send With Us.
|