tax_cloud 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
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,30 +0,0 @@
1
- # Hack Savon to work properly with arrays
2
- module Savon #:nodoc:
3
- module SOAP #:nodoc:
4
- class XML #:nodoc:
5
- private
6
- old_add_namespaces_to_body = self.instance_method(:add_namespaces_to_body)
7
-
8
- def add_namespaces_to_body(hash, path = [input[1].to_s])
9
- return unless hash
10
- return hash if hash.kind_of? Array
11
- return hash.to_s unless hash.kind_of? Hash
12
-
13
- hash.inject({}) do |newhash, (key, value)|
14
- camelcased_key = Gyoku::XMLKey.create(key)
15
- newpath = path + [camelcased_key]
16
-
17
- if used_namespaces[newpath]
18
- newhash.merge(
19
- "#{used_namespaces[newpath]}:#{camelcased_key}" =>
20
- add_namespaces_to_body(value, types[newpath] ? [types[newpath]] : newpath)
21
- )
22
- else
23
- newhash.merge(key => value)
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end
30
-