tax_cloud 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. data/.travis.yml +9 -0
  2. data/CHANGELOG.rdoc +28 -0
  3. data/CONTRIBUTORS.txt +20 -0
  4. data/Gemfile +1 -1
  5. data/LICENSE.rdoc +22 -0
  6. data/README.rdoc +112 -28
  7. data/Rakefile +10 -2
  8. data/lib/config/locales/en.yml +34 -0
  9. data/lib/hash.rb +8 -6
  10. data/lib/savon_soap_xml.rb +33 -0
  11. data/lib/tasks/tax_cloud.rake +20 -0
  12. data/lib/tasks/tax_code_groups.rake +39 -0
  13. data/lib/tasks/tax_codes.rake +45 -0
  14. data/lib/tax_cloud.rb +43 -16
  15. data/lib/tax_cloud/address.rb +30 -17
  16. data/lib/tax_cloud/cart_item.rb +13 -19
  17. data/lib/tax_cloud/client.rb +48 -0
  18. data/lib/tax_cloud/configuration.rb +17 -2
  19. data/lib/tax_cloud/errors.rb +6 -0
  20. data/lib/tax_cloud/errors/api_error.rb +18 -0
  21. data/lib/tax_cloud/errors/missing_config_error.rb +13 -0
  22. data/lib/tax_cloud/errors/missing_config_option_error.rb +19 -0
  23. data/lib/tax_cloud/errors/soap_error.rb +33 -0
  24. data/lib/tax_cloud/errors/tax_cloud_error.rb +86 -0
  25. data/lib/tax_cloud/errors/unexpected_soap_response_error.rb +23 -0
  26. data/lib/tax_cloud/record.rb +14 -0
  27. data/lib/tax_cloud/responses.rb +13 -0
  28. data/lib/tax_cloud/responses/authorized.rb +10 -0
  29. data/lib/tax_cloud/responses/authorized_with_capture.rb +10 -0
  30. data/lib/tax_cloud/responses/base.rb +88 -0
  31. data/lib/tax_cloud/responses/captured.rb +11 -0
  32. data/lib/tax_cloud/responses/cart_item.rb +24 -0
  33. data/lib/tax_cloud/responses/generic.rb +35 -0
  34. data/lib/tax_cloud/responses/lookup.rb +41 -0
  35. data/lib/tax_cloud/responses/ping.rb +10 -0
  36. data/lib/tax_cloud/responses/returned.rb +10 -0
  37. data/lib/tax_cloud/responses/tax_code_groups.rb +33 -0
  38. data/lib/tax_cloud/responses/tax_codes.rb +33 -0
  39. data/lib/tax_cloud/responses/tax_codes_by_group.rb +33 -0
  40. data/lib/tax_cloud/responses/verify_address.rb +29 -0
  41. data/lib/tax_cloud/tax_code.rb +11 -0
  42. data/lib/tax_cloud/tax_code_constants.rb +562 -0
  43. data/lib/tax_cloud/tax_code_group.rb +30 -0
  44. data/lib/tax_cloud/tax_code_group_constants.rb +31 -0
  45. data/lib/tax_cloud/tax_code_groups.rb +28 -0
  46. data/lib/tax_cloud/tax_codes.rb +24 -47
  47. data/lib/tax_cloud/transaction.rb +39 -34
  48. data/lib/tax_cloud/version.rb +3 -3
  49. data/tax_cloud.gemspec +7 -5
  50. data/test/cassettes/authorized.yml +70 -45
  51. data/test/cassettes/authorized_with_capture.yml +70 -45
  52. data/test/cassettes/captured.yml +101 -67
  53. data/test/cassettes/get_tic_groups.yml +656 -0
  54. data/test/cassettes/get_tics.yml +952 -0
  55. data/test/cassettes/get_tics_by_group.yml +49 -0
  56. data/test/cassettes/invalid_soap_call.yml +651 -0
  57. data/test/cassettes/lookup.yml +644 -25
  58. data/test/cassettes/lookup_ny.yml +651 -0
  59. data/test/cassettes/ping.yml +647 -0
  60. data/test/cassettes/ping_with_invalid_credentials.yml +647 -0
  61. data/test/cassettes/ping_with_invalid_response.yml +647 -0
  62. data/test/cassettes/returned.yml +101 -67
  63. data/test/cassettes/verify_bad_address.yml +578 -976
  64. data/test/cassettes/verify_good_address.yml +36 -23
  65. data/test/helper.rb +4 -19
  66. data/test/test_address.rb +25 -7
  67. data/test/test_client.rb +29 -0
  68. data/test/test_configuration.rb +33 -0
  69. data/test/test_setup.rb +18 -0
  70. data/test/test_soap.rb +13 -0
  71. data/test/test_tax_code_groups.rb +31 -0
  72. data/test/test_tax_codes.rb +19 -0
  73. data/test/test_transaction.rb +22 -11
  74. data/test/test_transaction_ny.rb +27 -0
  75. data/test/vcr_setup.rb +9 -0
  76. metadata +134 -24
  77. data/lib/savon_xml_override.rb +0 -30
