postmark 0.9.9 → 0.9.10
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +4 -0
- data/README.rdoc +1 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/postmark.rb +19 -19
- data/postmark.gemspec +2 -2
- metadata +4 -3
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ begin
|
|
9
9
|
gem.description = %Q{Use this gem to send emails through Postmark HTTP API and retrieve info about bounces.}
|
10
10
|
gem.email = "ilya@wildbit.com"
|
11
11
|
gem.homepage = "http://postmarkapp.com"
|
12
|
-
gem.authors = ["Petyo Ivanov", "Ilya Sabanin"]
|
12
|
+
gem.authors = ["Petyo Ivanov", "Ilya Sabanin", "Artem Chistyakov"]
|
13
13
|
|
14
14
|
gem.add_development_dependency "rspec"
|
15
15
|
gem.add_development_dependency "activesupport"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.10
|
data/lib/postmark.rb
CHANGED
@@ -80,7 +80,7 @@ module Postmark
|
|
80
80
|
def configure
|
81
81
|
yield self
|
82
82
|
end
|
83
|
-
|
83
|
+
|
84
84
|
def send_through_postmark(message) #:nodoc:
|
85
85
|
@retries = 0
|
86
86
|
begin
|
@@ -94,26 +94,26 @@ module Postmark
|
|
94
94
|
end
|
95
95
|
end
|
96
96
|
end
|
97
|
-
|
97
|
+
|
98
98
|
def convert_message_to_options_hash(message)
|
99
99
|
options = Hash.new
|
100
100
|
headers = extract_headers_according_to_message_format(message)
|
101
|
-
|
102
|
-
options["From"] = message['from'].to_s
|
103
|
-
options["ReplyTo"] = message.reply_to.
|
104
|
-
options["To"] = message['to'].to_s
|
105
|
-
options["Cc"] = message['cc'].to_s
|
106
|
-
options["Bcc"] = message.bcc.join(", ")
|
101
|
+
|
102
|
+
options["From"] = message['from'].to_s if message.from
|
103
|
+
options["ReplyTo"] = Array[message.reply_to].flatten.join(", ") if message.reply_to
|
104
|
+
options["To"] = message['to'].to_s if message.to
|
105
|
+
options["Cc"] = message['cc'].to_s if message.cc
|
106
|
+
options["Bcc"] = Array[message.bcc].flatten.join(", ") if message.bcc
|
107
107
|
options["Subject"] = message.subject
|
108
108
|
options["Attachments"] = message.postmark_attachments
|
109
|
-
options["Tag"] = message.tag.to_s
|
110
|
-
options["Headers"] = headers
|
111
|
-
|
109
|
+
options["Tag"] = message.tag.to_s if message.tag
|
110
|
+
options["Headers"] = headers if headers.size > 0
|
111
|
+
|
112
112
|
options = options.delete_if{|k,v| v.nil?}
|
113
|
-
|
113
|
+
|
114
114
|
html = message.body_html
|
115
115
|
text = message.body_text
|
116
|
-
|
116
|
+
|
117
117
|
if message.multipart?
|
118
118
|
options["HtmlBody"] = html
|
119
119
|
options["TextBody"] = text
|
@@ -122,16 +122,16 @@ module Postmark
|
|
122
122
|
else
|
123
123
|
options["TextBody"] = text
|
124
124
|
end
|
125
|
-
|
125
|
+
|
126
126
|
options
|
127
127
|
end
|
128
|
-
|
128
|
+
|
129
129
|
def delivery_stats
|
130
130
|
HttpClient.get("deliverystats")
|
131
131
|
end
|
132
|
-
|
132
|
+
|
133
133
|
protected
|
134
|
-
|
134
|
+
|
135
135
|
def extract_headers_according_to_message_format(message)
|
136
136
|
if defined?(TMail) && message.is_a?(TMail::Mail)
|
137
137
|
headers = extract_tmail_headers(message)
|
@@ -141,7 +141,7 @@ module Postmark
|
|
141
141
|
raise "Can't convert message to a valid hash of API options. Unknown message format."
|
142
142
|
end
|
143
143
|
end
|
144
|
-
|
144
|
+
|
145
145
|
def extract_mail_headers(message)
|
146
146
|
headers = []
|
147
147
|
message.header.fields.each do |field|
|
@@ -175,7 +175,7 @@ module Postmark
|
|
175
175
|
attachment
|
176
176
|
]
|
177
177
|
end
|
178
|
-
|
178
|
+
|
179
179
|
end
|
180
180
|
|
181
181
|
self.response_parser_class = nil
|
data/postmark.gemspec
CHANGED
@@ -5,10 +5,10 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{postmark}
|
8
|
-
s.version = "0.9.
|
8
|
+
s.version = "0.9.10"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Petyo Ivanov", "Ilya Sabanin"]
|
11
|
+
s.authors = ["Petyo Ivanov", "Ilya Sabanin", "Artem Chistyakov"]
|
12
12
|
s.date = %q{2012-01-31}
|
13
13
|
s.description = %q{Use this gem to send emails through Postmark HTTP API and retrieve info about bounces.}
|
14
14
|
s.email = %q{ilya@wildbit.com}
|
metadata
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postmark
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 47
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 10
|
10
|
+
version: 0.9.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Petyo Ivanov
|
14
14
|
- Ilya Sabanin
|
15
|
+
- Artem Chistyakov
|
15
16
|
autorequire:
|
16
17
|
bindir: bin
|
17
18
|
cert_chain: []
|