sendwithus_ruby_action_mailer 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NzUwYzU2NmY1ZGQ1YWNkZTVmZGU4ODcwNDM4NjNjYzQ5MDQxY2VhOQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NDU4Zjc5OWU0YmRkMTM3N2U2YmRkZGMxZTIyZTM1ZmI5OGI3ZWMyZg==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YWRiNDQ4Y2QwNzRkYzAxOTAyZDY2ODlkMzExNzQ3ZTc0MzAwOTc5YzU3ZjAx
|
10
|
+
NGFkOTViNDY2ODc2ODY1NGE4ZWQxZDgxNTM0ZGJiMmQzOGRjZjM2MWJlODQy
|
11
|
+
ZWQ2MmNhMDk4ZjFiMjY3ODQ0OTY3NDZhNWJhMjQxMTBhNGM2MmM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MWUxYjg0N2MwNzEwYmFmZjMxZWFhZGM0NTYwYzdkN2Y1YTY1ODQwNmUxYjc3
|
14
|
+
Zjk5OWRmOTY1YTQ2MzBhYzZhNmIzMzkwMmIxNTE0ODViOTI4NDMwY2Y3NWQ1
|
15
|
+
YjFhY2MzN2NmZTIzNjAzMWNmYWJkOWZhMjZiMTM3ZDM3ZDBmMzk=
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
#
|
1
|
+
# sendwithus Ruby Action Mailer
|
2
2
|
|
3
|
-
[
|
4
|
-
the email content from your app.
|
5
|
-
|
3
|
+
[sendwithus](http://sendwithus.com) is a service that provides a convenient way for non-developers
|
4
|
+
to create and edit the email content from your app. sendwithus has created a gem, `send_with_us`,
|
5
|
+
that communicates with our REST API for sending templated emails.
|
6
6
|
|
7
7
|
Ruby on Rails developers are familiar with the ActionMailer interface for sending email. This
|
8
8
|
gem implements a small layer over the `send_with_us` gem that provides and ActionMailer-like API.
|
@@ -23,7 +23,17 @@ Or install it yourself as:
|
|
23
23
|
|
24
24
|
## Setup
|
25
25
|
|
26
|
-
|
26
|
+
### Rails
|
27
|
+
|
28
|
+
For a Rails app, create `send_with_us.rb` in `/config/initializers/`
|
29
|
+
with the following:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
SendWithUs::Api.configure do |config|
|
33
|
+
config.api_key = 'YOUR API KEY'
|
34
|
+
config.debug = true
|
35
|
+
end
|
36
|
+
```
|
27
37
|
|
28
38
|
## Usage
|
29
39
|
|
@@ -37,7 +47,20 @@ class Notifier < SendWithUsMailer::Base
|
|
37
47
|
|
38
48
|
def welcome(recipient)
|
39
49
|
assign(:account, recipient)
|
40
|
-
|
50
|
+
|
51
|
+
assign(:captain_name, recipient.name)
|
52
|
+
#=> in sendwithus email template {{ captain_name }}
|
53
|
+
assign :team, {team_name: recipient.team_name, captain: recipient.name}
|
54
|
+
#=> in sendwithus email template {{ team.team_name }} and {{ team.captain }}
|
55
|
+
|
56
|
+
mail(
|
57
|
+
email_id: 'ID-CODE-FROM-SEND-WITH-US',
|
58
|
+
recipient_address: recipient.email,
|
59
|
+
from_name: 'Billing',
|
60
|
+
from_address: 'billing@example.com',
|
61
|
+
reply_to: 'support@example.com',
|
62
|
+
bcc: [{:address => "name@example.com"},{:address => "name2@example.com"}],
|
63
|
+
version_name: 'en-US')
|
41
64
|
end
|
42
65
|
end
|
43
66
|
`````
|
@@ -55,7 +78,7 @@ Once a mailer action is defined, you can deliver your message or create it and s
|
|
55
78
|
for delivery later:
|
56
79
|
|
57
80
|
`````Ruby
|
58
|
-
Notifier.welcome(
|
81
|
+
Notifier.welcome(nick).deliver # sends the email
|
59
82
|
|
60
83
|
mail = Notifier.welcome(david) # => a SendWithUsMailer::MailParams object
|
61
84
|
mail.deliver # sends the email
|
@@ -8,6 +8,9 @@ module SendWithUsMailer
|
|
8
8
|
@email_data = {}
|
9
9
|
@to = {}
|
10
10
|
@from = {}
|
11
|
+
@cc = []
|
12
|
+
@bcc = []
|
13
|
+
@version_name = ""
|
11
14
|
end
|
12
15
|
|
13
16
|
def assign(key, value) #:nodoc:
|
@@ -29,6 +32,12 @@ module SendWithUsMailer
|
|
29
32
|
@from.merge!(address: value)
|
30
33
|
when :reply_to
|
31
34
|
@from.merge!(reply_to: value)
|
35
|
+
when :cc
|
36
|
+
@cc.concat(value)
|
37
|
+
when :bcc
|
38
|
+
@bcc.concat(value)
|
39
|
+
when :version_name
|
40
|
+
@version_name = value
|
32
41
|
end
|
33
42
|
end
|
34
43
|
end
|
@@ -40,7 +49,7 @@ module SendWithUsMailer
|
|
40
49
|
# In particular, the +api_key+ must be set (following the guidelines in the
|
41
50
|
# +send_with_us+ documentation).
|
42
51
|
def deliver
|
43
|
-
SendWithUs::Api.new.send_with(@email_id, @to, @email_data, @from)
|
52
|
+
SendWithUs::Api.new.send_with(@email_id, @to, @email_data, @from, @cc, @bcc, [], "", @version_name)
|
44
53
|
end
|
45
54
|
end
|
46
55
|
end
|
@@ -23,11 +23,12 @@ describe SendWithUsMailer do
|
|
23
23
|
describe "more mail options" do
|
24
24
|
class MoreOptionsMailer < SendWithUsMailer::Base
|
25
25
|
def example_email
|
26
|
-
mail email_id: '
|
26
|
+
mail email_id: 'tem_9YvYsaLW2Mw4tmPiLcVvpC',
|
27
27
|
to: 'adave@example.com',
|
28
28
|
from_address: 'asender@company.com',
|
29
29
|
from_name: 'asender',
|
30
|
-
reply_to: 'ano-reply@company.com'
|
30
|
+
reply_to: 'ano-reply@company.com',
|
31
|
+
version_name: 'v2'
|
31
32
|
end
|
32
33
|
end
|
33
34
|
|
@@ -109,4 +110,4 @@ describe SendWithUsMailer do
|
|
109
110
|
})
|
110
111
|
end
|
111
112
|
end
|
112
|
-
end
|
113
|
+
end
|
metadata
CHANGED
@@ -1,75 +1,74 @@
|
|
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.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicholas Rempel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-10 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
19
|
version: '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
26
|
version: '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
|
-
|
72
|
-
mailer API similar to the ActionMailer railtie.
|
69
|
+
description: ! "A convenient way to use the Send With Us email\n service with a
|
70
|
+
Ruby on Rails app. SendWilthUsMailer implements a\n mailer API similar to the
|
71
|
+
ActionMailer railtie."
|
73
72
|
email:
|
74
73
|
- nick@sendwithus.com
|
75
74
|
executables: []
|
@@ -100,17 +99,17 @@ require_paths:
|
|
100
99
|
- lib
|
101
100
|
required_ruby_version: !ruby/object:Gem::Requirement
|
102
101
|
requirements:
|
103
|
-
- - '>='
|
102
|
+
- - ! '>='
|
104
103
|
- !ruby/object:Gem::Version
|
105
104
|
version: '0'
|
106
105
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
106
|
requirements:
|
108
|
-
- - '>='
|
107
|
+
- - ! '>='
|
109
108
|
- !ruby/object:Gem::Version
|
110
109
|
version: '0'
|
111
110
|
requirements: []
|
112
111
|
rubyforge_project:
|
113
|
-
rubygems_version: 2.
|
112
|
+
rubygems_version: 2.2.2
|
114
113
|
signing_key:
|
115
114
|
specification_version: 4
|
116
115
|
summary: An ActionMailer look alike for Send With Us.
|