@@ -1,32 +1,45 @@
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:
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.taxcloud.net/1.0/TaxCloud.asmx
6
+ body:
7
+ encoding: UTF-8
8
+ string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
9
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://taxcloud.net"
10
+ 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
11
+ 6th Ave</ins0:address1><ins0:address2 xsi:nil="true"/><ins0:city>New York</ins0:city><ins0:state>New
12
+ York</ins0:state><ins0:zip5>10001</ins0:zip5><ins0:zip4 xsi:nil="true"/></ins0:VerifyAddress></env:Body></env:Envelope>
13
+ headers:
14
+ Soapaction:
15
+ - ! '"http://taxcloud.net/VerifyAddress"'
16
+ Content-Type:
11
17
  - text/xml;charset=UTF-8
12
- response: !ruby/struct:VCR::Response
13
- status: !ruby/struct:VCR::ResponseStatus
18
+ response:
19
+ status:
14
20
  code: 200
15
21
  message: OK
16
- headers:
17
- cache-control:
22
+ headers:
23
+ Cache-Control:
18
24
  - private, max-age=0
19
- content-type:
25
+ Content-Type:
20
26
  - text/xml; charset=utf-8
21
- server:
27
+ Server:
22
28
  - Microsoft-IIS/7.0
23
- x-aspnet-version:
29
+ X-Aspnet-Version:
24
30
  - 2.0.50727
25
- x-powered-by:
31
+ X-Powered-By:
26
32
  - TaxCloud
27
- date:
33
+ Date:
28
34
  - 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"
35
+ Content-Length:
36
+ - '493'
37
+ body:
38
+ encoding: UTF-8
39
+ string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
40
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><VerifyAddressResponse
41
+ xmlns="http://taxcloud.net"><VerifyAddressResult><Address1>888 6TH AVE</Address1><City>NEW
42
+ YORK</City><State>NY</State><Zip5>10001</Zip5><Zip4>3502</Zip4><ErrNumber>0</ErrNumber></VerifyAddressResult></VerifyAddressResponse></soap:Body></soap:Envelope>
43
+ http_version: '1.1'
44
+ recorded_at: Fri, 23 Nov 2012 15:41:40 GMT
45
+ recorded_with: VCR 2.3.0
@@ -2,26 +2,11 @@ require 'test/unit'
2
2
  require 'tax_cloud'
3
3
  require 'json'
4
4
 
5
- class Test::Unit::TestCase
6
- def setup
7
- TaxCloud.configure do |config|
8
- config.api_login_id = 'taxcloud_api_login_id'
9
- config.api_key = 'taxcloud_api_key'
10
- config.usps_username = 'usps_username'
11
- end
12
- end
13
- end
14
-
15
5
  Savon.configure do |config|
16
- # config.log = false
6
+ config.log = false
17
7
  end
18
8
 
19
- require 'vcr'
9
+ HTTPI.log = false
20
10
 
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
11
+ require 'vcr_setup'
12
+ require 'test_setup'
@@ -1,6 +1,6 @@
1
1
  require 'helper'
2
2
 
3
- class TestAddress < Test::Unit::TestCase
3
+ class TestAddress < TestSetup
4
4
 
5
5
  def setup
6
6
  super
@@ -16,23 +16,41 @@ class TestAddress < Test::Unit::TestCase
16
16
  assert_equal nil, @address.zip4
17
17
  end
18
18
 
