postageapp 1.0.23 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +3 -1
- data/Gemfile +1 -0
- data/LICENSE +1 -1
- data/README.md +16 -15
- data/lib/postageapp/request.rb +11 -3
- data/lib/postageapp/version.rb +1 -1
- data/postageapp.gemspec +4 -3
- data/test/configuration_test.rb +1 -1
- data/test/failed_request_test.rb +2 -3
- data/test/gemfiles/Gemfile.rails-2.3.x +1 -0
- data/test/gemfiles/Gemfile.rails-3.0.x +1 -0
- data/test/gemfiles/Gemfile.rails-3.1.x +1 -0
- data/test/gemfiles/Gemfile.rails-3.2.x +1 -0
- data/test/gemfiles/Gemfile.rails-4.0.x +1 -0
- data/test/helper.rb +10 -8
- data/test/live_test.rb +10 -9
- data/test/mailer_2_test.rb +8 -7
- data/test/mailer_3_test.rb +26 -11
- data/test/mailer_4_test.rb +7 -6
- data/test/mailer_helper_methods_test.rb +1 -1
- data/test/postageapp_test.rb +1 -1
- data/test/rails_initialization_test.rb +1 -1
- data/test/request_test.rb +40 -18
- data/test/response_test.rb +1 -1
- metadata +18 -11
- checksums.yaml +0 -7
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -158,6 +158,21 @@ class Notifier < PostageApp::Mailer
|
|
158
158
|
end
|
159
159
|
```
|
160
160
|
|
161
|
+
#### Interceptors
|
162
|
+
|
163
|
+
Here's an example of using an interceptor
|
164
|
+
|
165
|
+
```ruby
|
166
|
+
class DevelopmentPostageappInterceptor
|
167
|
+
def self.delivering_email(postageapp_msg)
|
168
|
+
postageapp_msg.arguments["headers"][:subject] =
|
169
|
+
"[#{postageapp_msg.arguments["recipients"]}] #{postageapp_msg.arguments["headers"][:subject]}"
|
170
|
+
postageapp_msg.arguments["recipients"] = "test@example.com"
|
171
|
+
# postageapp_msg.perform_deliveries = false
|
172
|
+
end
|
173
|
+
end
|
174
|
+
```
|
175
|
+
|
161
176
|
### Rails 2
|
162
177
|
|
163
178
|
Here's an example of a mailer you'd set in in a Rails 2 environment:
|
@@ -205,20 +220,6 @@ PostageApp.configure do |config|
|
|
205
220
|
end
|
206
221
|
```
|
207
222
|
|
208
|
-
Interceptors (Rails 3)
|
209
|
-
----------------------
|
210
|
-
Here's an example of using an interceptor
|
211
|
-
|
212
|
-
```ruby
|
213
|
-
class DevelopmentPostageappInterceptor
|
214
|
-
def self.delivering_email(postageapp_msg)
|
215
|
-
postageapp_msg.arguments["headers"][:subject] = "[#{postageapp_msg.arguments["recipients"]}] #{postageapp_msg.arguments["headers"][:subject]}"
|
216
|
-
postageapp_msg.arguments["recipients"] = "test@example.com"
|
217
|
-
# postageapp_msg.perform_deliveries = false
|
218
|
-
end
|
219
|
-
end
|
220
|
-
```
|
221
|
-
|
222
223
|
Copyright
|
223
224
|
---------
|
224
|
-
(C) 2011-
|
225
|
+
(C) 2011-2014 Oleg Khabarov, [The Working Group, Inc](http://www.twg.ca/)
|
data/lib/postageapp/request.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
class PostageApp::Request
|
2
|
-
|
3
2
|
API_VERSION = '1.0'
|
4
3
|
|
5
4
|
HEADERS = {
|
@@ -67,7 +66,17 @@ class PostageApp::Request
|
|
67
66
|
|
68
67
|
response
|
69
68
|
end
|
69
|
+
|
70
|
+
# Emulates Mail::Message#html_part
|
71
|
+
def html_part
|
72
|
+
self.arguments && self.arguments['content'] && self.arguments['content']['text/html']
|
73
|
+
end
|
70
74
|
|
75
|
+
# Emulates Mail::Message#text_part
|
76
|
+
def text_part
|
77
|
+
self.arguments && self.arguments['content'] && self.arguments['content']['text/plain']
|
78
|
+
end
|
79
|
+
|
71
80
|
# URL of the where PostageApp::Request will be directed at
|
72
81
|
def url
|
73
82
|
URI.parse("#{PostageApp.configuration.url}/v.#{API_VERSION}/#{self.method}.json")
|
@@ -91,5 +100,4 @@ class PostageApp::Request
|
|
91
100
|
end
|
92
101
|
hash
|
93
102
|
end
|
94
|
-
|
95
|
-
end
|
103
|
+
end
|
data/lib/postageapp/version.rb
CHANGED
data/postageapp.gemspec
CHANGED
@@ -6,15 +6,16 @@ require 'postageapp/version'
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "postageapp"
|
8
8
|
s.version = PostageApp::VERSION
|
9
|
-
s.authors = ["Oleg Khabarov", "The Working Group Inc"]
|
10
|
-
s.email = ["oleg@khabarov.ca"]
|
9
|
+
s.authors = ["Oleg Khabarov", "Scott Tadman", "The Working Group Inc."]
|
10
|
+
s.email = ["oleg@khabarov.ca", "scott@twg.ca"]
|
11
11
|
s.homepage = "http://github.com/postageapp/postageapp-ruby"
|
12
12
|
s.summary = "Easier way to send email from web apps"
|
13
13
|
s.description = "Gem that interfaces with PostageApp.com service to send emails from web apps"
|
14
|
+
s.license = 'MIT'
|
14
15
|
|
15
16
|
s.files = `git ls-files`.split("\n")
|
16
17
|
s.platform = Gem::Platform::RUBY
|
17
18
|
s.require_paths = ['lib']
|
18
19
|
|
19
20
|
s.add_dependency 'json'
|
20
|
-
end
|
21
|
+
end
|
data/test/configuration_test.rb
CHANGED
data/test/failed_request_test.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require File.expand_path('../helper', __FILE__)
|
2
2
|
|
3
|
-
class FailedRequestTest < Test
|
4
|
-
|
3
|
+
class FailedRequestTest < Minitest::Test
|
5
4
|
def setup
|
6
5
|
super
|
7
6
|
PostageApp.configuration.project_root = File.expand_path('../', __FILE__)
|
@@ -103,4 +102,4 @@ class FailedRequestTest < Test::Unit::TestCase
|
|
103
102
|
|
104
103
|
assert File.exists?(file_path)
|
105
104
|
end
|
106
|
-
end
|
105
|
+
end
|
data/test/helper.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
|
2
|
+
|
3
|
+
gem 'minitest'
|
4
|
+
require 'minitest/autorun'
|
5
|
+
|
3
6
|
require 'fileutils'
|
4
7
|
|
5
8
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
@@ -10,10 +13,10 @@ require 'postageapp/mailer'
|
|
10
13
|
|
11
14
|
require 'mocha/setup'
|
12
15
|
|
13
|
-
class Test
|
14
|
-
|
16
|
+
class Minitest::Test
|
15
17
|
def setup
|
16
|
-
#
|
18
|
+
# Resetting to default configuration
|
19
|
+
|
17
20
|
PostageApp.configure do |config|
|
18
21
|
config.api_key = '1234567890abcdef'
|
19
22
|
config.secure = true
|
@@ -33,6 +36,8 @@ class Test::Unit::TestCase
|
|
33
36
|
config.logger = nil
|
34
37
|
config.framework = 'undefined framework'
|
35
38
|
end
|
39
|
+
|
40
|
+
ActionMailer::Base.deliveries.clear
|
36
41
|
end
|
37
42
|
|
38
43
|
def mock_successful_send(status = 'ok')
|
@@ -51,14 +56,12 @@ class Test::Unit::TestCase
|
|
51
56
|
def mock_failed_send
|
52
57
|
Net::HTTP.any_instance.stubs(:post).returns(nil)
|
53
58
|
end
|
54
|
-
|
55
59
|
end
|
56
60
|
|
57
61
|
# Setting up constants just for the duration of the test
|
58
62
|
module ConstantDefinitions
|
59
|
-
|
60
63
|
def setup
|
61
|
-
@defined_constants = []
|
64
|
+
@defined_constants = [ ]
|
62
65
|
end
|
63
66
|
|
64
67
|
def teardown
|
@@ -71,5 +74,4 @@ module ConstantDefinitions
|
|
71
74
|
Object.const_set(name, value)
|
72
75
|
@defined_constants << name
|
73
76
|
end
|
74
|
-
|
75
77
|
end
|
data/test/live_test.rb
CHANGED
@@ -1,16 +1,13 @@
|
|
1
1
|
require File.expand_path('../helper', __FILE__)
|
2
2
|
|
3
|
-
class LiveTest < Test
|
4
|
-
|
3
|
+
class LiveTest < Minitest::Test
|
5
4
|
# Note: Need access to a live PostageApp.com account
|
6
5
|
# See helper.rb to set host / api key
|
7
|
-
|
8
|
-
|
9
|
-
def test_nothing ; end
|
10
|
-
else
|
11
|
-
|
6
|
+
|
7
|
+
if (ENV['POSTAGEAPP_LIVE_TESTS'])
|
12
8
|
def setup
|
13
9
|
super
|
10
|
+
|
14
11
|
PostageApp.configure do |config|
|
15
12
|
config.secure = false
|
16
13
|
config.host = 'api.postageapp.local'
|
@@ -83,7 +80,11 @@ class LiveTest < Test::Unit::TestCase
|
|
83
80
|
Notifier.with_custom_postage_variables.deliver
|
84
81
|
end
|
85
82
|
assert response.ok?
|
83
|
+
end
|
84
|
+
else
|
85
|
+
puts "\e[0m\e[31mSkipping #{File.basename(__FILE__)}\e[0m"
|
86
|
+
|
87
|
+
def test_nothing
|
86
88
|
end
|
87
|
-
|
88
89
|
end
|
89
|
-
end
|
90
|
+
end
|
data/test/mailer_2_test.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
require File.expand_path('../helper', __FILE__)
|
2
2
|
|
3
3
|
# tests for ActionMailer bundled with Rails 2
|
4
|
-
class Mailer2Test < Test
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
class Mailer2Test < Minitest::Test
|
5
|
+
case (ActionMailer::VERSION::MAJOR)
|
6
|
+
when 2
|
8
7
|
require File.expand_path('../mailer/action_mailer_2/notifier', __FILE__)
|
8
|
+
|
9
9
|
puts "\e[0m\e[32mRunning #{File.basename(__FILE__)} for action_mailer #{ActionMailer::VERSION::STRING}\e[0m"
|
10
10
|
|
11
11
|
def test_create_blank
|
@@ -83,9 +83,10 @@ class Mailer2Test < Test::Unit::TestCase
|
|
83
83
|
assert_equal 'test@test.test', mail.arguments['recipients']
|
84
84
|
assert_equal 'oleg@test.test', mail.arguments_to_send['arguments']['recipient_override']
|
85
85
|
end
|
86
|
-
|
87
86
|
else
|
88
87
|
puts "\e[0m\e[31mSkipping #{File.basename(__FILE__)}\e[0m"
|
89
|
-
|
88
|
+
|
89
|
+
def test_nothing
|
90
|
+
end
|
90
91
|
end
|
91
|
-
end
|
92
|
+
end
|
data/test/mailer_3_test.rb
CHANGED
@@ -1,35 +1,40 @@
|
|
1
1
|
require File.expand_path('../helper', __FILE__)
|
2
2
|
|
3
3
|
# tests for ActionMailer bundled with Rails 3
|
4
|
-
class Mailer3Test < Test
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
class Mailer3Test < Minitest::Test
|
5
|
+
case (ActionMailer::VERSION::MAJOR)
|
6
|
+
when 3
|
8
7
|
require File.expand_path('../mailer/action_mailer_3/notifier', __FILE__)
|
8
|
+
|
9
9
|
puts "\e[0m\e[32mRunning #{File.basename(__FILE__)} for action_mailer #{ActionMailer::VERSION::STRING}\e[0m"
|
10
10
|
|
11
11
|
def test_create_with_no_content
|
12
12
|
mail = Notifier.with_no_content
|
13
|
-
|
13
|
+
|
14
|
+
assert_equal({ }, mail.arguments['content'])
|
14
15
|
end
|
15
16
|
|
16
17
|
def test_create_with_no_subject
|
17
18
|
mail = Notifier.with_no_subject
|
19
|
+
|
18
20
|
assert mail.arguments['headers'][:subject].nil?
|
19
21
|
end
|
20
22
|
|
21
23
|
def test_create_with_simple_view
|
22
24
|
mail = Notifier.with_simple_view
|
25
|
+
|
23
26
|
assert_equal 'with layout simple view content', mail.arguments['content']['text/html']
|
24
27
|
end
|
25
28
|
|
26
29
|
def test_create_with_text_only_view
|
27
30
|
mail = Notifier.with_text_only_view
|
31
|
+
|
28
32
|
assert_equal 'text content', mail.arguments['content']['text/plain']
|
29
33
|
end
|
30
34
|
|
31
35
|
def test_create_with_html_and_text_views
|
32
36
|
mail = Notifier.with_html_and_text_views
|
37
|
+
|
33
38
|
assert_equal 'text content', mail.arguments['content']['text/plain']
|
34
39
|
assert_equal 'with layout html content', mail.arguments['content']['text/html']
|
35
40
|
end
|
@@ -44,6 +49,7 @@ class Mailer3Test < Test::Unit::TestCase
|
|
44
49
|
|
45
50
|
def test_create_with_body_and_attachment_as_file
|
46
51
|
mail = Notifier.with_body_and_attachment_as_file
|
52
|
+
|
47
53
|
assert_equal 'manual body text', mail.arguments['content']['text/html']
|
48
54
|
assert_equal 'text/plain', mail.arguments['attachments']['sample_file.txt']['content_type']
|
49
55
|
assert_equal "RmlsZSBjb250ZW50\n", mail.arguments['attachments']['sample_file.txt']['content']
|
@@ -51,6 +57,7 @@ class Mailer3Test < Test::Unit::TestCase
|
|
51
57
|
|
52
58
|
def test_create_with_body_and_attachment_as_hash
|
53
59
|
mail = Notifier.with_body_and_attachment_as_hash
|
60
|
+
|
54
61
|
assert_equal 'manual body text', mail.arguments['content']['text/html']
|
55
62
|
assert_equal 'text/rich', mail.arguments['attachments']['sample_file.txt']['content_type']
|
56
63
|
assert_equal "RmlsZSBjb250ZW50\n", mail.arguments['attachments']['sample_file.txt']['content']
|
@@ -58,10 +65,11 @@ class Mailer3Test < Test::Unit::TestCase
|
|
58
65
|
|
59
66
|
def test_create_with_custom_postage_variables
|
60
67
|
mail = Notifier.with_custom_postage_variables
|
68
|
+
|
61
69
|
args = mail.arguments_to_send
|
62
70
|
|
63
|
-
assert_equal 'custom_uid',
|
64
|
-
assert_equal 'custom_api_key',
|
71
|
+
assert_equal 'custom_uid', args['uid']
|
72
|
+
assert_equal 'custom_api_key', args['api_key']
|
65
73
|
|
66
74
|
args = args['arguments']
|
67
75
|
|
@@ -80,28 +88,35 @@ class Mailer3Test < Test::Unit::TestCase
|
|
80
88
|
|
81
89
|
def test_create_with_recipient_override
|
82
90
|
PostageApp.configuration.recipient_override = 'oleg@test.test'
|
91
|
+
|
83
92
|
assert mail = Notifier.with_html_and_text_views
|
93
|
+
|
84
94
|
assert_equal 'test@test.test', mail.arguments['recipients']
|
85
95
|
assert_equal 'oleg@test.test', mail.arguments_to_send['arguments']['recipient_override']
|
86
96
|
end
|
87
97
|
|
88
98
|
def test_deliver_for_test_mailer
|
89
99
|
mail = Notifier.with_simple_view
|
100
|
+
|
90
101
|
mail.delivery_method(Mail::TestMailer)
|
91
102
|
mail.deliver
|
92
|
-
|
103
|
+
|
104
|
+
assert_equal [ mail ], ActionMailer::Base.deliveries
|
93
105
|
end
|
94
106
|
|
95
107
|
def test_deliver_for_not_performing_deliveries_with_test_mailer
|
96
108
|
mail = Notifier.with_simple_view
|
109
|
+
|
97
110
|
mail.perform_deliveries = false
|
98
111
|
mail.delivery_method(Mail::TestMailer)
|
99
112
|
mail.deliver
|
100
|
-
assert_equal [], ActionMailer::Base.deliveries
|
101
|
-
end
|
102
113
|
|
114
|
+
assert_equal [ ], ActionMailer::Base.deliveries
|
115
|
+
end
|
103
116
|
else
|
104
117
|
puts "\e[0m\e[31mSkipping #{File.basename(__FILE__)}\e[0m"
|
105
|
-
|
118
|
+
|
119
|
+
def test_nothing
|
120
|
+
end
|
106
121
|
end
|
107
122
|
end
|
data/test/mailer_4_test.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
require File.expand_path('../helper', __FILE__)
|
2
2
|
|
3
3
|
# tests for ActionMailer bundled with Rails 3
|
4
|
-
class Mailer4Test < Test
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
class Mailer4Test < Minitest::Test
|
5
|
+
case (ActionMailer::VERSION::MAJOR)
|
6
|
+
when 4
|
8
7
|
require File.expand_path('../mailer/action_mailer_3/notifier', __FILE__)
|
8
|
+
|
9
9
|
puts "\e[0m\e[32mRunning #{File.basename(__FILE__)} for action_mailer #{ActionMailer::VERSION::STRING}\e[0m"
|
10
10
|
|
11
11
|
def test_create_with_no_content
|
@@ -99,9 +99,10 @@ class Mailer4Test < Test::Unit::TestCase
|
|
99
99
|
mail.deliver
|
100
100
|
assert_equal [], ActionMailer::Base.deliveries
|
101
101
|
end
|
102
|
-
|
103
102
|
else
|
104
103
|
puts "\e[0m\e[31mSkipping #{File.basename(__FILE__)}\e[0m"
|
105
|
-
|
104
|
+
|
105
|
+
def test_nothing
|
106
|
+
end
|
106
107
|
end
|
107
108
|
end
|
data/test/postageapp_test.rb
CHANGED
data/test/request_test.rb
CHANGED
@@ -1,17 +1,19 @@
|
|
1
1
|
require File.expand_path('../helper', __FILE__)
|
2
2
|
|
3
|
-
class RequestTest < Test
|
4
|
-
|
3
|
+
class RequestTest < Minitest::Test
|
5
4
|
def test_method_uid
|
6
5
|
request = PostageApp::Request.new('test_method')
|
6
|
+
|
7
7
|
uid = request.uid
|
8
|
-
|
8
|
+
|
9
|
+
assert_match /\A\w{40}\z/, uid
|
9
10
|
assert_equal uid, request.uid
|
10
|
-
|
11
|
+
assert uid != request.uid(true)
|
11
12
|
end
|
12
13
|
|
13
14
|
def test_method_url
|
14
15
|
request = PostageApp::Request.new('test_method')
|
16
|
+
|
15
17
|
assert_equal 'api.postageapp.com', request.url.host
|
16
18
|
assert_equal 443, request.url.port
|
17
19
|
assert_equal '/v.1.0/test_method.json', request.url.path
|
@@ -19,27 +21,37 @@ class RequestTest < Test::Unit::TestCase
|
|
19
21
|
|
20
22
|
def test_method_arguments_to_send
|
21
23
|
request = PostageApp::Request.new('send_message', {
|
22
|
-
'headers' => {
|
23
|
-
|
24
|
+
'headers' => {
|
25
|
+
'from' => 'sender@test.test',
|
26
|
+
'subject' => 'Test Message'
|
27
|
+
},
|
24
28
|
'recipients' => 'test@test.test',
|
25
29
|
'content' => {
|
26
30
|
'text/plain' => 'text content',
|
27
31
|
'text/html' => 'html content'
|
28
32
|
}
|
29
33
|
})
|
34
|
+
|
35
|
+
assert_equal 'text content', request.text_part
|
36
|
+
assert_equal 'html content', request.html_part
|
37
|
+
|
30
38
|
args = request.arguments_to_send
|
39
|
+
|
31
40
|
assert_equal '1234567890abcdef', args['api_key']
|
32
41
|
assert_match /^\w{40}$/, args['uid']
|
33
42
|
|
34
43
|
payload = args['arguments']
|
35
|
-
|
36
|
-
assert_equal '
|
37
|
-
assert_equal '
|
38
|
-
assert_equal '
|
39
|
-
assert_equal '
|
44
|
+
|
45
|
+
assert_equal 'sender@test.test', payload['headers']['from']
|
46
|
+
assert_equal 'Test Message', payload['headers']['subject']
|
47
|
+
assert_equal 'test@test.test', payload['recipients']
|
48
|
+
assert_equal 'text content', payload['content']['text/plain']
|
49
|
+
assert_equal 'html content', payload['content']['text/html']
|
40
50
|
|
41
51
|
request.arguments = { 'data' => 'content' }
|
52
|
+
|
42
53
|
args = request.arguments_to_send
|
54
|
+
|
43
55
|
assert_equal '1234567890abcdef', args['api_key']
|
44
56
|
assert_match /^\w{40}$/, args['uid']
|
45
57
|
assert_equal 'content', args['arguments']['data']
|
@@ -47,21 +59,26 @@ class RequestTest < Test::Unit::TestCase
|
|
47
59
|
|
48
60
|
def test_uid_is_enforceable
|
49
61
|
request = PostageApp::Request.new('test_method')
|
62
|
+
|
50
63
|
assert_match /^\w{40}$/, request.arguments_to_send['uid']
|
51
64
|
|
52
65
|
request.uid = 'my_uid'
|
66
|
+
|
53
67
|
assert_equal 'my_uid', request.arguments_to_send['uid']
|
54
68
|
|
55
69
|
request = PostageApp::Request.new('test_method', 'uid' => 'new_uid', 'data' => 'value')
|
70
|
+
|
56
71
|
assert_equal 'new_uid', request.uid
|
57
72
|
assert_equal ({'data' => 'value'}), request.arguments
|
58
73
|
end
|
59
74
|
|
60
75
|
def test_api_key
|
61
76
|
request = PostageApp::Request.new('test_method')
|
77
|
+
|
62
78
|
assert_equal PostageApp.configuration.api_key, request.api_key
|
63
79
|
|
64
80
|
request = PostageApp::Request.new('test_method', {'api_key' => 'custom_api_key'})
|
81
|
+
|
65
82
|
assert_equal 'custom_api_key', request.api_key
|
66
83
|
end
|
67
84
|
|
@@ -69,8 +86,10 @@ class RequestTest < Test::Unit::TestCase
|
|
69
86
|
mock_successful_send
|
70
87
|
|
71
88
|
request = PostageApp::Request.new('send_message', {
|
72
|
-
'headers' => {
|
73
|
-
|
89
|
+
'headers' => {
|
90
|
+
'from' => 'sender@test.test',
|
91
|
+
'subject' => 'Test Message'
|
92
|
+
},
|
74
93
|
'recipients' => 'test@test.test',
|
75
94
|
'content' => {
|
76
95
|
'text/plain' => 'text content',
|
@@ -80,25 +99,28 @@ class RequestTest < Test::Unit::TestCase
|
|
80
99
|
response = request.send
|
81
100
|
assert_equal 'ok', response.status
|
82
101
|
assert_equal 'sha1hashuid23456789012345678901234567890', response.uid
|
83
|
-
assert_equal
|
102
|
+
assert_equal({'message' => { 'id' => 999 }}, response.data)
|
84
103
|
end
|
85
104
|
|
86
105
|
def test_send_failure
|
87
106
|
mock_failed_send
|
88
107
|
|
89
108
|
request = PostageApp::Request.new('send_message', {
|
90
|
-
'headers' => {
|
91
|
-
|
109
|
+
'headers' => {
|
110
|
+
'from' => 'sender@test.test',
|
111
|
+
'subject' => 'Test Message'
|
112
|
+
},
|
92
113
|
'recipients' => 'test@test.test',
|
93
114
|
'content' => {
|
94
115
|
'text/plain' => 'text content',
|
95
116
|
'text/html' => 'html content'
|
96
117
|
}
|
97
118
|
})
|
119
|
+
|
98
120
|
response = request.send
|
121
|
+
|
99
122
|
assert_equal 'fail', response.status
|
100
123
|
assert_equal nil, response.uid
|
101
124
|
assert_equal nil, response.data
|
102
125
|
end
|
103
|
-
|
104
|
-
end
|
126
|
+
end
|
data/test/response_test.rb
CHANGED
metadata
CHANGED
@@ -1,34 +1,39 @@
|
|
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.24
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Oleg Khabarov
|
8
|
-
-
|
9
|
+
- Scott Tadman
|
10
|
+
- The Working Group Inc.
|
9
11
|
autorequire:
|
10
12
|
bindir: bin
|
11
13
|
cert_chain: []
|
12
|
-
date:
|
14
|
+
date: 2014-12-10 00:00:00.000000000 Z
|
13
15
|
dependencies:
|
14
16
|
- !ruby/object:Gem::Dependency
|
15
17
|
name: json
|
16
18
|
requirement: !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
17
20
|
requirements:
|
18
|
-
- - '>='
|
21
|
+
- - ! '>='
|
19
22
|
- !ruby/object:Gem::Version
|
20
23
|
version: '0'
|
21
24
|
type: :runtime
|
22
25
|
prerelease: false
|
23
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
24
28
|
requirements:
|
25
|
-
- - '>='
|
29
|
+
- - ! '>='
|
26
30
|
- !ruby/object:Gem::Version
|
27
31
|
version: '0'
|
28
32
|
description: Gem that interfaces with PostageApp.com service to send emails from web
|
29
33
|
apps
|
30
34
|
email:
|
31
35
|
- oleg@khabarov.ca
|
36
|
+
- scott@twg.ca
|
32
37
|
executables: []
|
33
38
|
extensions: []
|
34
39
|
extra_rdoc_files: []
|
@@ -95,26 +100,28 @@ files:
|
|
95
100
|
- test/request_test.rb
|
96
101
|
- test/response_test.rb
|
97
102
|
homepage: http://github.com/postageapp/postageapp-ruby
|
98
|
-
licenses:
|
99
|
-
|
103
|
+
licenses:
|
104
|
+
- MIT
|
100
105
|
post_install_message:
|
101
106
|
rdoc_options: []
|
102
107
|
require_paths:
|
103
108
|
- lib
|
104
109
|
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
105
111
|
requirements:
|
106
|
-
- - '>='
|
112
|
+
- - ! '>='
|
107
113
|
- !ruby/object:Gem::Version
|
108
114
|
version: '0'
|
109
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
110
117
|
requirements:
|
111
|
-
- - '>='
|
118
|
+
- - ! '>='
|
112
119
|
- !ruby/object:Gem::Version
|
113
120
|
version: '0'
|
114
121
|
requirements: []
|
115
122
|
rubyforge_project:
|
116
|
-
rubygems_version:
|
123
|
+
rubygems_version: 1.8.25
|
117
124
|
signing_key:
|
118
|
-
specification_version:
|
125
|
+
specification_version: 3
|
119
126
|
summary: Easier way to send email from web apps
|
120
127
|
test_files: []
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: e4ce66fba6cb35602ebc6afe19498db5cdedb98f
|
4
|
-
data.tar.gz: 7bd2753935e216bce6283cf62f5c4bcc5c9a1885
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: c05d91dc01449f819db82997e123a89140c7d0fa01c8ac2c99a6342a71630cd58d93908b27f48458c3d50596c98c8ed082604173897cf81fd10ae08072d575af
|
7
|
-
data.tar.gz: 6ae7f5cc98f0041bc1c5dde01326fbae16eb5f7e0db836480e061333a7ba8cc44327357387fc41e3f26d0ebf8e5127e9cccc450e1c5bf064ffaee7e7e1c4cb76
|