stamps 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/stamps/client/account.rb +3 -3
- data/lib/stamps/client/rate.rb +5 -1
- data/lib/stamps/mapping.rb +5 -0
- data/lib/stamps/version.rb +1 -1
- data/test/client/rate_test.rb +14 -0
- data/test/fixtures/GetRatesEmpty.xml +8 -0
- metadata +4 -2
@@ -21,12 +21,12 @@ module Stamps
|
|
21
21
|
response[:errors].empty? ? response[:purchase_postage_response] : response
|
22
22
|
end
|
23
23
|
|
24
|
-
#
|
24
|
+
# Check the payment of purchase_postage
|
25
25
|
#
|
26
26
|
def get_purchase_status(params = {})
|
27
27
|
params[:authenticator] = authenticator_token
|
28
|
-
response = request('
|
29
|
-
response[:errors].empty? ? response[:
|
28
|
+
response = request('GetPurchaseStatus', Stamps::Mapping::GetPurchaseStatus.new(params))
|
29
|
+
response[:errors].empty? ? response[:get_purchase_status_response] : response
|
30
30
|
end
|
31
31
|
|
32
32
|
# Request carrier pickup
|
data/lib/stamps/client/rate.rb
CHANGED
@@ -25,7 +25,11 @@ module Stamps
|
|
25
25
|
:rate => Stamps::Mapping::Rate.new(params)
|
26
26
|
})
|
27
27
|
response = request('GetRates', rates)
|
28
|
-
response[:get_rates_response].nil?
|
28
|
+
if response[:get_rates_response].nil?
|
29
|
+
response
|
30
|
+
else
|
31
|
+
response[:get_rates_response][:rates].nil? ? [] : [response[:get_rates_response][:rates][:rate]].flatten
|
32
|
+
end
|
29
33
|
end
|
30
34
|
|
31
35
|
def get_rate(params = {})
|
data/lib/stamps/mapping.rb
CHANGED
@@ -197,6 +197,11 @@ module Stamps
|
|
197
197
|
property :PurchaseAmount, :from => :amount
|
198
198
|
property :ControlTotal, :from => :control_total
|
199
199
|
end
|
200
|
+
|
201
|
+
class GetPurchaseStatus < Hashie::Trash
|
202
|
+
property :Authenticator, :from => :authenticator
|
203
|
+
property :TransactionID, :from => :transaction_id
|
204
|
+
end
|
200
205
|
|
201
206
|
class CancelStamp< Hashie::Trash
|
202
207
|
property :Authenticator, :from => :authenticator
|
data/lib/stamps/version.rb
CHANGED
data/test/client/rate_test.rb
CHANGED
@@ -41,5 +41,19 @@ class StampsTest < Test::Unit::TestCase
|
|
41
41
|
assert_equal Hash, @rate[:add_ons].class
|
42
42
|
end
|
43
43
|
end
|
44
|
+
|
45
|
+
context '.get_rates with no rates available' do
|
46
|
+
setup do
|
47
|
+
stub_request(:post, Stamps.endpoint).
|
48
|
+
with(:headers => {"SoapAction" => "#{Stamps.namespace}/GetRates"}).
|
49
|
+
to_return(:body => fixture("GetRatesEmpty.xml"))
|
50
|
+
@rates = Stamps.get_rates
|
51
|
+
end
|
52
|
+
|
53
|
+
should 'return an empty array' do
|
54
|
+
assert_equal Array, @rates.class
|
55
|
+
assert_empty @rates
|
56
|
+
end
|
57
|
+
end
|
44
58
|
end
|
45
59
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
3
|
+
<soap:Body>
|
4
|
+
<GetRatesResponse xmlns="http://stamps.com/xml/namespace/2010/11/swsim/swsimv12">
|
5
|
+
<Authenticator>NNOUiINH+k4irLzmCD8AtTk17eA=</Authenticator>
|
6
|
+
</GetRatesResponse>
|
7
|
+
</soap:Body>
|
8
|
+
</soap:Envelope>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stamps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
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: 2014-
|
12
|
+
date: 2014-04-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: simplecov
|
@@ -277,6 +277,7 @@ files:
|
|
277
277
|
- test/fixtures/GetAccountInfo.xml
|
278
278
|
- test/fixtures/GetRate.xml
|
279
279
|
- test/fixtures/GetRates.xml
|
280
|
+
- test/fixtures/GetRatesEmpty.xml
|
280
281
|
- test/fixtures/InsufficientPostage.xml
|
281
282
|
- test/fixtures/InvalidSoap.xml
|
282
283
|
- test/fixtures/PurchasePostage.xml
|
@@ -325,6 +326,7 @@ test_files:
|
|
325
326
|
- test/fixtures/GetAccountInfo.xml
|
326
327
|
- test/fixtures/GetRate.xml
|
327
328
|
- test/fixtures/GetRates.xml
|
329
|
+
- test/fixtures/GetRatesEmpty.xml
|
328
330
|
- test/fixtures/InsufficientPostage.xml
|
329
331
|
- test/fixtures/InvalidSoap.xml
|
330
332
|
- test/fixtures/PurchasePostage.xml
|