19
+ def test_zip
20
+ assert_equal '10001', @address.zip
21
+ # 9-digit zip
22
+ @address.zip4 = '1234'
23
+ assert_equal '10001-1234', @address.zip
24
+ # only 4-digit zip, which is invalid
25
+ @address.zip5 = nil
26
+ assert_equal nil, @address.zip
27
+ end
28
+
19
29
  def test_address_respond_to_verify
20
30
  assert_respond_to @address, :verify
21
31
  end
22
32
 
23
33
  def test_verify_good_address
24
34
  VCR.use_cassette('verify good address') do
25
- verify = @address.verify
26
- assert_equal '0', verify[:verify_address_response][:verify_address_result][:err_number]
35
+ verified = @address.verify
36
+ assert_instance_of TaxCloud::Address, verified
37
+ assert_equal '888 6TH AVE', verified.address1
38
+ assert_equal nil, verified.address2
39
+ assert_equal 'NEW YORK', verified.city
40
+ assert_equal 'NY', verified.state
41
+ assert_equal '10001', verified.zip5
42
+ assert_equal '3502', verified.zip4
27
43
  end
28
44
  end
29
45
 
30
46
  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]
47
+ e = assert_raise TaxCloud::Errors::ApiError do
48
+ VCR.use_cassette('verify bad address') do
49
+ bad_address = TaxCloud::Address.new :address1 => '10001 Test Street', :city => 'New York', :state => 'New York', :zip5 => '99999'
50
+ verify = bad_address.verify
51
+ end
35
52
  end
53
+ assert_equal e.problem, "Invalid Zip Code."
36
54
  end
37
55
 
38
56
  end
