mass_mandrill 0.3.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +14 -0
- data/Gemfile +2 -3
- data/Gemfile.lock +48 -14
- data/README.md +153 -0
- data/Rakefile +9 -0
- data/VERSION +1 -1
- data/lib/mass_mandrill.rb +3 -13
- data/lib/mass_mandrill/mandrill_mail.rb +1 -1
- data/lib/mass_mandrill/mandrill_mailer.rb +6 -6
- data/lib/mass_mandrill/test_mailer.rb +22 -0
- data/mass_mandrill.gemspec +16 -18
- metadata +48 -49
- data/README.markdown +0 -82
- data/lib/mass_mandrill/config.rb +0 -8
- data/spec/mass_mandrill/config_spec.rb +0 -11
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: daf975cbfeca4c942e9ce2af3db7fd236d74db38
|
4
|
+
data.tar.gz: c11ef69efb1381e9d9587dc44fb8e1c7e8065571
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7165c8f3855318bab6ee8c14fe985877ac514dfcdb0b7d650e5ba242725f0399e30dc4690587934fd2f2b46ade25968b0e30c24a25a810f5d121fa27b3f64c33
|
7
|
+
data.tar.gz: 1edfb00ed3e28bd48c68635fe1e990c8df69fe1e4980cb7bc6243186e84ff6aa43d25c42172f128aff69b7503cdfc7b3b83e180c05c4e11ee5e2e89b7ae34574
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
## [1.0.0] - 2015-01-25
|
6
|
+
|
7
|
+
### Added
|
8
|
+
|
9
|
+
- Rake task for sending the real test email.
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
|
13
|
+
- Set Mandrill API key in `MANDRILL_APIKEY` environment variable instead of an
|
14
|
+
initializer.
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,27 +1,60 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
debugger-
|
4
|
+
addressable (2.3.6)
|
5
|
+
builder (3.2.2)
|
6
|
+
byebug (3.5.1)
|
7
|
+
columnize (~> 0.8)
|
8
|
+
debugger-linecache (~> 1.2)
|
9
|
+
slop (~> 3.6)
|
10
|
+
columnize (0.9.0)
|
9
11
|
debugger-linecache (1.2.0)
|
10
|
-
|
12
|
+
descendants_tracker (0.0.4)
|
13
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
11
14
|
diff-lcs (1.2.1)
|
12
15
|
excon (0.16.10)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
+
faraday (0.9.1)
|
17
|
+
multipart-post (>= 1.2, < 3)
|
18
|
+
git (1.2.9.1)
|
19
|
+
github_api (0.12.2)
|
20
|
+
addressable (~> 2.3)
|
21
|
+
descendants_tracker (~> 0.0.4)
|
22
|
+
faraday (~> 0.8, < 0.10)
|
23
|
+
hashie (>= 3.3)
|
24
|
+
multi_json (>= 1.7.5, < 2.0)
|
25
|
+
nokogiri (~> 1.6.3)
|
26
|
+
oauth2
|
27
|
+
hashie (3.3.2)
|
28
|
+
highline (1.6.21)
|
29
|
+
jeweler (2.0.1)
|
30
|
+
builder
|
31
|
+
bundler (>= 1.0)
|
16
32
|
git (>= 1.2.5)
|
33
|
+
github_api
|
34
|
+
highline (>= 1.6.15)
|
35
|
+
nokogiri (>= 1.5.10)
|
17
36
|
rake
|
18
37
|
rdoc
|
19
38
|
json (1.7.7)
|
39
|
+
jwt (1.2.1)
|
20
40
|
mandrill-api (1.0.17)
|
21
41
|
excon (~> 0.16.0)
|
22
42
|
json (~> 1.7.7)
|
23
|
-
|
24
|
-
|
43
|
+
mini_portile (0.6.2)
|
44
|
+
multi_json (1.10.1)
|
45
|
+
multi_xml (0.5.5)
|
46
|
+
multipart-post (2.0.0)
|
47
|
+
nokogiri (1.6.6.2)
|
48
|
+
mini_portile (~> 0.6.0)
|
49
|
+
oauth2 (1.0.0)
|
50
|
+
faraday (>= 0.8, < 0.10)
|
51
|
+
jwt (~> 1.0)
|
52
|
+
multi_json (~> 1.3)
|
53
|
+
multi_xml (~> 0.5)
|
54
|
+
rack (~> 1.2)
|
55
|
+
rack (1.6.0)
|
56
|
+
rake (10.4.2)
|
57
|
+
rdoc (4.0.1)
|
25
58
|
json (~> 1.4)
|
26
59
|
rspec (2.13.0)
|
27
60
|
rspec-core (~> 2.13.0)
|
@@ -31,14 +64,15 @@ GEM
|
|
31
64
|
rspec-expectations (2.13.0)
|
32
65
|
diff-lcs (>= 1.1.3, < 2.0)
|
33
66
|
rspec-mocks (2.13.0)
|
67
|
+
slop (3.6.0)
|
68
|
+
thread_safe (0.3.4)
|
34
69
|
|
35
70
|
PLATFORMS
|
36
71
|
ruby
|
37
72
|
|
38
73
|
DEPENDENCIES
|
39
|
-
|
40
|
-
|
41
|
-
jeweler (~> 1.8.4)
|
74
|
+
byebug (~> 3.5.1)
|
75
|
+
jeweler (~> 2.0.1)
|
42
76
|
mandrill-api (~> 1.0.16)
|
43
77
|
rdoc (~> 4.0.0)
|
44
78
|
rspec (~> 2.13.0)
|
data/README.md
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
Mass Mandrill
|
2
|
+
=============
|
3
|
+
|
4
|
+
Mass Mandrill is thin wrapper around mandrill-api gem that makes sending emails
|
5
|
+
with Mandrill easier and more pleasent to use. Goal is to resemble Rails'
|
6
|
+
ActionMailer API. Although sending emails with Mass Mandrill looks like sending
|
7
|
+
emails with ActionMailer, Mass Mandrill does not depend on Rails and it can be
|
8
|
+
used in non-Rails applications.
|
9
|
+
|
10
|
+
Mass Mandrill supports bulk email sending and Mandrill templates. To learn more
|
11
|
+
about these topics, visit [Mandrill Support](http://help.mandrill.com/home).
|
12
|
+
|
13
|
+
Example
|
14
|
+
-------
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
class ExampleMailer < MassMandrill::MandrillMailer
|
18
|
+
|
19
|
+
def example_notice(recipients)
|
20
|
+
addresses = recipients.map { |recipient| recipient.email }
|
21
|
+
global_merge_vars = [{ name: 'headline', content: 'This is first example notice' }]
|
22
|
+
merge_vars = recipients.map do |recipient|
|
23
|
+
{
|
24
|
+
:rcpt => recipient.email,
|
25
|
+
:vars => [{ :name => 'first_name', :content => recipient.first_name }]
|
26
|
+
}
|
27
|
+
end
|
28
|
+
template_content = [{ :name => 'header', :content => '<h1>Hello World</h1>' }]
|
29
|
+
|
30
|
+
mail(to: addresses,
|
31
|
+
from: 'John Doe <john.doe@example.com>',
|
32
|
+
subject: 'This is example notice!',
|
33
|
+
template_content: template_content,
|
34
|
+
global_merge_vars: global_merge_vars,
|
35
|
+
merge_vars: merge_vars)
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
And to send the email:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
users = User.all
|
45
|
+
ExampleMailer.example_notice(users).deliver
|
46
|
+
```
|
47
|
+
|
48
|
+
Name of the Mandrill template that's going to be used for sending is same as
|
49
|
+
name of the method - in example above `example_notice`. To override template
|
50
|
+
name, use `template` parameter:
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
mail(to: addresses,
|
54
|
+
from: 'John Doe <john.doe@example.com>',
|
55
|
+
subject: 'This is example notice!',
|
56
|
+
template: 'some_other_template',
|
57
|
+
global_merge_vars: global_merge_vars,
|
58
|
+
merge_vars: merge_vars)
|
59
|
+
```
|
60
|
+
|
61
|
+
You can omit some options like `from` and `subject` in which case the default
|
62
|
+
`from` and `subject` that are stored remotely on the Mandrill server will be
|
63
|
+
used. You can also send additional configuration to the message (like
|
64
|
+
`inline_css`, `track_opens`, `track_clicks`, `preserve_recipients`, ...) by
|
65
|
+
passing a hash of `message_extra`. For a complete list of these parameters,
|
66
|
+
check the [Mandrill Message
|
67
|
+
API](https://mandrillapp.com/api/docs/messages.JSON.html).
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
mail(to: addresses,
|
71
|
+
global_merge_vars: global_merge_vars,
|
72
|
+
merge_vars: merge_vars,
|
73
|
+
message_extra: {
|
74
|
+
inline_css: true,
|
75
|
+
track_opens: false
|
76
|
+
})
|
77
|
+
```
|
78
|
+
|
79
|
+
Install
|
80
|
+
-------
|
81
|
+
|
82
|
+
Add mass_mandrill to your Gemfile:
|
83
|
+
|
84
|
+
gem 'mass_mandrill'
|
85
|
+
|
86
|
+
Install it:
|
87
|
+
|
88
|
+
bundle
|
89
|
+
|
90
|
+
Or if you are not using bundler:
|
91
|
+
|
92
|
+
gem install mass_mandrill
|
93
|
+
|
94
|
+
Place your Mandrill API key in `MANDRILL_APIKEY` environment variable (e.g.
|
95
|
+
`export MANDRILL_APIKEY=your-key`). If you are using
|
96
|
+
[foreman](https://github.com/ddollar/foreman) to run your application, place it
|
97
|
+
in your `.env`:
|
98
|
+
|
99
|
+
MANDRILL_APIKEY=PASTE_YOUR_API_KEY_HERE
|
100
|
+
|
101
|
+
|
102
|
+
Contributing to Mass Mandrill
|
103
|
+
-----------------------------
|
104
|
+
|
105
|
+
* Check out the latest master to make sure the feature hasn't been implemented
|
106
|
+
or the bug hasn't been fixed yet.
|
107
|
+
* Check out the issue tracker to make sure someone already hasn't requested it
|
108
|
+
and/or contributed it.
|
109
|
+
* Fork the project.
|
110
|
+
* Start a feature/bugfix branch.
|
111
|
+
* Commit and push until you are happy with your contribution.
|
112
|
+
* Make sure to add tests for it. This is important so I don't break it in a
|
113
|
+
future version unintentionally.
|
114
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to
|
115
|
+
have your own version, or is otherwise necessary, that is fine, but please
|
116
|
+
isolate to its own commit so I can cherry-pick around it.
|
117
|
+
|
118
|
+
Testing Mass Mandrill
|
119
|
+
---------------------
|
120
|
+
|
121
|
+
Mass Mandrill is covered with RSpec tests. Besides that, there is a Rake task
|
122
|
+
that sends test email to your email address for ultimate test. Follow these
|
123
|
+
steps for running the Rake task:
|
124
|
+
|
125
|
+
Create Mandrill account at mandrillapp.com.
|
126
|
+
|
127
|
+
Create a template called `test_email` with following content:
|
128
|
+
|
129
|
+
```
|
130
|
+
<p>*|HEADLINE|*</p>
|
131
|
+
|
132
|
+
<p>Hello *|FIRST_NAME|*.</p>
|
133
|
+
```
|
134
|
+
|
135
|
+
Export your Mandrill API key in an environment variable:
|
136
|
+
|
137
|
+
```bash
|
138
|
+
export MANDRILL_APIKEY=your-key
|
139
|
+
```
|
140
|
+
|
141
|
+
Run the Rake task with your email address:
|
142
|
+
|
143
|
+
```bash
|
144
|
+
bundle exec rake test:send_email\[your-email@example.com\]
|
145
|
+
```
|
146
|
+
|
147
|
+
Check your email to verify everything is working correctly.
|
148
|
+
|
149
|
+
Copyright
|
150
|
+
---------
|
151
|
+
|
152
|
+
Copyright (c) 2015 Trisignia, Nebojša Stričević. See LICENSE.txt for
|
153
|
+
further details.
|
data/Rakefile
CHANGED
@@ -41,3 +41,12 @@ Rake::RDocTask.new do |rdoc|
|
|
41
41
|
rdoc.rdoc_files.include('README*')
|
42
42
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
43
43
|
end
|
44
|
+
|
45
|
+
require "mass_mandrill"
|
46
|
+
|
47
|
+
namespace :test do
|
48
|
+
desc "Send test email"
|
49
|
+
task :send_email, [:email] do |t, args|
|
50
|
+
MassMandrill::TestMailer.test_email(args[:email]).deliver
|
51
|
+
end
|
52
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
1.0.0
|
data/lib/mass_mandrill.rb
CHANGED
@@ -1,13 +1,3 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
|
5
|
-
module MassMandrill
|
6
|
-
def self.config
|
7
|
-
if block_given?
|
8
|
-
yield Config.instance
|
9
|
-
else
|
10
|
-
Config.instance
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
1
|
+
require "mass_mandrill/mandrill_mailer"
|
2
|
+
require "mass_mandrill/mandrill_mail"
|
3
|
+
require "mass_mandrill/test_mailer"
|
@@ -6,8 +6,8 @@ module MassMandrill
|
|
6
6
|
@template_name = template_name
|
7
7
|
end
|
8
8
|
|
9
|
-
def self.method_missing(method_name, *args)
|
10
|
-
new(method_name).send(method_name, *args)
|
9
|
+
def self.method_missing(method_name, *args, &block)
|
10
|
+
new(method_name).send(method_name, *args, &block)
|
11
11
|
end
|
12
12
|
|
13
13
|
def mail(options)
|
@@ -29,7 +29,7 @@ module MassMandrill
|
|
29
29
|
:preserve_recipients => options[:preserve_recipients],
|
30
30
|
:global_merge_vars => options[:global_merge_vars],
|
31
31
|
:merge_vars => options[:merge_vars]
|
32
|
-
}
|
32
|
+
}.merge(options[:message_extra] || {})
|
33
33
|
end
|
34
34
|
|
35
35
|
def to(addresses)
|
@@ -42,17 +42,17 @@ module MassMandrill
|
|
42
42
|
|
43
43
|
def from_email(from)
|
44
44
|
scan = scan_email(from)
|
45
|
-
scan
|
45
|
+
scan ? scan.first[1..-2] : from
|
46
46
|
end
|
47
47
|
|
48
48
|
def from_name(from)
|
49
|
-
|
49
|
+
if scan_email(from)
|
50
50
|
from.split(/\</).first.strip
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
54
|
def scan_email(from)
|
55
|
-
from.scan(/\<.*\>/)
|
55
|
+
from.scan(/\<.*\>/) if from
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module MassMandrill
|
2
|
+
class TestMailer < MandrillMailer
|
3
|
+
def test_email(email)
|
4
|
+
global_merge_vars = [{ name: "headline", content: "This is a test email" }]
|
5
|
+
merge_vars = [
|
6
|
+
{
|
7
|
+
:rcpt => email,
|
8
|
+
:vars => [{ :name => "first_name", :content => "John Doe" }]
|
9
|
+
}
|
10
|
+
]
|
11
|
+
|
12
|
+
template_content = [{ :name => "header", :content => "<h1>Hello World</h1>" }]
|
13
|
+
|
14
|
+
mail(to: [email],
|
15
|
+
from: "MassMandrill <mass_mandrill@example.com>",
|
16
|
+
subject: "This is a test email!",
|
17
|
+
template_content: template_content,
|
18
|
+
global_merge_vars: global_merge_vars,
|
19
|
+
merge_vars: merge_vars)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/mass_mandrill.gemspec
CHANGED
@@ -2,68 +2,66 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: mass_mandrill 1.0.0 ruby lib
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
7
8
|
s.name = "mass_mandrill"
|
8
|
-
s.version = "0.
|
9
|
+
s.version = "1.0.0"
|
9
10
|
|
10
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
11
13
|
s.authors = ["Trisignia", "Neboj\u{161}a Stri\u{10d}evi\u{107}"]
|
12
|
-
s.date = "
|
14
|
+
s.date = "2015-01-25"
|
13
15
|
s.description = "Send Mandrill template emails"
|
14
16
|
s.email = "nebojsa.stricevic@gmail.com"
|
15
17
|
s.extra_rdoc_files = [
|
16
18
|
"LICENSE.txt",
|
17
|
-
"README.
|
19
|
+
"README.md"
|
18
20
|
]
|
19
21
|
s.files = [
|
20
22
|
".document",
|
23
|
+
"CHANGELOG.md",
|
21
24
|
"Gemfile",
|
22
25
|
"Gemfile.lock",
|
23
26
|
"LICENSE.txt",
|
24
|
-
"README.
|
27
|
+
"README.md",
|
25
28
|
"Rakefile",
|
26
29
|
"VERSION",
|
27
30
|
"lib/mass_mandrill.rb",
|
28
|
-
"lib/mass_mandrill/config.rb",
|
29
31
|
"lib/mass_mandrill/mandrill_mail.rb",
|
30
32
|
"lib/mass_mandrill/mandrill_mailer.rb",
|
33
|
+
"lib/mass_mandrill/test_mailer.rb",
|
31
34
|
"mass_mandrill.gemspec",
|
32
|
-
"spec/mass_mandrill/config_spec.rb",
|
33
35
|
"spec/mass_mandrill/mandrill_mailer_spec.rb",
|
34
36
|
"spec/spec_helper.rb"
|
35
37
|
]
|
36
38
|
s.homepage = "https://github.com/trisignia/mass_mandrill"
|
37
39
|
s.licenses = ["MIT"]
|
38
|
-
s.
|
39
|
-
s.rubygems_version = "1.8.11"
|
40
|
+
s.rubygems_version = "2.2.2"
|
40
41
|
s.summary = "Send Mandrill emails"
|
41
42
|
|
42
43
|
if s.respond_to? :specification_version then
|
43
|
-
s.specification_version =
|
44
|
+
s.specification_version = 4
|
44
45
|
|
45
46
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
46
47
|
s.add_runtime_dependency(%q<mandrill-api>, ["~> 1.0.16"])
|
47
48
|
s.add_development_dependency(%q<rspec>, ["~> 2.13.0"])
|
48
|
-
s.add_development_dependency(%q<
|
49
|
+
s.add_development_dependency(%q<byebug>, ["~> 3.5.1"])
|
49
50
|
s.add_development_dependency(%q<rdoc>, ["~> 4.0.0"])
|
50
|
-
s.add_development_dependency(%q<jeweler>, ["~>
|
51
|
-
s.add_development_dependency(%q<bundler>, ["~> 1.3.3"])
|
51
|
+
s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
|
52
52
|
else
|
53
53
|
s.add_dependency(%q<mandrill-api>, ["~> 1.0.16"])
|
54
54
|
s.add_dependency(%q<rspec>, ["~> 2.13.0"])
|
55
|
-
s.add_dependency(%q<
|
55
|
+
s.add_dependency(%q<byebug>, ["~> 3.5.1"])
|
56
56
|
s.add_dependency(%q<rdoc>, ["~> 4.0.0"])
|
57
|
-
s.add_dependency(%q<jeweler>, ["~>
|
58
|
-
s.add_dependency(%q<bundler>, ["~> 1.3.3"])
|
57
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
59
58
|
end
|
60
59
|
else
|
61
60
|
s.add_dependency(%q<mandrill-api>, ["~> 1.0.16"])
|
62
61
|
s.add_dependency(%q<rspec>, ["~> 2.13.0"])
|
63
|
-
s.add_dependency(%q<
|
62
|
+
s.add_dependency(%q<byebug>, ["~> 3.5.1"])
|
64
63
|
s.add_dependency(%q<rdoc>, ["~> 4.0.0"])
|
65
|
-
s.add_dependency(%q<jeweler>, ["~>
|
66
|
-
s.add_dependency(%q<bundler>, ["~> 1.3.3"])
|
64
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
67
65
|
end
|
68
66
|
end
|
69
67
|
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mass_mandrill
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Trisignia
|
@@ -10,123 +9,123 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2015-01-25 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: mandrill-api
|
17
|
-
requirement:
|
18
|
-
none: false
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
19
17
|
requirements:
|
20
|
-
- - ~>
|
18
|
+
- - "~>"
|
21
19
|
- !ruby/object:Gem::Version
|
22
20
|
version: 1.0.16
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
|
-
version_requirements:
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 1.0.16
|
26
28
|
- !ruby/object:Gem::Dependency
|
27
29
|
name: rspec
|
28
|
-
requirement:
|
29
|
-
none: false
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
30
31
|
requirements:
|
31
|
-
- - ~>
|
32
|
+
- - "~>"
|
32
33
|
- !ruby/object:Gem::Version
|
33
34
|
version: 2.13.0
|
34
35
|
type: :development
|
35
36
|
prerelease: false
|
36
|
-
version_requirements:
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 2.13.0
|
37
42
|
- !ruby/object:Gem::Dependency
|
38
|
-
name:
|
39
|
-
requirement:
|
40
|
-
none: false
|
43
|
+
name: byebug
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
41
45
|
requirements:
|
42
|
-
- - ~>
|
46
|
+
- - "~>"
|
43
47
|
- !ruby/object:Gem::Version
|
44
|
-
version:
|
48
|
+
version: 3.5.1
|
45
49
|
type: :development
|
46
50
|
prerelease: false
|
47
|
-
version_requirements:
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 3.5.1
|
48
56
|
- !ruby/object:Gem::Dependency
|
49
57
|
name: rdoc
|
50
|
-
requirement:
|
51
|
-
none: false
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
52
59
|
requirements:
|
53
|
-
- - ~>
|
60
|
+
- - "~>"
|
54
61
|
- !ruby/object:Gem::Version
|
55
62
|
version: 4.0.0
|
56
63
|
type: :development
|
57
64
|
prerelease: false
|
58
|
-
version_requirements:
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 4.0.0
|
59
70
|
- !ruby/object:Gem::Dependency
|
60
71
|
name: jeweler
|
61
|
-
requirement:
|
62
|
-
none: false
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
63
73
|
requirements:
|
64
|
-
- - ~>
|
74
|
+
- - "~>"
|
65
75
|
- !ruby/object:Gem::Version
|
66
|
-
version:
|
76
|
+
version: 2.0.1
|
67
77
|
type: :development
|
68
78
|
prerelease: false
|
69
|
-
version_requirements:
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: bundler
|
72
|
-
requirement: &12911260 !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
80
|
requirements:
|
75
|
-
- - ~>
|
81
|
+
- - "~>"
|
76
82
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
78
|
-
type: :development
|
79
|
-
prerelease: false
|
80
|
-
version_requirements: *12911260
|
83
|
+
version: 2.0.1
|
81
84
|
description: Send Mandrill template emails
|
82
85
|
email: nebojsa.stricevic@gmail.com
|
83
86
|
executables: []
|
84
87
|
extensions: []
|
85
88
|
extra_rdoc_files:
|
86
89
|
- LICENSE.txt
|
87
|
-
- README.
|
90
|
+
- README.md
|
88
91
|
files:
|
89
|
-
- .document
|
92
|
+
- ".document"
|
93
|
+
- CHANGELOG.md
|
90
94
|
- Gemfile
|
91
95
|
- Gemfile.lock
|
92
96
|
- LICENSE.txt
|
93
|
-
- README.
|
97
|
+
- README.md
|
94
98
|
- Rakefile
|
95
99
|
- VERSION
|
96
100
|
- lib/mass_mandrill.rb
|
97
|
-
- lib/mass_mandrill/config.rb
|
98
101
|
- lib/mass_mandrill/mandrill_mail.rb
|
99
102
|
- lib/mass_mandrill/mandrill_mailer.rb
|
103
|
+
- lib/mass_mandrill/test_mailer.rb
|
100
104
|
- mass_mandrill.gemspec
|
101
|
-
- spec/mass_mandrill/config_spec.rb
|
102
105
|
- spec/mass_mandrill/mandrill_mailer_spec.rb
|
103
106
|
- spec/spec_helper.rb
|
104
107
|
homepage: https://github.com/trisignia/mass_mandrill
|
105
108
|
licenses:
|
106
109
|
- MIT
|
110
|
+
metadata: {}
|
107
111
|
post_install_message:
|
108
112
|
rdoc_options: []
|
109
113
|
require_paths:
|
110
114
|
- lib
|
111
115
|
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
-
none: false
|
113
116
|
requirements:
|
114
|
-
- -
|
117
|
+
- - ">="
|
115
118
|
- !ruby/object:Gem::Version
|
116
119
|
version: '0'
|
117
|
-
segments:
|
118
|
-
- 0
|
119
|
-
hash: -1726756761730565231
|
120
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
121
|
requirements:
|
123
|
-
- -
|
122
|
+
- - ">="
|
124
123
|
- !ruby/object:Gem::Version
|
125
124
|
version: '0'
|
126
125
|
requirements: []
|
127
126
|
rubyforge_project:
|
128
|
-
rubygems_version:
|
127
|
+
rubygems_version: 2.2.2
|
129
128
|
signing_key:
|
130
|
-
specification_version:
|
129
|
+
specification_version: 4
|
131
130
|
summary: Send Mandrill emails
|
132
131
|
test_files: []
|
data/README.markdown
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
mass_mandrill
|
2
|
-
=============
|
3
|
-
|
4
|
-
mass_mandrill is thin wrapper around mandrill-api gem that makes sending emails with Mandrill easier and more pleasent to use. Goal is to reasemble Rails' ActiveMailer API.
|
5
|
-
|
6
|
-
mass_mandrill supports bulk email sending and Mandrill templates. To learn more about these topics, visit [Mandrill Support](http://help.mandrill.com/home).
|
7
|
-
|
8
|
-
Example
|
9
|
-
-------
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
class ExampleMailer < MassMandrill::MandrillMailer
|
13
|
-
|
14
|
-
def example_notice(recipients)
|
15
|
-
addresses = recipients.map { |recipient| recipient.email }
|
16
|
-
global_merge_vars = [{ name: 'headline', content: 'This is first example notice' }]
|
17
|
-
merge_vars = recepients.map do |recipient|
|
18
|
-
{
|
19
|
-
:rcpt => recipient.email,
|
20
|
-
:vars => [{ :name => 'first_name', :content => recipient.first_name }]
|
21
|
-
}
|
22
|
-
end
|
23
|
-
template_content = [{ :name => 'header', :content => '<h1>Hello World</h1>' }]
|
24
|
-
|
25
|
-
mail(to: addresses,
|
26
|
-
from: 'John Doe <john.doe@example.com>',
|
27
|
-
subject: 'This is example notice!',
|
28
|
-
template_content: template_content,
|
29
|
-
global_merge_vars: global_merge_vars,
|
30
|
-
merge_vars: merge_vars)
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
```
|
35
|
-
|
36
|
-
And to send the email:
|
37
|
-
|
38
|
-
```ruby
|
39
|
-
users = User.all
|
40
|
-
ExampleMailer.example_notice(users).deliver
|
41
|
-
```
|
42
|
-
|
43
|
-
Name of the Mandrill template that's going to be used for sending is same as name of the method - in example above `example_notice`. To override template name, use `template` parameter:
|
44
|
-
|
45
|
-
```ruby
|
46
|
-
mail(to: addresses,
|
47
|
-
from: 'John Doe <john.doe@example.com>',
|
48
|
-
subject: 'This is example notice!',
|
49
|
-
template: 'some_other_template',
|
50
|
-
global_merge_vars: global_merge_vars,
|
51
|
-
merge_vars: merge_vars)
|
52
|
-
```
|
53
|
-
|
54
|
-
Install
|
55
|
-
-------
|
56
|
-
|
57
|
-
Add mass_mandrill to your Gemfile and bundle. And create Rails initializer with
|
58
|
-
your Mandrill API key:
|
59
|
-
|
60
|
-
```ruby
|
61
|
-
# config/initializers/mass_mandrill.rb
|
62
|
-
MassMandrill.config do |config|
|
63
|
-
config.api_key = 'YOUR_API_KEY'
|
64
|
-
end
|
65
|
-
```
|
66
|
-
|
67
|
-
Contributing to mandrill_template
|
68
|
-
---------------------------------
|
69
|
-
|
70
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
71
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
72
|
-
* Fork the project.
|
73
|
-
* Start a feature/bugfix branch.
|
74
|
-
* Commit and push until you are happy with your contribution.
|
75
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
76
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
77
|
-
|
78
|
-
Copyright
|
79
|
-
---------
|
80
|
-
|
81
|
-
Copyright (c) 2013 Trisignia, Nebojša Stričević. See LICENSE.txt for
|
82
|
-
further details.
|
data/lib/mass_mandrill/config.rb
DELETED