braintree 2.4.0 → 2.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/README.rdoc +4 -0
  2. data/lib/braintree.rb +43 -32
  3. data/lib/braintree/add_on.rb +4 -0
  4. data/lib/braintree/address.rb +18 -72
  5. data/lib/braintree/address_gateway.rb +76 -0
  6. data/lib/braintree/advanced_search.rb +31 -13
  7. data/lib/braintree/base_module.rb +6 -0
  8. data/lib/braintree/configuration.rb +57 -39
  9. data/lib/braintree/credit_card.rb +75 -129
  10. data/lib/braintree/credit_card_gateway.rb +133 -0
  11. data/lib/braintree/credit_card_verification.rb +8 -0
  12. data/lib/braintree/customer.rb +70 -123
  13. data/lib/braintree/customer_gateway.rb +121 -0
  14. data/lib/braintree/digest.rb +2 -2
  15. data/lib/braintree/discount.rb +4 -0
  16. data/lib/braintree/error_codes.rb +50 -5
  17. data/lib/braintree/error_result.rb +4 -18
  18. data/lib/braintree/errors.rb +1 -2
  19. data/lib/braintree/exceptions.rb +11 -16
  20. data/lib/braintree/gateway.rb +39 -0
  21. data/lib/braintree/http.rb +30 -26
  22. data/lib/braintree/modification.rb +23 -0
  23. data/lib/braintree/resource_collection.rb +1 -1
  24. data/lib/braintree/subscription.rb +29 -129
  25. data/lib/braintree/subscription_gateway.rb +122 -0
  26. data/lib/braintree/subscription_search.rb +6 -7
  27. data/lib/braintree/successful_result.rb +1 -12
  28. data/lib/braintree/test/credit_card_numbers.rb +4 -2
  29. data/lib/braintree/test/transaction_amounts.rb +3 -0
  30. data/lib/braintree/transaction.rb +83 -243
  31. data/lib/braintree/transaction/credit_card_details.rb +4 -4
  32. data/lib/braintree/transaction_gateway.rb +124 -0
  33. data/lib/braintree/transaction_search.rb +5 -3
  34. data/lib/braintree/transparent_redirect.rb +19 -112
  35. data/lib/braintree/transparent_redirect_gateway.rb +105 -0
  36. data/lib/braintree/util.rb +4 -0
  37. data/lib/braintree/validation_error.rb +1 -0
  38. data/lib/braintree/validation_error_collection.rb +5 -23
  39. data/lib/braintree/version.rb +2 -2
  40. data/lib/braintree/xml/parser.rb +1 -1
  41. data/lib/braintree/xml/rexml.rb +2 -2
  42. data/spec/integration/braintree/advanced_search_spec.rb +532 -0
  43. data/spec/integration/braintree/credit_card_spec.rb +5 -8
  44. data/spec/integration/braintree/http_spec.rb +53 -39
  45. data/spec/integration/braintree/subscription_spec.rb +678 -213
  46. data/spec/integration/braintree/transaction_search_spec.rb +318 -43
  47. data/spec/integration/braintree/transaction_spec.rb +134 -3
  48. data/spec/integration/braintree/transparent_redirect_spec.rb +1 -1
  49. data/spec/spec_helper.rb +55 -4
  50. data/spec/unit/braintree/address_spec.rb +8 -8
  51. data/spec/unit/braintree/base_module_spec.rb +1 -1
  52. data/spec/unit/braintree/configuration_spec.rb +34 -29
  53. data/spec/unit/braintree/credit_card_spec.rb +14 -12
  54. data/spec/unit/braintree/credit_card_verification_spec.rb +16 -0
  55. data/spec/unit/braintree/customer_spec.rb +10 -8
  56. data/spec/unit/braintree/digest_spec.rb +8 -17
  57. data/spec/unit/braintree/error_result_spec.rb +12 -2
  58. data/spec/unit/braintree/http_spec.rb +2 -2
  59. data/spec/unit/braintree/subscription_search_spec.rb +77 -0
  60. data/spec/unit/braintree/subscription_spec.rb +16 -8
  61. data/spec/unit/braintree/transaction_spec.rb +17 -12
  62. data/spec/unit/braintree/transparent_redirect_spec.rb +12 -12
  63. data/spec/unit/braintree/util_spec.rb +24 -0
  64. data/spec/unit/braintree/xml/parser_spec.rb +1 -1
  65. data/spec/unit/braintree_spec.rb +1 -1
  66. metadata +16 -5
@@ -93,6 +93,30 @@ describe Braintree::Util do
93
93
  )
94
94
  end.to raise_error(ArgumentError, "invalid keys: nested[deeply_allowed][real_deep_invalid], nested[nested_invalid], top_level_invalid")
95
95
  end