@@ -0,0 +1,29 @@
1
+ require 'helper'
2
+
3
+ class TestClient < TestSetup
4
+
5
+ def test_ping_with_invalid_credentials
6
+ assert_raise TaxCloud::Errors::ApiError do
7
+ VCR.use_cassette('ping_with_invalid_credentials') do
8
+ TaxCloud.client.ping
9
+ end
10
+ end
11
+ end
12
+
13
+ def test_ping_with_invalid_response
14
+ e = assert_raise TaxCloud::Errors::UnexpectedSoapResponse do
15
+ VCR.use_cassette('ping_with_invalid_response') do
16
+ TaxCloud.client.ping
17
+ end
18
+ end
19
+ assert_equal "Expected a value for `ping_result` in `ping_response/ping_result/response_type` in the TaxCloud response.", e.problem
20
+ end
21
+
22
+ def test_ping
23
+ VCR.use_cassette('ping') do
24
+ response = TaxCloud.client.ping
25
+ assert_equal "OK", response
26
+ end
27
+ end
28
+
29
+ end
@@ -0,0 +1,33 @@
1
+ require 'helper'
2
+
3
+ class TestConfiguration < Test::Unit::TestCase
4
+
5
+ def setup
6
+ TaxCloud.reset!
7
+ end
8
+
9
+ def test_missing_configuration
10
+ assert_raise TaxCloud::Errors::MissingConfig do
11
+ TaxCloud.client.request :dummy, :body => {}
12
+ end
13
+ end
14
+
15
+ def test_mising_api_login_id
16
+ TaxCloud.configure do |config|
17
+ config.api_key = 'taxcloud_api_key'
18
+ end
19
+ assert_raise TaxCloud::Errors::MissingConfigOption do
20
+ TaxCloud.client.request :dummy, :body => {}
21
+ end
22
+ end
23
+
24
+ def test_mising_api_key
25
+ TaxCloud.configure do |config|
26
+ config.api_login_id = 'taxcloud_api_login_id'
27
+ end
28
+ assert_raise TaxCloud::Errors::MissingConfigOption do
29
+ TaxCloud.client.request :dummy, :body => {}
30
+ end
31
+ end
32
+
33
+ end
@@ -0,0 +1,18 @@
1
+ class TestSetup < Test::Unit::TestCase
2
+
3
+ def default_test
4
+ # placeholder to avoid error under Ruby 1.8.7
5
+ end
6
+
7
+ def setup
8
+ TaxCloud.configure do |config|
9
+ config.api_login_id = ENV['TAXCLOUD_API_LOGIN_ID'] || 'taxcloud_api_login_id'
10
+ config.api_key = ENV['TAXCLOUD_API_KEY'] || 'taxcloud_api_key'
11
+ config.usps_username = ENV['TAXCLOUD_USPS_USERNAME'] || 'usps_username'
12
+ end
13
+ end
14
+
15
+ def teardown
16
+ TaxCloud.reset!
17
+ end
18
+ end
@@ -0,0 +1,13 @@
1
+ require 'helper'
2
+
3
+ class TestSoap < TestSetup
4
+
5
+ def test_invalid_soap_call
6
+ assert_raise TaxCloud::Errors::SoapError do
7
+ VCR.use_cassette('invalid_soap_call') do
8
+ TaxCloud.client.request :invalid, :body => {}
9
+ end
10
+ end
11
+ end
12
+
13
+ end
@@ -0,0 +1,31 @@
1
+ require 'helper'
2
+
3
+ class TestTaxCodeGroups < TestSetup
4
+
5
+ def test_all
6
+ VCR.use_cassette('get_tic_groups') do
7
+ assert TaxCloud::TaxCode::Groups.all.count > 0
8
+ end
9
+ end
10
+
11
+ def test_lookup
12
+ VCR.use_cassette('get_tic_groups') do
13
+ tax_code_group = TaxCloud::TaxCode::Groups[TaxCloud::TaxCode::Groups::SCHOOL_RELATED_PRODUCTS]
14
+ assert_equal TaxCloud::TaxCode::Groups::SCHOOL_RELATED_PRODUCTS, tax_code_group.group_id
15
+ assert_equal "School Related Products", tax_code_group.description
16
+ end
17
+ end
18
+
19
+ def test_lookup_tax_codes
20
+ tax_code_group = VCR.use_cassette('get_tic_groups') do
21
+ TaxCloud::TaxCode::Groups[TaxCloud::TaxCode::Groups::SCHOOL_RELATED_PRODUCTS]
22
+ end
23
+ VCR.use_cassette('get_tics_by_group') do
24
+ assert tax_code_group.tax_codes.count > 0
25
+ tax_code = tax_code_group[TaxCloud::TaxCodes::SCHOOL_INSTRUCTIONAL_MATERIAL]
26
+ assert_equal TaxCloud::TaxCodes::SCHOOL_INSTRUCTIONAL_MATERIAL, tax_code.ticid
27
+ assert_equal "School instructional material", tax_code.description
28
+ end
29
+ end
30
+
31
+ end
@@ -0,0 +1,19 @@
1
+ require 'helper'
2
+
3
+ class TestTaxCode < TestSetup
4
+
5
+ def test_all
6
+ VCR.use_cassette('get_tics') do
7
+ assert TaxCloud::TaxCodes.all.count > 0
8
+ end
9
+ end
10
+
11
+ def test_lookup
12
+ VCR.use_cassette('get_tics') do
13
+ tax_code = TaxCloud::TaxCodes[TaxCloud::TaxCodes::DIRECT_MAIL_RELATED]
14
+ assert_equal TaxCloud::TaxCodes::DIRECT_MAIL_RELATED, tax_code.ticid
15
+ assert_equal "Direct-mail related", tax_code.description
16
+ end
17
+ end
18
+
19
+ end
@@ -1,21 +1,32 @@
1
1
  require 'helper'
2
2
 
3
- class TestTransaction < Test::Unit::TestCase
3
+ class TestTransaction < TestSetup
4
4
 
5
5
  def setup
6
6
  super
7
- origin = TaxCloud::Address.new :address1 => '888 6th Ave', :city => 'New York', :state => 'NY', :zip5 => '10001'
8
- destination = TaxCloud::Address.new :address1 => '888 6th Ave', :city => 'New York', :state => 'NY', :zip5 => '10001'
7
+ origin = TaxCloud::Address.new(:address1 => '162 East Avenue', :address2 => 'Third Floor', :city => 'Norwalk', :state => 'CT', :zip5 => '06851')
8
+ destination = TaxCloud::Address.new(:address1 => '3121 West Government Way', :address2 => 'Suite 2B', :city => 'Seattle', :state => 'WA', :zip5 => '98199')
9
9
  cart_items = []
10
10
  cart_items << TaxCloud::CartItem.new(:index => 0, :item_id => 'SKU-TEST', :tic => TaxCloud::TaxCodes::GENERAL, :quantity => 1, :price => 50.00)
