postmark 1.4.3 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +4 -0
- data/README.md +13 -13
- data/VERSION +1 -1
- data/lib/postmark.rb +5 -2
- data/lib/postmark/account_api_client.rb +1 -1
- data/lib/postmark/api_client.rb +1 -1
- data/lib/postmark/client.rb +5 -4
- data/lib/postmark/handlers/mail.rb +3 -3
- data/lib/postmark/http_client.rb +6 -4
- data/lib/postmark/version.rb +1 -1
- data/spec/integration/mail_delivery_method_spec.rb +3 -3
- data/spec/spec_helper.rb +1 -1
- data/spec/unit/postmark/account_api_client_spec.rb +6 -6
- data/spec/unit/postmark/api_client_spec.rb +14 -9
- data/spec/unit/postmark/handlers/mail_spec.rb +15 -3
- data/spec/unit/postmark/http_client_spec.rb +12 -8
- data/spec/unit/postmark_spec.rb +5 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d99b2b07a9b385d8373eb4f0f020806d4ead30fc
|
4
|
+
data.tar.gz: 56f731c91f3d7a660e56c896d5666ee65c177ec1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e0545eb81715e7a0d436557498f4cb0c3196fed8964ca8e0bc51699d2e944faacbb269cd8bfc1be537564983b2932a789738d2a9a0ba4271d2487371c3de61c
|
7
|
+
data.tar.gz: 6c5f27e71506ef94a7efb1f07bd14438f9f9403f9d1a209434dab722c3a96e57448e937d02f8da0f394596e4d3e800e2d5baf67cf2ec793e856ae7b364d8abf9
|
data/CHANGELOG.rdoc
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Postmark Gem
|
2
|
-
[![Build Status](https://travis-ci.org/wildbit/postmark-gem.
|
2
|
+
[![Build Status](https://travis-ci.org/wildbit/postmark-gem.svg?branch=master)](https://travis-ci.org/wildbit/postmark-gem) [![Code Climate](https://codeclimate.com/github/wildbit/postmark-gem/badges/gpa.svg)](https://codeclimate.com/github/wildbit/postmark-gem)
|
3
3
|
|
4
4
|
This gem is the official wrapper for the [Postmark HTTP API](http://postmarkapp.com). Postmark allows you to send your application's emails with high delivery rates, including bounce/spam processing and detailed statistics. In addition, Postmark can parse incoming emails which are forwarded back to your application.
|
5
5
|
|
@@ -17,14 +17,14 @@ Without Bundler:
|
|
17
17
|
gem install postmark
|
18
18
|
```
|
19
19
|
|
20
|
-
## Get a Postmark API
|
20
|
+
## Get a Postmark API token
|
21
21
|
|
22
22
|
In order to send emails using Postmark ruby gem, you will need a
|
23
23
|
[Postmark](http://postmarkapp.com) account. If you don't have one please
|
24
24
|
register at https://postmarkapp.com/sign_up.
|
25
25
|
|
26
26
|
If you didn’t create any servers yet, please create one, proceed to the
|
27
|
-
`Credentials` tab and copy an API
|
27
|
+
`Credentials` tab and copy an API token. API tokens should be frequently rotated for
|
28
28
|
security reasons.
|
29
29
|
|
30
30
|
## Communicating with the API
|
@@ -35,14 +35,14 @@ every From email address you specify.
|
|
35
35
|
Create an instance of `Postmark::ApiClient` to start sending emails.
|
36
36
|
|
37
37
|
``` ruby
|
38
|
-
|
39
|
-
client = Postmark::ApiClient.new(
|
38
|
+
your_api_token = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
|
39
|
+
client = Postmark::ApiClient.new(your_api_token)
|
40
40
|
```
|
41
41
|
|
42
42
|
`Postmark::ApiClient` accepts various options:
|
43
43
|
|
44
44
|
``` ruby
|
45
|
-
client = Postmark::ApiClient.new(
|
45
|
+
client = Postmark::ApiClient.new(your_api_token, http_open_timeout: 15)
|
46
46
|
```
|
47
47
|
|
48
48
|
Some useful options are:
|
@@ -316,7 +316,7 @@ a delivery method for the message:
|
|
316
316
|
``` ruby
|
317
317
|
message = Mail.new do
|
318
318
|
# ...
|
319
|
-
delivery_method Mail::Postmark,
|
319
|
+
delivery_method Mail::Postmark, api_token: 'your-postmark-api-token'
|
320
320
|
end
|
321
321
|
```
|
322
322
|
|
@@ -339,7 +339,7 @@ message = Mail.new do
|
|
339
339
|
body 'That\'s what you said about the Green Lantern movie. You' \
|
340
340
|
'were 114 minutes of wrong.'
|
341
341
|
|
342
|
-
delivery_method Mail::Postmark, :
|
342
|
+
delivery_method Mail::Postmark, :api_token => 'your-postmark-api-token'
|
343
343
|
end
|
344
344
|
|
345
345
|
message.deliver
|
@@ -367,7 +367,7 @@ message = Mail.new do
|
|
367
367
|
|
368
368
|
track_opens "true" # Feel free to use boolean values on mail >= 2.3.0
|
369
369
|
|
370
|
-
delivery_method Mail::Postmark, :
|
370
|
+
delivery_method Mail::Postmark, :api_token => 'your-postmark-api-token'
|
371
371
|
end
|
372
372
|
|
373
373
|
message.deliver
|
@@ -384,7 +384,7 @@ message = Mail.new do
|
|
384
384
|
body 'You look like a real geek!'
|
385
385
|
add_file '1.jpeg'
|
386
386
|
|
387
|
-
delivery_method Mail::Postmark, :
|
387
|
+
delivery_method Mail::Postmark, :api_token => 'your-postmark-api-token'
|
388
388
|
end
|
389
389
|
|
390
390
|
message.attachments['sheldon.jpeg'] = File.read('2.jpeg')
|
@@ -419,7 +419,7 @@ message = Mail.new do
|
|
419
419
|
from 'sheldon@bigbangtheory.com'
|
420
420
|
to 'Leonard Hofstadter <leonard@bigbangtheory.com>'
|
421
421
|
subject 'Re: Anything Can Happen Thursday'
|
422
|
-
delivery_method Mail::Postmark, :
|
422
|
+
delivery_method Mail::Postmark, :api_token => 'your-postmark-api-token'
|
423
423
|
|
424
424
|
text_part do
|
425
425
|
body 'Apparently the news didn\'t reach my digestive system,' \
|
@@ -458,7 +458,7 @@ message = Mail.new do
|
|
458
458
|
'hallway and immediately adjacent to that hallway is this!'
|
459
459
|
tag 'confidential'
|
460
460
|
|
461
|
-
delivery_method Mail::Postmark, :
|
461
|
+
delivery_method Mail::Postmark, :api_token => 'your-postmark-api-token'
|
462
462
|
end
|
463
463
|
|
464
464
|
message.deliver
|
@@ -557,7 +557,7 @@ require 'mail'
|
|
557
557
|
require 'json'
|
558
558
|
|
559
559
|
Postmark.response_parser_class = :Json
|
560
|
-
Postmark.
|
560
|
+
Postmark.api_token = 'your-postmark-api-token'
|
561
561
|
|
562
562
|
# Get bounces information: (array of bounce objects)
|
563
563
|
Postmark::Bounce.all
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.5.0
|
data/lib/postmark.rb
CHANGED
@@ -52,10 +52,13 @@ module Postmark
|
|
52
52
|
|
53
53
|
@@api_client_mutex = Mutex.new
|
54
54
|
|
55
|
-
attr_accessor :secure, :
|
55
|
+
attr_accessor :secure, :api_token, :proxy_host, :proxy_port, :proxy_user,
|
56
56
|
:proxy_pass, :host, :port, :path_prefix,
|
57
57
|
:http_open_timeout, :http_read_timeout, :max_retries
|
58
58
|
|
59
|
+
alias_method :api_key, :api_token
|
60
|
+
alias_method :api_key=, :api_token=
|
61
|
+
|
59
62
|
attr_writer :response_parser_class, :api_client
|
60
63
|
|
61
64
|
def response_parser_class
|
@@ -71,7 +74,7 @@ module Postmark
|
|
71
74
|
|
72
75
|
@@api_client_mutex.synchronize do
|
73
76
|
@api_client ||= Postmark::ApiClient.new(
|
74
|
-
self.
|
77
|
+
self.api_token,
|
75
78
|
:secure => self.secure,
|
76
79
|
:proxy_host => self.proxy_host,
|
77
80
|
:proxy_port => self.proxy_port,
|
data/lib/postmark/api_client.rb
CHANGED
data/lib/postmark/client.rb
CHANGED
@@ -4,15 +4,16 @@ module Postmark
|
|
4
4
|
class Client
|
5
5
|
attr_reader :http_client, :max_retries
|
6
6
|
|
7
|
-
def initialize(
|
7
|
+
def initialize(api_token, options = {})
|
8
8
|
options = options.dup
|
9
9
|
@max_retries = options.delete(:max_retries) || 3
|
10
|
-
@http_client = HttpClient.new(
|
10
|
+
@http_client = HttpClient.new(api_token, options)
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
14
|
-
http_client.
|
13
|
+
def api_token=(api_token)
|
14
|
+
http_client.api_token = api_token
|
15
15
|
end
|
16
|
+
alias_method :api_key=, :api_token=
|
16
17
|
|
17
18
|
def find_each(path, name, options = {})
|
18
19
|
if block_given?
|
@@ -4,13 +4,13 @@ module Mail
|
|
4
4
|
attr_accessor :settings
|
5
5
|
|
6
6
|
def initialize(values)
|
7
|
-
self.settings = { :
|
7
|
+
self.settings = { :api_token => ENV['POSTMARK_API_TOKEN'] }.merge(values)
|
8
8
|
end
|
9
9
|
|
10
10
|
def deliver!(mail)
|
11
11
|
settings = self.settings.dup
|
12
|
-
|
13
|
-
api_client = ::Postmark::ApiClient.new(
|
12
|
+
api_token = settings.delete(:api_token) || settings.delete(:api_key)
|
13
|
+
api_client = ::Postmark::ApiClient.new(api_token, settings)
|
14
14
|
response = api_client.deliver_message(mail)
|
15
15
|
|
16
16
|
if settings[:return_response]
|
data/lib/postmark/http_client.rb
CHANGED
@@ -3,10 +3,12 @@ require 'cgi'
|
|
3
3
|
|
4
4
|
module Postmark
|
5
5
|
class HttpClient
|
6
|
-
attr_accessor :
|
6
|
+
attr_accessor :api_token
|
7
7
|
attr_reader :http, :secure, :proxy_host, :proxy_port, :proxy_user,
|
8
8
|
:proxy_pass, :host, :port, :path_prefix,
|
9
9
|
:http_open_timeout, :http_read_timeout, :auth_header_name
|
10
|
+
alias_method :api_key, :api_token
|
11
|
+
alias_method :api_key=, :api_token=
|
10
12
|
|
11
13
|
DEFAULTS = {
|
12
14
|
:auth_header_name => 'X-Postmark-Server-Token',
|
@@ -17,8 +19,8 @@ module Postmark
|
|
17
19
|
:http_open_timeout => 5
|
18
20
|
}
|
19
21
|
|
20
|
-
def initialize(
|
21
|
-
@
|
22
|
+
def initialize(api_token, options = {})
|
23
|
+
@api_token = api_token
|
22
24
|
@request_mutex = Mutex.new
|
23
25
|
apply_options(options)
|
24
26
|
@http = build_http
|
@@ -79,7 +81,7 @@ module Postmark
|
|
79
81
|
end
|
80
82
|
|
81
83
|
def headers
|
82
|
-
HEADERS.merge(self.auth_header_name => self.
|
84
|
+
HEADERS.merge(self.auth_header_name => self.api_token.to_s)
|
83
85
|
end
|
84
86
|
|
85
87
|
def url_path(path)
|
data/lib/postmark/version.rb
CHANGED
@@ -10,7 +10,7 @@ describe "Sending Mail::Messages with delivery_method Mail::Postmark" do
|
|
10
10
|
subject "Mail::Message object"
|
11
11
|
body "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do "
|
12
12
|
"eiusmod tempor incididunt ut labore et dolore magna aliqua."
|
13
|
-
delivery_method Mail::Postmark, :
|
13
|
+
delivery_method Mail::Postmark, :api_token => "POSTMARK_API_TEST",
|
14
14
|
:http_open_timeout => 15,
|
15
15
|
:http_read_timeout => 15
|
16
16
|
|
@@ -27,7 +27,7 @@ describe "Sending Mail::Messages with delivery_method Mail::Postmark" do
|
|
27
27
|
Mail.new do
|
28
28
|
from "sender@postmarkapp.com"
|
29
29
|
to "recipient@postmarkapp.com"
|
30
|
-
delivery_method Mail::Postmark, :
|
30
|
+
delivery_method Mail::Postmark, :api_token => "POSTMARK_API_TEST",
|
31
31
|
:http_open_timeout => 15,
|
32
32
|
:http_read_timeout => 15
|
33
33
|
end
|
@@ -43,7 +43,7 @@ describe "Sending Mail::Messages with delivery_method Mail::Postmark" do
|
|
43
43
|
Mail.new do
|
44
44
|
from "sender@postmarkapp.com"
|
45
45
|
to "@postmarkapp.com"
|
46
|
-
delivery_method Mail::Postmark, :
|
46
|
+
delivery_method Mail::Postmark, :api_token => "POSTMARK_API_TEST",
|
47
47
|
:http_open_timeout => 15,
|
48
48
|
:http_read_timeout => 15
|
49
49
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -38,7 +38,7 @@ RSpec.configure do |config|
|
|
38
38
|
}
|
39
39
|
|
40
40
|
config.before(:each) do
|
41
|
-
%w(api_client response_parser_class secure
|
41
|
+
%w(api_client response_parser_class secure api_token proxy_host proxy_port
|
42
42
|
proxy_user proxy_pass host port path_prefix http_open_timeout
|
43
43
|
http_read_timeout max_retries).each do |var|
|
44
44
|
Postmark.instance_variable_set(:"@#{var}", nil)
|
@@ -2,20 +2,20 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Postmark::AccountApiClient do
|
4
4
|
|
5
|
-
let(:
|
5
|
+
let(:api_token) { 'abcd-efgh' }
|
6
6
|
subject { Postmark::AccountApiClient}
|
7
7
|
|
8
|
-
it 'can be created with an API
|
9
|
-
expect { subject.new(
|
8
|
+
it 'can be created with an API token' do
|
9
|
+
expect { subject.new(api_token) }.not_to raise_error
|
10
10
|
end
|
11
11
|
|
12
|
-
it 'can be created with an API
|
13
|
-
expect { subject.new(
|
12
|
+
it 'can be created with an API token and options hash' do
|
13
|
+
expect { subject.new(api_token, :http_read_timeout => 5) }.not_to raise_error
|
14
14
|
end
|
15
15
|
|
16
16
|
context 'instance' do
|
17
17
|
|
18
|
-
subject { Postmark::AccountApiClient.new(
|
18
|
+
subject { Postmark::AccountApiClient.new(api_token) }
|
19
19
|
|
20
20
|
it 'uses the auth header specific for Account API' do
|
21
21
|
auth_header = subject.http_client.auth_header_name
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Postmark::ApiClient do
|
4
4
|
|
5
|
-
let(:
|
5
|
+
let(:api_token) { "provided-api-token" }
|
6
6
|
let(:max_retries) { 42 }
|
7
7
|
let(:message_hash) {
|
8
8
|
{
|
@@ -16,7 +16,7 @@ describe Postmark::ApiClient do
|
|
16
16
|
end
|
17
17
|
}
|
18
18
|
|
19
|
-
let(:api_client) { Postmark::ApiClient.new(
|
19
|
+
let(:api_client) { Postmark::ApiClient.new(api_token) }
|
20
20
|
subject { api_client }
|
21
21
|
|
22
22
|
context "attr readers" do
|
@@ -32,25 +32,30 @@ describe Postmark::ApiClient do
|
|
32
32
|
|
33
33
|
context "when it's created with user options" do
|
34
34
|
|
35
|
-
subject { Postmark::ApiClient.new(
|
35
|
+
subject { Postmark::ApiClient.new(api_token, :max_retries => max_retries,
|
36
36
|
:foo => :bar)}
|
37
37
|
|
38
38
|
its(:max_retries) { should eq max_retries }
|
39
39
|
|
40
40
|
it 'passes other options to HttpClient instance' do
|
41
|
-
Postmark::HttpClient.should_receive(:new).with(
|
41
|
+
Postmark::HttpClient.should_receive(:new).with(api_token, :foo => :bar)
|
42
42
|
subject.should be
|
43
43
|
end
|
44
44
|
|
45
45
|
end
|
46
46
|
|
47
|
-
describe "#
|
47
|
+
describe "#api_token=" do
|
48
48
|
|
49
|
-
let(:
|
49
|
+
let(:api_token) { "new-api-token-value" }
|
50
50
|
|
51
|
-
it 'assigns the api
|
52
|
-
subject.
|
53
|
-
subject.http_client.
|
51
|
+
it 'assigns the api token to the http client instance' do
|
52
|
+
subject.api_token = api_token
|
53
|
+
subject.http_client.api_token.should == api_token
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'is aliased as api_key=' do
|
57
|
+
subject.api_key = api_token
|
58
|
+
subject.http_client.api_token.should == api_token
|
54
59
|
end
|
55
60
|
|
56
61
|
end
|
@@ -32,8 +32,20 @@ describe Mail::Postmark do
|
|
32
32
|
message.deliver.should eq message
|
33
33
|
end
|
34
34
|
|
35
|
-
it "allows
|
36
|
-
message.delivery_method Mail::Postmark,
|
37
|
-
message.delivery_method.settings[:
|
35
|
+
it "allows setting the api token" do
|
36
|
+
message.delivery_method Mail::Postmark, :api_token => 'api-token'
|
37
|
+
message.delivery_method.settings[:api_token].should == 'api-token'
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'uses provided API token' do
|
41
|
+
message.delivery_method Mail::Postmark, :api_token => 'api-token'
|
42
|
+
Postmark::ApiClient.should_receive(:new).with('api-token', {}).and_return(double(:deliver_message => true))
|
43
|
+
message.deliver
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'uses API token provided as legacy api_key' do
|
47
|
+
message.delivery_method Mail::Postmark, :api_key => 'api-token'
|
48
|
+
Postmark::ApiClient.should_receive(:new).with('api-token', {}).and_return(double(:deliver_message => true))
|
49
|
+
message.deliver
|
38
50
|
end
|
39
51
|
end
|
@@ -6,17 +6,19 @@ describe Postmark::HttpClient do
|
|
6
6
|
body = {"ErrorCode" => status, "Message" => message}.to_json
|
7
7
|
end
|
8
8
|
|
9
|
-
let(:
|
10
|
-
let(:http_client) { Postmark::HttpClient.new(
|
9
|
+
let(:api_token) { "provided-postmark-api-token" }
|
10
|
+
let(:http_client) { Postmark::HttpClient.new(api_token) }
|
11
11
|
subject { http_client }
|
12
12
|
|
13
13
|
context "attr writers" do
|
14
|
+
it { should respond_to(:api_token=) }
|
14
15
|
it { should respond_to(:api_key=) }
|
15
16
|
end
|
16
17
|
|
17
18
|
context "attr readers" do
|
18
19
|
it { should respond_to(:http) }
|
19
20
|
it { should respond_to(:secure) }
|
21
|
+
it { should respond_to(:api_token) }
|
20
22
|
it { should respond_to(:api_key) }
|
21
23
|
it { should respond_to(:proxy_host) }
|
22
24
|
it { should respond_to(:proxy_port) }
|
@@ -30,7 +32,8 @@ describe Postmark::HttpClient do
|
|
30
32
|
end
|
31
33
|
|
32
34
|
context "when it is created without options" do
|
33
|
-
its(:
|
35
|
+
its(:api_token) { should eq api_token }
|
36
|
+
its(:api_key) { should eq api_token }
|
34
37
|
its(:host) { should eq 'api.postmarkapp.com' }
|
35
38
|
its(:port) { should eq 443 }
|
36
39
|
its(:secure) { should be_true }
|
@@ -51,7 +54,7 @@ describe Postmark::HttpClient do
|
|
51
54
|
let(:http_open_timeout) { 42 }
|
52
55
|
let(:http_read_timeout) { 42 }
|
53
56
|
|
54
|
-
subject { Postmark::HttpClient.new(
|
57
|
+
subject { Postmark::HttpClient.new(api_token,
|
55
58
|
:secure => secure,
|
56
59
|
:proxy_host => proxy_host,
|
57
60
|
:proxy_port => proxy_port,
|
@@ -63,7 +66,8 @@ describe Postmark::HttpClient do
|
|
63
66
|
:http_open_timeout => http_open_timeout,
|
64
67
|
:http_read_timeout => http_read_timeout) }
|
65
68
|
|
66
|
-
its(:
|
69
|
+
its(:api_token) { should eq api_token }
|
70
|
+
its(:api_key) { should eq api_token }
|
67
71
|
its(:secure) { should == secure }
|
68
72
|
its(:proxy_host) { should == proxy_host }
|
69
73
|
its(:proxy_port) { should == proxy_port }
|
@@ -86,7 +90,7 @@ describe Postmark::HttpClient do
|
|
86
90
|
FakeWeb.should have_requested(:post, target_url)
|
87
91
|
end
|
88
92
|
|
89
|
-
it "raises a custom error when API
|
93
|
+
it "raises a custom error when API token authorization fails" do
|
90
94
|
FakeWeb.register_uri(:post, target_url, :body => response_body(401),
|
91
95
|
:status => [ "401", "Unauthorized" ])
|
92
96
|
expect { subject.post(target_path) }.to raise_error Postmark::InvalidApiKeyError
|
@@ -128,7 +132,7 @@ describe Postmark::HttpClient do
|
|
128
132
|
FakeWeb.should have_requested(:get, target_url)
|
129
133
|
end
|
130
134
|
|
131
|
-
it "raises a custom error when API
|
135
|
+
it "raises a custom error when API token authorization fails" do
|
132
136
|
FakeWeb.register_uri(:get, target_url, :body => response_body(401),
|
133
137
|
:status => [ "401", "Unauthorized" ])
|
134
138
|
expect { subject.get(target_path) }.to raise_error Postmark::InvalidApiKeyError
|
@@ -169,7 +173,7 @@ describe Postmark::HttpClient do
|
|
169
173
|
FakeWeb.should have_requested(:put, target_url)
|
170
174
|
end
|
171
175
|
|
172
|
-
it "raises a custom error when API
|
176
|
+
it "raises a custom error when API token authorization fails" do
|
173
177
|
FakeWeb.register_uri(:put, target_url, :body => response_body(401),
|
174
178
|
:status => [ "401", "Unauthorized" ])
|
175
179
|
expect { subject.put(target_path) }.to raise_error Postmark::InvalidApiKeyError
|
data/spec/unit/postmark_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Postmark do
|
4
|
-
let(:
|
4
|
+
let(:api_token) { double }
|
5
5
|
let(:secure) { double }
|
6
6
|
let(:proxy_host) { double }
|
7
7
|
let(:proxy_port) { double }
|
@@ -13,7 +13,7 @@ describe Postmark do
|
|
13
13
|
let(:max_retries) { double }
|
14
14
|
|
15
15
|
before do
|
16
|
-
subject.
|
16
|
+
subject.api_token = api_token
|
17
17
|
subject.secure = secure
|
18
18
|
subject.proxy_host = proxy_host
|
19
19
|
subject.proxy_port = proxy_port
|
@@ -28,6 +28,7 @@ describe Postmark do
|
|
28
28
|
context "attr readers" do
|
29
29
|
it { should respond_to(:secure) }
|
30
30
|
it { should respond_to(:api_key) }
|
31
|
+
it { should respond_to(:api_token) }
|
31
32
|
it { should respond_to(:proxy_host) }
|
32
33
|
it { should respond_to(:proxy_port) }
|
33
34
|
it { should respond_to(:proxy_user) }
|
@@ -43,6 +44,7 @@ describe Postmark do
|
|
43
44
|
context "attr writers" do
|
44
45
|
it { should respond_to(:secure=) }
|
45
46
|
it { should respond_to(:api_key=) }
|
47
|
+
it { should respond_to(:api_token=) }
|
46
48
|
it { should respond_to(:proxy_host=) }
|
47
49
|
it { should respond_to(:proxy_port=) }
|
48
50
|
it { should respond_to(:proxy_user=) }
|
@@ -98,7 +100,7 @@ describe Postmark do
|
|
98
100
|
|
99
101
|
it 'creates a new instance of Postmark::ApiClient' do
|
100
102
|
Postmark::ApiClient.should_receive(:new).
|
101
|
-
with(
|
103
|
+
with(api_token,
|
102
104
|
:secure => secure,
|
103
105
|
:proxy_host => proxy_host,
|
104
106
|
:proxy_port => proxy_port,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postmark
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Petyo Ivanov
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2015-01-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|