96
+
97
+ it "does not raise an error for array values" do
98
+ expect do
99
+ Braintree::Util.verify_keys(
100
+ [{:add_ons => [{:update => [:amount]}, {:add => [:amount]}]}],
101
+ :add_ons => {
102
+ :update => [{:amount => 10}],
103
+ :add => [{:amount => 5}]
104
+ }
105
+ )
106
+ end.to_not raise_error
107
+ end
108
+
109
+ it "raises an error for invalid key inside of array" do
110
+ expect do
111
+ Braintree::Util.verify_keys(
112
+ [{:add_ons => [{:update => [:amount]}, {:add => [:amount]}]}],
113
+ :add_ons => {
114
+ :update => [{:foo => 10}],
115
+ :add => [{:bar => 5}]
116
+ }
117
+ )
118
+ end.to_not raise_error(ArgumentError, "invalid keys: add_ons[update][foo], add_ons[add][bar]")
119
+ end
96
120
  end
97
121
 
98
122
  describe "self._flatten_hash_keys" do
@@ -27,7 +27,7 @@ describe Braintree::Xml::Parser do
27
27
  xml.should parse_to(:root => {:a_nil_value => nil, :an_empty_string => ""})
28
28
  end
29
29
 
30
- it "typecasts dates and times" do
30
+ it "typecasts datetimes" do
31
31
  xml = <<-END
32
32
  <root>
33
33
  <created-at type="datetime">2009-10-28T10:19:49Z</created-at>
@@ -1,7 +1,7 @@
1
1
  require File.dirname(__FILE__) + "/spec_helper"
2
2
 
3
3
  describe Braintree do
4
- it "doesn't produce warnings if loading braintree.rb twice" do
4
+ xit "ssl warning -- doesn't produce warnings if loading braintree.rb twice" do
5
5
  lib_dir = File.dirname(__FILE__) + "/../../lib"
6
6
  braintree_file = "#{lib_dir}/braintree.rb"
7
7
  File.exist?(braintree_file).should == true
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braintree
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
- - 4
9
- - 0
10
- version: 2.4.0
8
+ - 5
9
+ - 1
10
+ version: 2.5.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Braintree Payment Solutions
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-09 00:00:00 -05:00
18
+ date: 2010-09-03 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -43,22 +43,30 @@ extra_rdoc_files: []
43
43
  files:
44
44
  - README.rdoc
45
45
  - LICENSE
46
+ - lib/braintree/add_on.rb
46
47
  - lib/braintree/address.rb
48
+ - lib/braintree/address_gateway.rb
47
49
  - lib/braintree/advanced_search.rb
48
50
  - lib/braintree/base_module.rb
49
51
  - lib/braintree/configuration.rb
50
52
  - lib/braintree/credit_card.rb
53
+ - lib/braintree/credit_card_gateway.rb
51
54
  - lib/braintree/credit_card_verification.rb
52
55
  - lib/braintree/customer.rb
56
+ - lib/braintree/customer_gateway.rb
53
57
  - lib/braintree/digest.rb
58
+ - lib/braintree/discount.rb
54
59
  - lib/braintree/error_codes.rb
55
60
  - lib/braintree/error_result.rb
56
61
  - lib/braintree/errors.rb
57
62
  - lib/braintree/exceptions.rb
63
+ - lib/braintree/gateway.rb
58
64
  - lib/braintree/http.rb
65
+ - lib/braintree/modification.rb
59
66
  - lib/braintree/resource_collection.rb
60
67
  - lib/braintree/ssl_expiration_check.rb
61
68
  - lib/braintree/subscription.rb
69
+ - lib/braintree/subscription_gateway.rb
62
70
  - lib/braintree/subscription_search.rb
63
71
  - lib/braintree/successful_result.rb
64
72
  - lib/braintree/test/credit_card_numbers.rb
@@ -68,8 +76,10 @@ files:
68
76
  - lib/braintree/transaction/customer_details.rb
69
77
  - lib/braintree/transaction/status_details.rb
70
78
  - lib/braintree/transaction.rb
79
+ - lib/braintree/transaction_gateway.rb
71
80
  - lib/braintree/transaction_search.rb
72
81
  - lib/braintree/transparent_redirect.rb
82
+ - lib/braintree/transparent_redirect_gateway.rb
73
83
  - lib/braintree/util.rb
74
84
  - lib/braintree/validation_error.rb
75
85
  - lib/braintree/validation_error_collection.rb
@@ -82,6 +92,7 @@ files:
82
92
  - lib/braintree.rb
83
93
  - spec/hacks/tcp_socket.rb
84
94
  - spec/integration/braintree/address_spec.rb
95
+ - spec/integration/braintree/advanced_search_spec.rb
85
96
  - spec/integration/braintree/credit_card_spec.rb
86
97
  - spec/integration/braintree/customer_spec.rb
87
98
  - spec/integration/braintree/error_codes_spec.rb