11
- cart_items << TaxCloud::CartItem.new(:index => 1, :item_id => 'SKU-TEST1', :tic => TaxCloud::TaxCodes::GENERAL, :quantity => 1, :price => 50.00)
12
- @transaction = TaxCloud::Transaction.new(:customer_id => rand(9999), :cart_id => rand(9999), :order_id => rand(9999), :cart_items => cart_items, :origin => origin, :destination => destination)
11
+ cart_items << TaxCloud::CartItem.new(:index => 1, :item_id => 'SKU-TEST1', :tic => TaxCloud::TaxCodes::GENERAL, :quantity => 1, :price => 100.00)
12
+ @transaction = TaxCloud::Transaction.new(:customer_id => 42, :cart_id => 708, :order_id => 2361, :cart_items => cart_items, :origin => origin, :destination => destination)
13
13
  end
14
14
 
15
15
  def test_lookup
16
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] }
17
+ result = @transaction.lookup
18
+ assert_instance_of TaxCloud::Responses::Lookup, result
19
+ assert_equal '708', result.cart_id
20
+ assert_equal 2, result.cart_items.count
21
+ result.cart_items.first.tap do |item|
22
+ assert_equal 0, item.cart_item_index
23
+ assert_equal 4.75, item.tax_amount
24
+ end
25
+ result.cart_items.last.tap do |item|
26
+ assert_equal 1, item.cart_item_index
27
+ assert_equal 9.5, item.tax_amount
28
+ end
29
+ assert_equal 14.25, result.tax_amount
19
30
  end
20
31
  end
21
32
 
@@ -23,7 +34,7 @@ class TestTransaction < Test::Unit::TestCase
23
34
  VCR.use_cassette('authorized') do
24
35
  @transaction.lookup
25
36
  result = @transaction.authorized
26
- assert_equal 'OK', result[:authorized_response][:authorized_result][:response_type]
37
+ assert_equal 'OK', result
27
38
  end
28
39
  end
29
40
 
@@ -32,7 +43,7 @@ class TestTransaction < Test::Unit::TestCase
32
43
  @transaction.lookup
33
44
  @transaction.authorized
34
45
  result = @transaction.captured
35
- assert_equal 'OK', result[:captured_response][:captured_result][:response_type]
46
+ assert_equal 'OK', result
36
47
  end
37
48
  end
38
49
 
@@ -40,7 +51,7 @@ class TestTransaction < Test::Unit::TestCase
40
51
  VCR.use_cassette('authorized_with_capture') do
41
52
  @transaction.lookup
42
53
  result = @transaction.authorized_with_capture
43
- assert_equal 'OK', result[:authorized_with_capture_response][:authorized_with_capture_result][:response_type]
54
+ assert_equal 'OK', result
44
55
  end
45
56
  end
46
57
 
@@ -49,7 +60,7 @@ class TestTransaction < Test::Unit::TestCase
49
60
  @transaction.lookup
50
61
  @transaction.authorized_with_capture
51
62
  result = @transaction.returned
52
- assert_equal 'OK', result[:returned_response][:returned_result][:response_type]
63
+ assert_equal 'OK', result
53
64
  end
54
65
  end
55
66
 
