tax_cloud 0.1.1 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +11 -0
- data/Rakefile +8 -6
- data/lib/tax_cloud/transaction.rb +15 -0
- data/lib/tax_cloud/version.rb +1 -1
- data/tax_cloud.gemspec +9 -8
- data/test/cassettes/authorized.yml +63 -0
- data/test/cassettes/authorized_with_capture.yml +63 -0
- data/test/cassettes/captured.yml +94 -0
- data/test/cassettes/lookup.yml +32 -0
- data/test/cassettes/returned.yml +94 -0
- data/test/cassettes/verify_bad_address.yml +993 -0
- data/test/cassettes/verify_good_address.yml +32 -0
- data/test/helper.rb +9 -0
- data/test/test_address.rb +16 -6
- data/test/test_transaction.rb +29 -12
- metadata +44 -18
@@ -0,0 +1,32 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: https://api.taxcloud.net:443/1.0/TaxCloud.asmx
|
6
|
+
body: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://taxcloud.net" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins0="http://taxcloud.net"><env:Body><ins0:VerifyAddress><wsdl:apiLoginId>api-login-id</wsdl:apiLoginId><wsdl:apiKey>api-key</wsdl:apiKey><ins0:uspsUserID>usps-username</ins0:uspsUserID><ins0:address1>888 6th Ave</ins0:address1><ins0:address2 xsi:nil="true"/><ins0:city>New York</ins0:city><ins0:state>New York</ins0:state><ins0:zip5>10001</ins0:zip5><ins0:zip4 xsi:nil="true"/></ins0:VerifyAddress></env:Body></env:Envelope>
|
7
|
+
headers:
|
8
|
+
soapaction:
|
9
|
+
- "\"http://taxcloud.net/VerifyAddress\""
|
10
|
+
content-type:
|
11
|
+
- text/xml;charset=UTF-8
|
12
|
+
response: !ruby/struct:VCR::Response
|
13
|
+
status: !ruby/struct:VCR::ResponseStatus
|
14
|
+
code: 200
|
15
|
+
message: OK
|
16
|
+
headers:
|
17
|
+
cache-control:
|
18
|
+
- private, max-age=0
|
19
|
+
content-type:
|
20
|
+
- text/xml; charset=utf-8
|
21
|
+
server:
|
22
|
+
- Microsoft-IIS/7.0
|
23
|
+
x-aspnet-version:
|
24
|
+
- 2.0.50727
|
25
|
+
x-powered-by:
|
26
|
+
- TaxCloud
|
27
|
+
date:
|
28
|
+
- Sat, 17 Sep 2011 19:21:55 GMT
|
29
|
+
content-length:
|
30
|
+
- "493"
|
31
|
+
body: <?xml version="1.0" encoding="utf-8"?><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"><soap:Body><VerifyAddressResponse xmlns="http://taxcloud.net"><VerifyAddressResult><Address1>888 6TH AVE</Address1><City>NEW YORK</City><State>NY</State><Zip5>10001</Zip5><Zip4>3502</Zip4><ErrNumber>0</ErrNumber></VerifyAddressResult></VerifyAddressResponse></soap:Body></soap:Envelope>
|
32
|
+
http_version: "1.1"
|
data/test/helper.rb
CHANGED
@@ -16,3 +16,12 @@ Savon.configure do |config|
|
|
16
16
|
# config.log = false
|
17
17
|
end
|
18
18
|
|
19
|
+
require 'vcr'
|
20
|
+
|
21
|
+
VCR.config do |c|
|
22
|
+
c.cassette_library_dir = 'test/cassettes'
|
23
|
+
c.stub_with :webmock
|
24
|
+
c.filter_sensitive_data('api-login-id') { TaxCloud.configuration.api_login_id }
|
25
|
+
c.filter_sensitive_data('api-key') { TaxCloud.configuration.api_key }
|
26
|
+
c.filter_sensitive_data('usps-username') { TaxCloud.configuration.usps_username }
|
27
|
+
end
|
data/test/test_address.rb
CHANGED
@@ -16,13 +16,23 @@ class TestAddress < Test::Unit::TestCase
|
|
16
16
|
assert_equal nil, @address.zip4
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
19
|
+
def test_address_respond_to_verify
|
20
20
|
assert_respond_to @address, :verify
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
verify
|
25
|
-
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_verify_good_address
|
24
|
+
VCR.use_cassette('verify good address') do
|
25
|
+
verify = @address.verify
|
26
|
+
assert_equal '0', verify[:verify_address_response][:verify_address_result][:err_number]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_verify_bad_address
|
31
|
+
VCR.use_cassette('verify bad address') do
|
32
|
+
bad_address = TaxCloud::Address.new :address1 => '10001 Test Street', :city => 'New York', :state => 'New York', :zip5 => '99999'
|
33
|
+
verify = bad_address.verify
|
34
|
+
assert_not_equal '0', verify[:verify_address_response][:verify_address_result][:err_number]
|
35
|
+
end
|
26
36
|
end
|
27
37
|
|
28
38
|
end
|
data/test/test_transaction.rb
CHANGED
@@ -13,27 +13,44 @@ class TestTransaction < Test::Unit::TestCase
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_lookup
|
16
|
-
|
17
|
-
|
16
|
+
VCR.use_cassette('lookup') do
|
17
|
+
result = @transaction.lookup[:lookup_response][:lookup_result]
|
18
|
+
result[:cart_items_response][:cart_item_response].each { |item| assert_not_nil item[:tax_amount] }
|
19
|
+
end
|
18
20
|
end
|
19
21
|
|
20
22
|
def test_authorized
|
21
|
-
|
22
|
-
|
23
|
-
|
23
|
+
VCR.use_cassette('authorized') do
|
24
|
+
@transaction.lookup
|
25
|
+
result = @transaction.authorized
|
26
|
+
assert_equal 'OK', result[:authorized_response][:authorized_result][:response_type]
|
27
|
+
end
|
24
28
|
end
|
25
29
|
|
26
30
|
def test_captured
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
+
VCR.use_cassette('captured') do
|
32
|
+
@transaction.lookup
|
33
|
+
@transaction.authorized
|
34
|
+
result = @transaction.captured
|
35
|
+
assert_equal 'OK', result[:captured_response][:captured_result][:response_type]
|
36
|
+
end
|
31
37
|
end
|
32
38
|
|
33
39
|
def test_authorized_with_capture
|
34
|
-
|
35
|
-
|
36
|
-
|
40
|
+
VCR.use_cassette('authorized_with_capture') do
|
41
|
+
@transaction.lookup
|
42
|
+
result = @transaction.authorized_with_capture
|
43
|
+
assert_equal 'OK', result[:authorized_with_capture_response][:authorized_with_capture_result][:response_type]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_returned
|
48
|
+
VCR.use_cassette('returned') do
|
49
|
+
@transaction.lookup
|
50
|
+
@transaction.authorized_with_capture
|
51
|
+
result = @transaction.returned
|
52
|
+
assert_equal 'OK', result[:returned_response][:returned_result][:response_type]
|
53
|
+
end
|
37
54
|
end
|
38
55
|
|
39
56
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tax_cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-10-20 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: savon
|
16
|
-
requirement: &
|
16
|
+
requirement: &2151871500 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - =
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.9.6
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2151871500
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &2151870160 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,18 +32,40 @@ dependencies:
|
|
32
32
|
version: 0.9.2
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2151870160
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
38
|
-
requirement: &
|
37
|
+
name: rdoc
|
38
|
+
requirement: &2151869060 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
43
|
+
version: 2.5.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2151869060
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: vcr
|
49
|
+
requirement: &2151867800 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.11.3
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *2151867800
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: webmock
|
60
|
+
requirement: &2151866780 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 1.7.6
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *2151866780
|
47
69
|
description: Calculate sales tax using the TaxCloud.net API
|
48
70
|
email:
|
49
71
|
- drewtemp@gmail.com
|
@@ -65,6 +87,13 @@ files:
|
|
65
87
|
- lib/tax_cloud/transaction.rb
|
66
88
|
- lib/tax_cloud/version.rb
|
67
89
|
- tax_cloud.gemspec
|
90
|
+
- test/cassettes/authorized.yml
|
91
|
+
- test/cassettes/authorized_with_capture.yml
|
92
|
+
- test/cassettes/captured.yml
|
93
|
+
- test/cassettes/lookup.yml
|
94
|
+
- test/cassettes/returned.yml
|
95
|
+
- test/cassettes/verify_bad_address.yml
|
96
|
+
- test/cassettes/verify_good_address.yml
|
68
97
|
- test/helper.rb
|
69
98
|
- test/test_address.rb
|
70
99
|
- test/test_cart_item.rb
|
@@ -83,20 +112,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
83
112
|
version: '0'
|
84
113
|
segments:
|
85
114
|
- 0
|
86
|
-
hash: -
|
115
|
+
hash: -3079975514908941734
|
87
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
117
|
none: false
|
89
118
|
requirements:
|
90
119
|
- - ! '>='
|
91
120
|
- !ruby/object:Gem::Version
|
92
|
-
version:
|
93
|
-
segments:
|
94
|
-
- 0
|
95
|
-
hash: -505064777215939407
|
121
|
+
version: 1.3.6
|
96
122
|
requirements: []
|
97
|
-
rubyforge_project:
|
98
|
-
rubygems_version: 1.8.
|
123
|
+
rubyforge_project:
|
124
|
+
rubygems_version: 1.8.11
|
99
125
|
signing_key:
|
100
126
|
specification_version: 3
|
101
|
-
summary: Calculate sales tax using
|
127
|
+
summary: Calculate sales tax using TaxCloud
|
102
128
|
test_files: []
|