postageapp 1.0.17 → 1.0.18
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +8 -1
- data/README.md +111 -90
- data/VERSION +1 -1
- data/lib/postageapp/mailer/mailer_2.rb +7 -4
- data/lib/postageapp/mailer/mailer_3.rb +9 -4
- data/lib/postageapp/request.rb +2 -2
- data/postageapp.gemspec +3 -2
- data/test/gemfiles/Gemfile.rails-2.3.x +1 -1
- data/test/gemfiles/Gemfile.rails-3.0.x +1 -1
- data/test/gemfiles/Gemfile.rails-3.1.x +1 -1
- data/test/gemfiles/Gemfile.rails-3.2.x +12 -0
- data/test/mailer/action_mailer_2/notifier.rb +5 -3
- data/test/mailer/action_mailer_3/notifier.rb +4 -3
- data/test/mailer_2_test.rb +3 -2
- data/test/mailer_3_test.rb +15 -8
- data/test/request_test.rb +22 -22
- metadata +4 -3
data/.travis.yml
CHANGED
@@ -1,8 +1,15 @@
|
|
1
1
|
rvm:
|
2
2
|
- 1.8.7
|
3
3
|
- 1.9.2
|
4
|
+
- 1.9.3
|
4
5
|
- ree
|
6
|
+
- 2.0.0
|
5
7
|
gemfile:
|
6
8
|
- test/gemfiles/Gemfile.rails-2.3.x
|
7
9
|
- test/gemfiles/Gemfile.rails-3.0.x
|
8
|
-
- test/gemfiles/Gemfile.rails-3.1.x
|
10
|
+
- test/gemfiles/Gemfile.rails-3.1.x
|
11
|
+
- test/gemfiles/Gemfile.rails-3.2.x
|
12
|
+
matrix:
|
13
|
+
exclude:
|
14
|
+
- rvm: 2.0.0
|
15
|
+
gemfile: test/gemfiles/Gemfile.rails-2.3.x
|
data/README.md
CHANGED
@@ -36,32 +36,36 @@ You'll need to install the gem first:
|
|
36
36
|
|
37
37
|
And then it's as simple as doing something like this:
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
39
|
+
```ruby
|
40
|
+
require 'postageapp'
|
41
|
+
|
42
|
+
PostageApp.configure do |config|
|
43
|
+
config.api_key = 'PROJECT_API_KEY'
|
44
|
+
end
|
45
|
+
```
|
44
46
|
|
45
47
|
Usage
|
46
48
|
-----
|
47
49
|
Here's an example of sending a message ([See full API documentation](http://help.postageapp.com/faqs/api/send_message)):
|
48
50
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
51
|
+
```ruby
|
52
|
+
request = PostageApp::Request.new(:send_message, {
|
53
|
+
'headers' => { 'from' => 'sender@example.com',
|
54
|
+
'subject' => 'Email Subject' },
|
55
|
+
'recipients' => 'recipient@example.com',
|
56
|
+
'content' => {
|
57
|
+
'text/plain' => 'text email content',
|
58
|
+
'text/html' => 'html email content'
|
59
|
+
},
|
60
|
+
'attachments' => {
|
61
|
+
'document.pdf' => {
|
62
|
+
'content_type' => 'application/pdf',
|
63
|
+
'content' => Base64.encode64(File.open('/path/to/document.pdf', 'rb').read)
|
64
|
+
}
|
65
|
+
}
|
66
|
+
})
|
67
|
+
response = request.send
|
68
|
+
```
|
65
69
|
|
66
70
|
`PostageApp::Response` object allows you to check the status:
|
67
71
|
|
@@ -83,10 +87,12 @@ Response usually comes back with data:
|
|
83
87
|
### Recipient Override
|
84
88
|
Sometimes you don't want to send emails to real people in your application. For that there's an ability to override to what address all emails will be delivered. All you need to do is modify configuration block like this (in Rails projects it's usually found in `RAILS_ROOT/config/initializers/postageapp.rb`):
|
85
89
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
+
```ruby
|
91
|
+
PostageApp.configure do |config|
|
92
|
+
config.api_key = 'PROJECT_API_KEY'
|
93
|
+
config.recipient_override = 'you@example.com' unless Rails.env.production?
|
94
|
+
end
|
95
|
+
```
|
90
96
|
|
91
97
|
ActionMailer Integration
|
92
98
|
------------------------
|
@@ -104,74 +110,87 @@ Please note that `deliver` method will return `PostageApp::Response` object. Thi
|
|
104
110
|
|
105
111
|
Here's an example of a mailer in Rails 3 environment:
|
106
112
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
def signup_notification
|
112
|
-
|
113
|
-
attachments['example.zip'] = File.read('/path/to/example.zip')
|
114
|
-
|
115
|
-
headers['Special-Header'] = 'SpecialValue'
|
116
|
-
|
117
|
-
# PostageApp specific elements:
|
118
|
-
postageapp_template 'example_template'
|
119
|
-
postageapp_variables 'global_variable' => 'value'
|
120
|
-
|
121
|
-
mail(
|
122
|
-
:from => 'test@test.test',
|
123
|
-
:subject => 'Test Message',
|
124
|
-
:to => {
|
125
|
-
'recipient_1@example.com' => { 'variable' => 'value' },
|
126
|
-
'recipient_2@example.com' => { 'variable' => 'value' }
|
127
|
-
})
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
API of previous ActionMailer is partially supported under Rails 3 environment. Please note that it's not 100% integrated, some methods/syntax will not work. You may still define you mailers in this way (but really shouldn't):
|
113
|
+
```ruby
|
114
|
+
require 'postageapp/mailer'
|
115
|
+
|
116
|
+
class Notifier < PostageApp::Mailer
|
132
117
|
|
133
|
-
|
118
|
+
def signup_notification
|
134
119
|
|
135
|
-
|
120
|
+
attachments['example.zip'] = File.read('/path/to/example.zip')
|
136
121
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
122
|
+
headers['Special-Header'] = 'SpecialValue'
|
123
|
+
|
124
|
+
# PostageApp specific elements:
|
125
|
+
postageapp_template 'example_template'
|
126
|
+
postageapp_variables 'global_variable' => 'value'
|
127
|
+
|
128
|
+
# You may set api key for a specific mailers
|
129
|
+
postageapp_api_key '123456abcde'
|
130
|
+
|
131
|
+
# You can manually specify uid for the message payload.
|
132
|
+
# Make sure it's sufficiently unique.
|
133
|
+
postageapp_uid Digest::SHA1.hexdigest([@user.id, Time.now].to_s)
|
134
|
+
|
135
|
+
mail(
|
136
|
+
:from => 'test@test.test',
|
137
|
+
:subject => 'Test Message',
|
138
|
+
:to => {
|
139
|
+
'recipient_1@example.com' => { 'variable' => 'value' },
|
140
|
+
'recipient_2@example.com' => { 'variable' => 'value' }
|
141
|
+
})
|
142
|
+
end
|
143
|
+
end
|
144
|
+
```
|
145
|
+
|
146
|
+
API of previous ActionMailer is partially supported under Rails 3 environment. Please note that it's not 100% integrated, some methods/syntax will not work. You may still define you mailers in this way (but really shouldn't):
|
147
|
+
|
148
|
+
```ruby
|
149
|
+
require 'postageapp/mailer'
|
150
|
+
|
151
|
+
class Notifier < PostageApp::Mailer
|
152
|
+
|
153
|
+
def signup_notification
|
154
|
+
from 'sender@example.com'
|
155
|
+
subject 'Test Email'
|
156
|
+
recipients 'recipient@example.com'
|
157
|
+
end
|
158
|
+
end
|
159
|
+
```
|
143
160
|
|
144
161
|
### Rails 2.x
|
145
162
|
|
146
163
|
Here's an example of a mailer you'd set in in a Rails 2 environment:
|
164
|
+
|
165
|
+
```ruby
|
166
|
+
require 'postageapp/mailer'
|
167
|
+
|
168
|
+
class Notifier < PostageApp::Mailer
|
169
|
+
def signup_notification
|
170
|
+
|
171
|
+
from 'system@example.com'
|
172
|
+
subject 'New Account Information'
|
173
|
+
|
174
|
+
# Recipients can be in any format API allows.
|
175
|
+
# Here's an example of a hash format
|
176
|
+
recipients ({
|
177
|
+
'recipient_1@example.com' => { 'variable_name_1' => 'value',
|
178
|
+
'variable_name_2' => 'value' },
|
179
|
+
'recipient_2@example.com' => { 'variable_name_1' => 'value',
|
180
|
+
'variable_name_2' => 'value' },
|
181
|
+
})
|
182
|
+
|
183
|
+
attachment :content_type => 'application/zip',
|
184
|
+
:filename => 'example.zip',
|
185
|
+
:body => File.read('/path/to/example.zip')
|
186
|
+
|
187
|
+
# PostageApp specific elements:
|
188
|
+
postageapp_template 'example_template'
|
189
|
+
postageapp_variables 'global_variable' => 'value'
|
147
190
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
def signup_notification
|
152
|
-
|
153
|
-
from 'system@example.com'
|
154
|
-
subject 'New Account Information'
|
155
|
-
|
156
|
-
# Recipients can be in any format API allows.
|
157
|
-
# Here's an example of a hash format
|
158
|
-
recipients ({
|
159
|
-
'recipient_1@example.com' => { 'variable_name_1' => 'value',
|
160
|
-
'variable_name_2' => 'value' },
|
161
|
-
'recipient_2@example.com' => { 'variable_name_1' => 'value',
|
162
|
-
'variable_name_2' => 'value' },
|
163
|
-
})
|
164
|
-
|
165
|
-
attachment :content_type => 'application/zip',
|
166
|
-
:filename => 'example.zip',
|
167
|
-
:body => File.read('/path/to/example.zip')
|
168
|
-
|
169
|
-
# PostageApp specific elements:
|
170
|
-
postageapp_template 'example_template'
|
171
|
-
postageapp_variables 'global_variable' => 'value'
|
172
|
-
|
173
|
-
end
|
174
|
-
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
```
|
175
194
|
|
176
195
|
Automatic resending in case of failure
|
177
196
|
--------------------------------------
|
@@ -179,11 +198,13 @@ For those ultra rare occasions when api.postageapp.com is not reachable this gem
|
|
179
198
|
|
180
199
|
For projects other than Rails you'll need to tell where there project_root is at:
|
181
200
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
201
|
+
```ruby
|
202
|
+
PostageApp.configure do |config|
|
203
|
+
config.api_key = 'PROJECT_API_KEY'
|
204
|
+
config.project_root = "/path/to/your/project"
|
205
|
+
end
|
206
|
+
```
|
186
207
|
|
187
208
|
Copyright
|
188
209
|
---------
|
189
|
-
(C) 2011 Oleg Khabarov, [The Working Group, Inc](http://www.twg.ca/)
|
210
|
+
(C) 2011-13 Oleg Khabarov, [The Working Group, Inc](http://www.twg.ca/)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.18
|
@@ -29,9 +29,10 @@ class PostageApp::Mailer < ActionMailer::Base
|
|
29
29
|
# Using :test as a delivery method if set somewhere else
|
30
30
|
self.delivery_method = :postage unless (self.delivery_method == :test)
|
31
31
|
|
32
|
+
adv_attr_accessor :postageapp_uid
|
33
|
+
adv_attr_accessor :postageapp_api_key
|
32
34
|
adv_attr_accessor :postageapp_template
|
33
35
|
adv_attr_accessor :postageapp_variables
|
34
|
-
adv_attr_accessor :postageapp_api_key
|
35
36
|
|
36
37
|
def perform_delivery_postage(mail)
|
37
38
|
mail.send
|
@@ -72,15 +73,17 @@ class PostageApp::Mailer < ActionMailer::Base
|
|
72
73
|
end
|
73
74
|
end
|
74
75
|
|
75
|
-
params['template']
|
76
|
+
params['template'] = self.postageapp_template unless self.postageapp_template.blank?
|
76
77
|
params['variables'] = self.postageapp_variables unless self.postageapp_variables.blank?
|
77
|
-
params['api_key'] = self.postageapp_api_key unless self.postageapp_api_key.blank?
|
78
78
|
|
79
79
|
params.delete('headers') if params['headers'].blank?
|
80
80
|
params.delete('content') if params['content'].blank?
|
81
81
|
params.delete('attachments') if params['attachments'].blank?
|
82
82
|
|
83
|
-
@mail = PostageApp::Request.new(
|
83
|
+
@mail = PostageApp::Request.new('send_message', params)
|
84
|
+
@mail.uid = self.postageapp_uid unless self.postageapp_uid.blank?
|
85
|
+
@mail.api_key = self.postageapp_api_key unless self.postageapp_api_key.blank?
|
86
|
+
@mail
|
84
87
|
end
|
85
88
|
|
86
89
|
# Not insisting rendering a view if it's not there. PostageApp gem can send blank content
|
@@ -64,6 +64,15 @@ class PostageApp::Mailer < ActionMailer::Base
|
|
64
64
|
process(method_name, *args) if method_name
|
65
65
|
end
|
66
66
|
|
67
|
+
# Possible to define custom uid. Should be sufficiently unique
|
68
|
+
def postageapp_uid(value = nil)
|
69
|
+
value ? @_message.uid = value : @_message.uid
|
70
|
+
end
|
71
|
+
|
72
|
+
def postageapp_api_key(value = nil)
|
73
|
+
value ? @_message.api_key = value : @_message.api_key
|
74
|
+
end
|
75
|
+
|
67
76
|
# In API call we can specify PostageApp template that will be used
|
68
77
|
# to generate content of the message
|
69
78
|
def postageapp_template(value = nil)
|
@@ -75,10 +84,6 @@ class PostageApp::Mailer < ActionMailer::Base
|
|
75
84
|
value ? @_message.arguments['variables'] = value : @_message.arguments['variables']
|
76
85
|
end
|
77
86
|
|
78
|
-
def postageapp_api_key(value = nil)
|
79
|
-
value ? @_message.arguments['api_key'] = value : @_message.arguments['api_key']
|
80
|
-
end
|
81
|
-
|
82
87
|
def attachments
|
83
88
|
@_attachments ||= Attachments.new(@_message)
|
84
89
|
end
|
data/lib/postageapp/request.rb
CHANGED
@@ -22,8 +22,8 @@ class PostageApp::Request
|
|
22
22
|
|
23
23
|
def initialize(method, arguments = {})
|
24
24
|
@method = method
|
25
|
-
@uid = arguments.delete(
|
26
|
-
@api_key = arguments.delete(
|
25
|
+
@uid = arguments.delete('uid')
|
26
|
+
@api_key = arguments.delete('api_key') || PostageApp.configuration.api_key
|
27
27
|
@arguments = arguments
|
28
28
|
end
|
29
29
|
|
data/postageapp.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "postageapp"
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.18"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Oleg Khabarov, The Working Group Inc"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2013-03-07"
|
13
13
|
s.description = "Gem that interfaces with PostageApp.com service to send emails from web apps"
|
14
14
|
s.email = "oleg@twg.ca"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -47,6 +47,7 @@ Gem::Specification.new do |s|
|
|
47
47
|
"test/gemfiles/Gemfile.rails-2.3.x",
|
48
48
|
"test/gemfiles/Gemfile.rails-3.0.x",
|
49
49
|
"test/gemfiles/Gemfile.rails-3.1.x",
|
50
|
+
"test/gemfiles/Gemfile.rails-3.2.x",
|
50
51
|
"test/helper.rb",
|
51
52
|
"test/live_test.rb",
|
52
53
|
"test/mailer/action_mailer_2/notifier.rb",
|
@@ -42,6 +42,11 @@ class Notifier < PostageApp::Mailer
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def with_custom_postage_variables
|
45
|
+
postageapp_template 'test-template'
|
46
|
+
postageapp_variables 'variable' => 'value'
|
47
|
+
postageapp_uid 'custom_uid'
|
48
|
+
postageapp_api_key 'custom_api_key'
|
49
|
+
|
45
50
|
from 'test@test.test'
|
46
51
|
subject 'Test Email'
|
47
52
|
|
@@ -49,9 +54,6 @@ class Notifier < PostageApp::Mailer
|
|
49
54
|
'test1@test.text' => { 'name' => 'Test 1' },
|
50
55
|
'test2@test.text' => { 'name' => 'Test 2' }
|
51
56
|
})
|
52
|
-
postageapp_template 'test-template'
|
53
|
-
postageapp_variables 'variable' => 'value'
|
54
|
-
postageapp_api_key 'custom_api_key'
|
55
57
|
end
|
56
58
|
|
57
59
|
private
|
@@ -47,9 +47,10 @@ class Notifier < PostageApp::Mailer
|
|
47
47
|
headers['CustomHeader1'] = 'CustomValue1'
|
48
48
|
headers 'CustomHeader2' => 'CustomValue2'
|
49
49
|
|
50
|
-
postageapp_template
|
51
|
-
postageapp_variables
|
52
|
-
postageapp_api_key
|
50
|
+
postageapp_template 'test-template'
|
51
|
+
postageapp_variables 'variable' => 'value'
|
52
|
+
postageapp_api_key 'custom_api_key'
|
53
|
+
postageapp_uid 'custom_uid'
|
53
54
|
|
54
55
|
mail(
|
55
56
|
:from => 'test@test.test',
|
data/test/mailer_2_test.rb
CHANGED
@@ -10,7 +10,7 @@ class Mailer2Test < Test::Unit::TestCase
|
|
10
10
|
|
11
11
|
def test_create_blank
|
12
12
|
assert mail = Notifier.create_blank
|
13
|
-
assert_equal
|
13
|
+
assert_equal 'send_message', mail.method
|
14
14
|
assert_equal 'https://api.postageapp.com/v.1.0/send_message.json', mail.url.to_s
|
15
15
|
assert mail.arguments.blank?
|
16
16
|
end
|
@@ -67,8 +67,9 @@ class Mailer2Test < Test::Unit::TestCase
|
|
67
67
|
|
68
68
|
def test_create_with_custom_postage_variables
|
69
69
|
assert mail = Notifier.create_with_custom_postage_variables
|
70
|
+
assert_equal 'custom_uid', mail.uid
|
71
|
+
assert_equal 'custom_api_key', mail.api_key
|
70
72
|
assert_equal 'test-template', mail.arguments['template']
|
71
|
-
assert_equal 'custom_api_key', mail.arguments['api_key']
|
72
73
|
assert_equal ({ 'variable' => 'value' }), mail.arguments['variables']
|
73
74
|
assert_equal ({ 'test2@test.text' => { 'name' => 'Test 2'},
|
74
75
|
'test1@test.text' => { 'name' => 'Test 1'}}), mail.arguments['recipients']
|
data/test/mailer_3_test.rb
CHANGED
@@ -53,17 +53,24 @@ class Mailer3Test < Test::Unit::TestCase
|
|
53
53
|
|
54
54
|
def test_create_with_custom_postage_variables
|
55
55
|
mail = Notifier.with_custom_postage_variables
|
56
|
+
args = mail.arguments_to_send
|
57
|
+
|
58
|
+
assert_equal 'custom_uid', args['uid']
|
59
|
+
assert_equal 'custom_api_key', args['api_key']
|
60
|
+
|
61
|
+
args = args['arguments']
|
62
|
+
|
56
63
|
assert_equal ({
|
57
64
|
'test1@test.test' => { 'name' => 'Test 1'},
|
58
65
|
'test2@test.test' => { 'name' => 'Test 2'}
|
59
|
-
}),
|
60
|
-
|
61
|
-
assert_equal
|
62
|
-
assert_equal '
|
63
|
-
assert_equal 'CustomValue1',
|
64
|
-
assert_equal 'CustomValue2',
|
65
|
-
assert_equal 'text content',
|
66
|
-
assert_equal 'with layout html content',
|
66
|
+
}), args['recipients']
|
67
|
+
|
68
|
+
assert_equal 'test-template', args['template']
|
69
|
+
assert_equal ({ 'variable' => 'value' }), args['variables']
|
70
|
+
assert_equal 'CustomValue1', args['headers']['CustomHeader1']
|
71
|
+
assert_equal 'CustomValue2', args['headers']['CustomHeader2']
|
72
|
+
assert_equal 'text content', args['content']['text/plain']
|
73
|
+
assert_equal 'with layout html content', args['content']['text/html']
|
67
74
|
end
|
68
75
|
|
69
76
|
def test_create_with_recipient_override
|
data/test/request_test.rb
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path('../helper', __FILE__)
|
|
3
3
|
class RequestTest < Test::Unit::TestCase
|
4
4
|
|
5
5
|
def test_method_uid
|
6
|
-
request = PostageApp::Request.new(
|
6
|
+
request = PostageApp::Request.new('test_method')
|
7
7
|
uid = request.uid
|
8
8
|
assert_match /^\w{40}$/, uid
|
9
9
|
assert_equal uid, request.uid
|
@@ -11,20 +11,20 @@ class RequestTest < Test::Unit::TestCase
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def test_method_url
|
14
|
-
request = PostageApp::Request.new(
|
14
|
+
request = PostageApp::Request.new('test_method')
|
15
15
|
assert_equal 'api.postageapp.com', request.url.host
|
16
16
|
assert_equal 443, request.url.port
|
17
17
|
assert_equal '/v.1.0/test_method.json', request.url.path
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_method_arguments_to_send
|
21
|
-
request = PostageApp::Request.new(
|
22
|
-
|
23
|
-
|
21
|
+
request = PostageApp::Request.new('send_message', {
|
22
|
+
'headers' => { 'from' => 'sender@test.test',
|
23
|
+
'subject' => 'Test Message' },
|
24
24
|
'recipients' => 'test@test.test',
|
25
|
-
|
25
|
+
'content' => {
|
26
26
|
'text/plain' => 'text content',
|
27
|
-
|
27
|
+
'text/html' => 'html content'
|
28
28
|
}
|
29
29
|
})
|
30
30
|
args = request.arguments_to_send
|
@@ -46,33 +46,33 @@ class RequestTest < Test::Unit::TestCase
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def test_uid_is_enforceable
|
49
|
-
request = PostageApp::Request.new(
|
49
|
+
request = PostageApp::Request.new('test_method')
|
50
50
|
assert_match /^\w{40}$/, request.arguments_to_send['uid']
|
51
51
|
|
52
52
|
request.uid = 'my_uid'
|
53
53
|
assert_equal 'my_uid', request.arguments_to_send['uid']
|
54
54
|
|
55
|
-
request = PostageApp::Request.new(
|
55
|
+
request = PostageApp::Request.new('test_method', 'uid' => 'new_uid', 'data' => 'value')
|
56
56
|
assert_equal 'new_uid', request.uid
|
57
|
-
assert_equal ({
|
57
|
+
assert_equal ({'data' => 'value'}), request.arguments
|
58
58
|
end
|
59
59
|
|
60
60
|
def test_api_key
|
61
|
-
request = PostageApp::Request.new(
|
61
|
+
request = PostageApp::Request.new('test_method')
|
62
62
|
assert_equal PostageApp.configuration.api_key, request.api_key
|
63
63
|
|
64
|
-
request = PostageApp::Request.new(
|
64
|
+
request = PostageApp::Request.new('test_method', {'api_key' => 'custom_api_key'})
|
65
65
|
assert_equal 'custom_api_key', request.api_key
|
66
66
|
end
|
67
67
|
|
68
68
|
def test_send
|
69
69
|
mock_successful_send
|
70
70
|
|
71
|
-
request = PostageApp::Request.new(
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
71
|
+
request = PostageApp::Request.new('send_message', {
|
72
|
+
'headers' => { 'from' => 'sender@test.test',
|
73
|
+
'subject' => 'Test Message'},
|
74
|
+
'recipients' => 'test@test.test',
|
75
|
+
'content' => {
|
76
76
|
'text/plain' => 'text content',
|
77
77
|
'text/html' => 'html content'
|
78
78
|
}
|
@@ -86,11 +86,11 @@ class RequestTest < Test::Unit::TestCase
|
|
86
86
|
def test_send_failure
|
87
87
|
mock_failed_send
|
88
88
|
|
89
|
-
request = PostageApp::Request.new(
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
89
|
+
request = PostageApp::Request.new('send_message', {
|
90
|
+
'headers' => { 'from' => 'sender@test.test',
|
91
|
+
'subject' => 'Test Message'},
|
92
|
+
'recipients' => 'test@test.test',
|
93
|
+
'content' => {
|
94
94
|
'text/plain' => 'text content',
|
95
95
|
'text/html' => 'html content'
|
96
96
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postageapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.18
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-03-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
@@ -82,6 +82,7 @@ files:
|
|
82
82
|
- test/gemfiles/Gemfile.rails-2.3.x
|
83
83
|
- test/gemfiles/Gemfile.rails-3.0.x
|
84
84
|
- test/gemfiles/Gemfile.rails-3.1.x
|
85
|
+
- test/gemfiles/Gemfile.rails-3.2.x
|
85
86
|
- test/helper.rb
|
86
87
|
- test/live_test.rb
|
87
88
|
- test/mailer/action_mailer_2/notifier.rb
|
@@ -124,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
124
125
|
version: '0'
|
125
126
|
segments:
|
126
127
|
- 0
|
127
|
-
hash:
|
128
|
+
hash: -4042654405162661992
|
128
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
130
|
none: false
|
130
131
|
requirements:
|