@@ -0,0 +1,27 @@
1
+ require 'helper'
2
+
3
+ class TestTransaction < TestSetup
4
+
5
+ def setup
6
+ super
7
+ origin = TaxCloud::Address.new :address1 => '888 6th Ave', :city => 'New York', :state => 'NY', :zip5 => '10001'
8
+ destination = TaxCloud::Address.new :address1 => '888 6th Ave', :city => 'New York', :state => 'NY', :zip5 => '10001'
9
+ cart_items = [ TaxCloud::CartItem.new(:index => 0, :item_id => 'SKU-TEST', :tic => TaxCloud::TaxCodes::GENERAL, :quantity => 1, :price => 50.00) ]
10
+ @transaction = TaxCloud::Transaction.new(:customer_id => 42, :cart_id => 708, :order_id => 2361, :cart_items => cart_items, :origin => origin, :destination => destination)
11
+ end
12
+
13
+ def test_lookup_non_ssuta_state
14
+ VCR.use_cassette('lookup_ny') do
15
+ result = @transaction.lookup
16
+ assert_instance_of TaxCloud::Responses::Lookup, result
17
+ assert_equal '708', result.cart_id
18
+ assert_equal 1, result.cart_items.count
19
+ result.cart_items.first.tap do |item|
20
+ assert_equal 0, item.cart_item_index
21
+ assert_equal 0, item.tax_amount
22
+ end
23
+ assert_equal 0, result.tax_amount
24
+ end
25
+ end
26
+
27
+ end
@@ -0,0 +1,9 @@
1
+ require 'vcr'
2
+
3
+ VCR.configure do |c|
4
+ c.cassette_library_dir = 'test/cassettes'
5
+ c.hook_into :webmock
6
+ c.filter_sensitive_data('api-login-id') { TaxCloud.configuration.api_login_id }
7
+ c.filter_sensitive_data('api-key') { TaxCloud.configuration.api_key }
8
+ c.filter_sensitive_data('usps-username') { TaxCloud.configuration.usps_username }
9
+ 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
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,33 +9,75 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-20 00:00:00.000000000Z
12
+ date: 2011-10-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: savon
16
- requirement: &2151871500 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - =
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 0.9.6
21
+ version: 1.2.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2151871500
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 1.2.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: i18n
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '0.6'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '0.6'
46
+ - !ruby/object:Gem::Dependency
47
+ name: activesupport
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '3.0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
25
62
  - !ruby/object:Gem::Dependency
26
63
  name: rake
27
- requirement: &2151870160 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
28
65
  none: false
29
66
  requirements:
30
- - - ! '>='
67
+ - - ~>
31
68
  - !ruby/object:Gem::Version
32
- version: 0.9.2
69
+ version: '10.0'
33
70
  type: :development
34
71
  prerelease: false
35
- version_requirements: *2151870160
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '10.0'
36
78
  - !ruby/object:Gem::Dependency
37
79
  name: rdoc
38
- requirement: &2151869060 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
39
81
  none: false
40
82
  requirements:
41
83
  - - ! '>='
@@ -43,29 +85,44 @@ dependencies:
43
85
  version: 2.5.0
44
86
  type: :development
45
87
  prerelease: false
46
- version_requirements: *2151869060
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: 2.5.0
47
94
  - !ruby/object:Gem::Dependency
48
95
  name: vcr
49
- requirement: &2151867800 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
50
97
  none: false
51
98
  requirements:
52
- - - ! '>='
99
+ - - ~>
53
100
  - !ruby/object:Gem::Version
54
- version: 1.11.3
101
+ version: '2.3'
55
102
  type: :development
56
103
  prerelease: false
57
- version_requirements: *2151867800
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '2.3'
58
110
  - !ruby/object:Gem::Dependency
59
111
  name: webmock
60
- requirement: &2151866780 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
61
113
  none: false
62
114
  requirements:
63
- - - ! '>='
115
+ - - ~>
64
116
  - !ruby/object:Gem::Version
65
- version: 1.7.6
117
+ version: 1.8.0
66
118
  type: :development
67
119
  prerelease: false
68
- version_requirements: *2151866780
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: 1.8.0
69
126
  description: Calculate sales tax using the TaxCloud.net API
70
127
  email:
71
128
  - drewtemp@gmail.com
@@ -74,15 +131,51 @@ extensions: []
74
131
  extra_rdoc_files: []
75
132
  files:
76
133
  - .gitignore
134
+ - .travis.yml
135
+ - CHANGELOG.rdoc
136
+ - CONTRIBUTORS.txt
77
137
  - Gemfile
138
+ - LICENSE.rdoc
78
139
  - README.rdoc
79
140
  - Rakefile
141
+ - lib/config/locales/en.yml
80
142
  - lib/hash.rb
81
- - lib/savon_xml_override.rb
143
+ - lib/savon_soap_xml.rb
144
+ - lib/tasks/tax_cloud.rake
145
+ - lib/tasks/tax_code_groups.rake
146
+ - lib/tasks/tax_codes.rake
82
147
  - lib/tax_cloud.rb
83
148
  - lib/tax_cloud/address.rb
84
149
  - lib/tax_cloud/cart_item.rb
