postageapp 1.0.16 → 1.0.17
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/postageapp/mailer/mailer_3.rb +1 -35
- data/postageapp.gemspec +3 -2
- data/test/mailer/action_mailer_3/layouts/notifier.html.erb +1 -0
- data/test/mailer_3_test.rb +9 -14
- metadata +4 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.17
|
@@ -59,6 +59,7 @@ class PostageApp::Mailer < ActionMailer::Base
|
|
59
59
|
|
60
60
|
# Instead of initializing Mail object, we prepare PostageApp::Request
|
61
61
|
def initialize(method_name = nil, *args)
|
62
|
+
super()
|
62
63
|
@_message = PostageApp::Request.new(:send_message)
|
63
64
|
process(method_name, *args) if method_name
|
64
65
|
end
|
@@ -125,41 +126,6 @@ class PostageApp::Mailer < ActionMailer::Base
|
|
125
126
|
m
|
126
127
|
end
|
127
128
|
|
128
|
-
# Overriding method to create mesage from the old_api
|
129
|
-
def create_mail
|
130
|
-
m = @_message
|
131
|
-
|
132
|
-
m.arguments['headers'] ||= { }
|
133
|
-
m.arguments['headers']['from'] = from
|
134
|
-
m.arguments['headers']['subject'] = subject
|
135
|
-
m.arguments['recipients'] = recipients
|
136
|
-
|
137
|
-
m
|
138
|
-
end
|
139
|
-
|
140
|
-
# Overriding part assignment from old_api
|
141
|
-
# For now only accepting a hash
|
142
|
-
def part(params)
|
143
|
-
@_message.arguments['content'] ||= { }
|
144
|
-
@_message.arguments['content'][params[:content_type]] = params[:body]
|
145
|
-
end
|
146
|
-
|
147
|
-
# Overriding attachment assignment from old_api
|
148
|
-
# For now only accepting a hash
|
149
|
-
def attachment(params)
|
150
|
-
@_message.arguments['attachments'] ||= { }
|
151
|
-
@_message.arguments['attachments'][params[:filename]] = {
|
152
|
-
'content_type' => params[:content_type],
|
153
|
-
'content' => Base64.encode64(params[:body].to_s)
|
154
|
-
}
|
155
|
-
end
|
156
|
-
|
157
|
-
# Overriding method in old_api
|
158
|
-
def create_inline_part(body, mime_type = nil)
|
159
|
-
@_message.arguments['content'] ||= { }
|
160
|
-
@_message.arguments['content'][mime_type && mime_type.to_s || 'text/plain'] = body
|
161
|
-
end
|
162
|
-
|
163
129
|
protected
|
164
130
|
|
165
131
|
def create_parts_from_responses(m, responses) #:nodoc:
|
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.17"
|
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 = "2012-
|
12
|
+
s.date = "2012-12-20"
|
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 = [
|
@@ -57,6 +57,7 @@ Gem::Specification.new do |s|
|
|
57
57
|
"test/mailer/action_mailer_2/notifier/with_html_and_text_views.text.plain.erb",
|
58
58
|
"test/mailer/action_mailer_2/notifier/with_simple_view.erb",
|
59
59
|
"test/mailer/action_mailer_2/notifier/with_text_only_view.text.plain.erb",
|
60
|
+
"test/mailer/action_mailer_3/layouts/notifier.html.erb",
|
60
61
|
"test/mailer/action_mailer_3/notifier.rb",
|
61
62
|
"test/mailer/action_mailer_3/notifier/with_custom_postage_variables.html.erb",
|
62
63
|
"test/mailer/action_mailer_3/notifier/with_custom_postage_variables.text.erb",
|
@@ -0,0 +1 @@
|
|
1
|
+
with layout <%= yield %>
|
data/test/mailer_3_test.rb
CHANGED
@@ -8,11 +8,6 @@ class Mailer3Test < Test::Unit::TestCase
|
|
8
8
|
require File.expand_path('../mailer/action_mailer_3/notifier', __FILE__)
|
9
9
|
puts "\e[0m\e[32mRunning #{File.basename(__FILE__)} for action_mailer #{ActionMailer::VERSION::STRING}\e[0m"
|
10
10
|
|
11
|
-
def test_create_blank
|
12
|
-
mail = Notifier.blank
|
13
|
-
assert mail.is_a?(PostageApp::Request)
|
14
|
-
end
|
15
|
-
|
16
11
|
def test_create_with_no_content
|
17
12
|
mail = Notifier.with_no_content
|
18
13
|
assert_equal ({}), mail.arguments['content']
|
@@ -20,7 +15,7 @@ class Mailer3Test < Test::Unit::TestCase
|
|
20
15
|
|
21
16
|
def test_create_with_simple_view
|
22
17
|
mail = Notifier.with_simple_view
|
23
|
-
assert_equal 'simple view content', mail.arguments['content']['text/html']
|
18
|
+
assert_equal 'with layout simple view content', mail.arguments['content']['text/html']
|
24
19
|
end
|
25
20
|
|
26
21
|
def test_create_with_text_only_view
|
@@ -30,8 +25,8 @@ class Mailer3Test < Test::Unit::TestCase
|
|
30
25
|
|
31
26
|
def test_create_with_html_and_text_views
|
32
27
|
mail = Notifier.with_html_and_text_views
|
33
|
-
assert_equal 'text content',
|
34
|
-
assert_equal 'html content',
|
28
|
+
assert_equal 'text content', mail.arguments['content']['text/plain']
|
29
|
+
assert_equal 'with layout html content', mail.arguments['content']['text/html']
|
35
30
|
end
|
36
31
|
|
37
32
|
def test_deliver_with_html_and_text_views
|
@@ -62,13 +57,13 @@ class Mailer3Test < Test::Unit::TestCase
|
|
62
57
|
'test1@test.test' => { 'name' => 'Test 1'},
|
63
58
|
'test2@test.test' => { 'name' => 'Test 2'}
|
64
59
|
}), mail.arguments['recipients']
|
65
|
-
assert_equal 'test-template',
|
60
|
+
assert_equal 'test-template', mail.arguments['template']
|
66
61
|
assert_equal ({ 'variable' => 'value' }), mail.arguments['variables']
|
67
|
-
assert_equal 'custom_api_key',
|
68
|
-
assert_equal 'CustomValue1',
|
69
|
-
assert_equal 'CustomValue2',
|
70
|
-
assert_equal 'text content',
|
71
|
-
assert_equal 'html content',
|
62
|
+
assert_equal 'custom_api_key', mail.arguments['api_key']
|
63
|
+
assert_equal 'CustomValue1', mail.arguments['headers']['CustomHeader1']
|
64
|
+
assert_equal 'CustomValue2', mail.arguments['headers']['CustomHeader2']
|
65
|
+
assert_equal 'text content', mail.arguments['content']['text/plain']
|
66
|
+
assert_equal 'with layout html content', mail.arguments['content']['text/html']
|
72
67
|
end
|
73
68
|
|
74
69
|
def test_create_with_recipient_override
|
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.17
|
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: 2012-
|
12
|
+
date: 2012-12-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- test/mailer/action_mailer_2/notifier/with_html_and_text_views.text.plain.erb
|
93
93
|
- test/mailer/action_mailer_2/notifier/with_simple_view.erb
|
94
94
|
- test/mailer/action_mailer_2/notifier/with_text_only_view.text.plain.erb
|
95
|
+
- test/mailer/action_mailer_3/layouts/notifier.html.erb
|
95
96
|
- test/mailer/action_mailer_3/notifier.rb
|
96
97
|
- test/mailer/action_mailer_3/notifier/with_custom_postage_variables.html.erb
|
97
98
|
- test/mailer/action_mailer_3/notifier/with_custom_postage_variables.text.erb
|
@@ -123,7 +124,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
124
|
version: '0'
|
124
125
|
segments:
|
125
126
|
- 0
|
126
|
-
hash:
|
127
|
+
hash: 3558677056440120512
|
127
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
129
|
none: false
|
129
130
|
requirements:
|