braintree 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -3
- data/lib/braintree.rb +1 -0
- data/lib/braintree/advanced_search.rb +70 -8
- data/lib/braintree/credit_card.rb +43 -4
- data/lib/braintree/error_codes.rb +7 -0
- data/lib/braintree/subscription.rb +22 -4
- data/lib/braintree/transaction.rb +34 -17
- data/lib/braintree/transaction_search.rb +63 -0
- data/lib/braintree/transparent_redirect.rb +1 -1
- data/lib/braintree/util.rb +3 -2
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/xml/generator.rb +17 -3
- data/spec/integration/braintree/credit_card_spec.rb +47 -0
- data/spec/integration/braintree/subscription_spec.rb +39 -8
- data/spec/integration/braintree/transaction_search_spec.rb +734 -0
- data/spec/integration/braintree/transaction_spec.rb +138 -97
- data/spec/spec_helper.rb +4 -0
- data/spec/unit/braintree/credit_card_spec.rb +46 -4
- data/spec/unit/braintree/subscription_spec.rb +22 -3
- data/spec/unit/braintree/transaction_search_spec.rb +24 -0
- data/spec/unit/braintree/transaction_spec.rb +13 -2
- data/spec/unit/braintree/util_spec.rb +7 -1
- data/spec/unit/braintree/xml_spec.rb +22 -0
- metadata +16 -24
@@ -120,7 +120,7 @@ describe Braintree::Util do
|
|
120
120
|
end
|
121
121
|
|
122
122
|
describe "self.extract_attribute_as_array" do
|
123
|
-
it "
|
123
|
+
it "deletes the attribute from the hash" do
|
124
124
|
hash = {:foo => ["x"], :bar => :baz}
|
125
125
|
Braintree::Util.extract_attribute_as_array(hash, :foo)
|
126
126
|
hash.should == {:bar => :baz}
|
@@ -143,6 +143,12 @@ describe Braintree::Util do
|
|
143
143
|
result = Braintree::Util.extract_attribute_as_array(hash, :quz)
|
144
144
|
result.should == []
|
145
145
|
end
|
146
|
+
|
147
|
+
it "raises an UnexpectedError if nil data is provided" do
|
148
|
+
expect do
|
149
|
+
Braintree::Util.extract_attribute_as_array(nil, :abc)
|
150
|
+
end.to raise_error(Braintree::UnexpectedError, /Unprocessable entity due to an invalid request/)
|
151
|
+
end
|
146
152
|
end
|
147
153
|
|
148
154
|
describe "self.hash_to_query_string" do
|
@@ -99,6 +99,28 @@ describe Braintree::Xml do
|
|
99
99
|
verify_to_xml_and_back hash
|
100
100
|
end
|
101
101
|
|
102
|
+
context "BigDecimal" do
|
103
|
+
it "works for BigDecimals" do
|
104
|
+
hash = {:root => {:foo => BigDecimal.new("123.45")}}
|
105
|
+
Braintree::Xml.hash_to_xml(hash).should include("<foo>123.45</foo>")
|
106
|
+
end
|
107
|
+
|
108
|
+
it "works for BigDecimals with fewer than 2 digits" do
|
109
|
+
hash = {:root => {:foo => BigDecimal.new("1000.0")}}
|
110
|
+
Braintree::Xml.hash_to_xml(hash).should include("<foo>1000.00</foo>")
|
111
|
+
end
|
112
|
+
|
113
|
+
it "works for BigDecimals with more than 2 digits" do
|
114
|
+
hash = {:root => {:foo => BigDecimal.new("12.345")}}
|
115
|
+
Braintree::Xml.hash_to_xml(hash).should include("<foo>12.345</foo>")
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
it "works for symbols" do
|
120
|
+
hash = {:root => {:foo => :bar}}
|
121
|
+
Braintree::Xml.hash_to_xml(hash).should include("<foo>bar</foo>")
|
122
|
+
end
|
123
|
+
|
102
124
|
it "type casts booleans" do
|
103
125
|
hash = {:root => {:string_true => "true", :bool_true => true, :bool_false => false, :string_false => "false"}}
|
104
126
|
verify_to_xml_and_back hash
|
metadata
CHANGED
@@ -1,12 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: braintree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 2
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
version: 2.0.0
|
4
|
+
version: 2.1.0
|
10
5
|
platform: ruby
|
11
6
|
authors:
|
12
7
|
- Braintree Payment Solutions
|
@@ -14,33 +9,29 @@ autorequire:
|
|
14
9
|
bindir: bin
|
15
10
|
cert_chain: []
|
16
11
|
|
17
|
-
date: 2010-
|
12
|
+
date: 2010-05-05 00:00:00 -05:00
|
18
13
|
default_executable:
|
19
14
|
dependencies:
|
20
15
|
- !ruby/object:Gem::Dependency
|
21
16
|
name: builder
|
22
|
-
|
23
|
-
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
20
|
requirements:
|
25
21
|
- - ">="
|
26
22
|
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 0
|
29
23
|
version: "0"
|
30
|
-
|
31
|
-
version_requirements: *id001
|
24
|
+
version:
|
32
25
|
- !ruby/object:Gem::Dependency
|
33
26
|
name: libxml-ruby
|
34
|
-
|
35
|
-
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
31
|
- - ">="
|
38
32
|
- !ruby/object:Gem::Version
|
39
|
-
segments:
|
40
|
-
- 0
|
41
33
|
version: "0"
|
42
|
-
|
43
|
-
version_requirements: *id002
|
34
|
+
version:
|
44
35
|
description: Ruby library for integrating with the Braintree Gateway
|
45
36
|
email: devs@getbraintree.com
|
46
37
|
executables: []
|
@@ -77,6 +68,7 @@ files:
|
|
77
68
|
- lib/braintree/transaction/customer_details.rb
|
78
69
|
- lib/braintree/transaction/status_details.rb
|
79
70
|
- lib/braintree/transaction.rb
|
71
|
+
- lib/braintree/transaction_search.rb
|
80
72
|
- lib/braintree/transparent_redirect.rb
|
81
73
|
- lib/braintree/util.rb
|
82
74
|
- lib/braintree/validation_error.rb
|
@@ -95,6 +87,7 @@ files:
|
|
95
87
|
- spec/integration/braintree/http_spec.rb
|
96
88
|
- spec/integration/braintree/subscription_spec.rb
|
97
89
|
- spec/integration/braintree/test/transaction_amounts_spec.rb
|
90
|
+
- spec/integration/braintree/transaction_search_spec.rb
|
98
91
|
- spec/integration/braintree/transaction_spec.rb
|
99
92
|
- spec/integration/braintree/transparent_redirect_spec.rb
|
100
93
|
- spec/integration/spec_helper.rb
|
@@ -117,6 +110,7 @@ files:
|
|
117
110
|
- spec/unit/braintree/successful_result_spec.rb
|
118
111
|
- spec/unit/braintree/transaction/credit_card_details_spec.rb
|
119
112
|
- spec/unit/braintree/transaction/customer_details_spec.rb
|
113
|
+
- spec/unit/braintree/transaction_search_spec.rb
|
120
114
|
- spec/unit/braintree/transaction_spec.rb
|
121
115
|
- spec/unit/braintree/transparent_redirect_spec.rb
|
122
116
|
- spec/unit/braintree/util_spec.rb
|
@@ -142,20 +136,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
142
136
|
requirements:
|
143
137
|
- - ">="
|
144
138
|
- !ruby/object:Gem::Version
|
145
|
-
segments:
|
146
|
-
- 0
|
147
139
|
version: "0"
|
140
|
+
version:
|
148
141
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
142
|
requirements:
|
150
143
|
- - ">="
|
151
144
|
- !ruby/object:Gem::Version
|
152
|
-
segments:
|
153
|
-
- 0
|
154
145
|
version: "0"
|
146
|
+
version:
|
155
147
|
requirements: []
|
156
148
|
|
157
149
|
rubyforge_project: braintree
|
158
|
-
rubygems_version: 1.3.
|
150
|
+
rubygems_version: 1.3.5
|
159
151
|
signing_key:
|
160
152
|
specification_version: 3
|
161
153
|
summary: Braintree Gateway Ruby Client Library
|