150
+ - lib/tax_cloud/client.rb
85
151
  - lib/tax_cloud/configuration.rb
152
+ - lib/tax_cloud/errors.rb
153
+ - lib/tax_cloud/errors/api_error.rb
154
+ - lib/tax_cloud/errors/missing_config_error.rb
155
+ - lib/tax_cloud/errors/missing_config_option_error.rb
156
+ - lib/tax_cloud/errors/soap_error.rb
157
+ - lib/tax_cloud/errors/tax_cloud_error.rb
158
+ - lib/tax_cloud/errors/unexpected_soap_response_error.rb
159
+ - lib/tax_cloud/record.rb
160
+ - lib/tax_cloud/responses.rb
161
+ - lib/tax_cloud/responses/authorized.rb
162
+ - lib/tax_cloud/responses/authorized_with_capture.rb
163
+ - lib/tax_cloud/responses/base.rb
164
+ - lib/tax_cloud/responses/captured.rb
165
+ - lib/tax_cloud/responses/cart_item.rb
166
+ - lib/tax_cloud/responses/generic.rb
167
+ - lib/tax_cloud/responses/lookup.rb
168
+ - lib/tax_cloud/responses/ping.rb
169
+ - lib/tax_cloud/responses/returned.rb
170
+ - lib/tax_cloud/responses/tax_code_groups.rb
171
+ - lib/tax_cloud/responses/tax_codes.rb
172
+ - lib/tax_cloud/responses/tax_codes_by_group.rb
173
+ - lib/tax_cloud/responses/verify_address.rb
174
+ - lib/tax_cloud/tax_code.rb
175
+ - lib/tax_cloud/tax_code_constants.rb
176
+ - lib/tax_cloud/tax_code_group.rb
177
+ - lib/tax_cloud/tax_code_group_constants.rb
178
+ - lib/tax_cloud/tax_code_groups.rb
86
179
  - lib/tax_cloud/tax_codes.rb
87
180
  - lib/tax_cloud/transaction.rb
88
181
  - lib/tax_cloud/version.rb
@@ -90,16 +183,33 @@ files:
90
183
  - test/cassettes/authorized.yml
91
184
  - test/cassettes/authorized_with_capture.yml
92
185
  - test/cassettes/captured.yml
186
+ - test/cassettes/get_tic_groups.yml
187
+ - test/cassettes/get_tics.yml
188
+ - test/cassettes/get_tics_by_group.yml
189
+ - test/cassettes/invalid_soap_call.yml
93
190
  - test/cassettes/lookup.yml
191
+ - test/cassettes/lookup_ny.yml
192
+ - test/cassettes/ping.yml
193
+ - test/cassettes/ping_with_invalid_credentials.yml
194
+ - test/cassettes/ping_with_invalid_response.yml
94
195
  - test/cassettes/returned.yml
95
196
  - test/cassettes/verify_bad_address.yml
96
197
  - test/cassettes/verify_good_address.yml
97
198
  - test/helper.rb
98
199
  - test/test_address.rb
99
200
  - test/test_cart_item.rb
201
+ - test/test_client.rb
202
+ - test/test_configuration.rb
203
+ - test/test_setup.rb
204
+ - test/test_soap.rb
205
+ - test/test_tax_code_groups.rb
206
+ - test/test_tax_codes.rb
100
207
  - test/test_transaction.rb
208
+ - test/test_transaction_ny.rb
209
+ - test/vcr_setup.rb
101
210
  homepage: https://github.com/drewtempelmeyer/tax_cloud
102
- licenses: []
211
+ licenses:
212
+ - MIT
103
213
  post_install_message:
104
214
  rdoc_options: []
105
215
  require_paths:
@@ -112,7 +222,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
222
  version: '0'
113
223
  segments:
114
224
  - 0
115
- hash: -3079975514908941734
225
+ hash: 4412103913124079115
116
226
  required_rubygems_version: !ruby/object:Gem::Requirement
117
227
  none: false
118
228
  requirements:
@@ -121,7 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
231
  version: 1.3.6
122
232
  requirements: []
123
233
  rubyforge_project:
124
- rubygems_version: 1.8.11
234
+ rubygems_version: 1.8.24
125
235
  signing_key:
126
236
  specification_version: 3
127
237
  summary: Calculate sales tax using TaxCloud