braintree 2.2.0 → 2.3.1

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.
@@ -38,5 +38,45 @@ describe Braintree::ErrorResult do
38
38
  result = Braintree::ErrorResult.new(:params => "params", :errors => errors)
39
39
  result.inspect.should == "#<Braintree::ErrorResult params:{...} errors:<level1:[(code1) message], level1/level2:[(code2) message2]>>"
40
40
  end
41
+
42
+ it "includes the credit_card_verification if there is one" do
43
+ result = Braintree::ErrorResult.new(
44
+ :params => "params",
45
+ :errors => {},
46
+ :verification => {},
47
+ :transaction => nil
48
+ )
49
+ result.inspect.should include("credit_card_verification: #<Braintree::CreditCardVerification status: ")
50
+ end
51
+
52
+ it "does not include the credit_card_verification if there isn't one" do
53
+ result = Braintree::ErrorResult.new(
54
+ :params => "params",
55
+ :errors => {},
56
+ :verification => nil,
57
+ :transaction => nil
58
+ )
59
+ result.inspect.should_not include("credit_card_verification")
60
+ end
61
+
62
+ it "includes the transaction if there is one" do
63
+ result = Braintree::ErrorResult.new(
64
+ :params => "params",
65
+ :errors => {},
66
+ :verification => nil,
67
+ :transaction => {}
68
+ )
69
+ result.inspect.should include("transaction: #<Braintree::Transaction id: ")
70
+ end
71
+
72
+ it "does not include the transaction if there isn't one" do
73
+ result = Braintree::ErrorResult.new(
74
+ :params => "params",
75
+ :errors => {},
76
+ :verification => nil,
77
+ :transaction => nil
78
+ )
79
+ result.inspect.should_not include("transaction")
80
+ end
41
81
  end
42
82
  end
@@ -0,0 +1,51 @@
1
+ require File.dirname(__FILE__) + "/../../spec_helper"
2
+
3
+ describe Braintree::Xml::Parser do
4
+ describe "self.hash_from_xml" do
5
+ it "typecasts integers" do
6
+ xml = "<root><foo type=\"integer\">123</foo></root>"
7
+ xml.should parse_to(:root => {:foo => 123})
8
+ end
9
+
10
+ it "works with dashes or underscores" do
11
+ xml = <<-END
12
+ <root>
13
+ <dash-es />
14
+ <under_scores />
15
+ </root>
16
+ END
17
+ xml.should parse_to(:root=>{:dash_es=>"", :under_scores=>""})
18
+ end
19
+
20
+ it "uses nil if nil=true, otherwise uses empty string" do
21
+ xml = <<-END
22
+ <root>
23
+ <a_nil_value nil="true"></a_nil_value>
24
+ <an_empty_string></an_empty_string>
25
+ </root>
26
+ END
27
+ xml.should parse_to(:root => {:a_nil_value => nil, :an_empty_string => ""})
28
+ end
29
+
30
+ it "typecasts dates and times" do
31
+ xml = <<-END
32
+ <root>
33
+ <created-at type="datetime">2009-10-28T10:19:49Z</created-at>
34
+ </root>
35
+ END
36
+ xml.should parse_to(:root => {:created_at => Time.utc(2009, 10, 28, 10, 19, 49)})
37
+ end
38
+
39
+ it "builds an array if type=array" do
40
+ xml = <<-END
41
+ <root>
42
+ <customers type="array">
43
+ <customer><name>Adam</name></customer>
44
+ <customer><name>Ben</name></customer>
45
+ </customers>
46
+ </root>
47
+ END
48
+ xml.should parse_to(:root => {:customers => [{:name => "Adam"}, {:name => "Ben"}]})
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,51 @@
1
+ require File.dirname(__FILE__) + "/../../spec_helper"
2
+
3
+ describe Braintree::Xml::Rexml do
4
+ describe "self.parse" do
5
+ it "typecasts integers" do
6
+ xml = "<root><foo type=\"integer\">123</foo></root>"
7
+ Braintree::Xml::Rexml.parse(xml).should == {"root"=>{"foo"=>{"__content__"=>"123", "type"=>"integer"}}}
8
+ end
9
+
10
+ it "works with dashes or underscores" do
11
+ xml = <<-END
12
+ <root>
13
+ <dash-es />
14
+ <under_scores />
15
+ </root>
16
+ END
17
+ Braintree::Xml::Rexml.parse(xml).should == {"root"=>{"dash-es"=>{}, "under_scores"=>{}}}
18
+ end
19
+
20
+ it "uses nil if nil=true, otherwise uses empty string" do
21
+ xml = <<-END
22
+ <root>
23
+ <a_nil_value nil="true"></a_nil_value>
24
+ <an_empty_string></an_empty_string>
25
+ </root>
26
+ END
27
+ Braintree::Xml::Rexml.parse(xml).should == {"root"=>{"a_nil_value"=>{"nil"=>"true"}, "an_empty_string"=>{}}}
28
+ end
29
+
30
+ it "typecasts dates and times" do
31
+ xml = <<-END
32
+ <root>
33
+ <created-at type="datetime">2009-10-28T10:19:49Z</created-at>
34
+ </root>
35
+ END
36
+ Braintree::Xml::Rexml.parse(xml).should == {"root"=>{"created-at"=>{"__content__"=>"2009-10-28T10:19:49Z", "type"=>"datetime"}}}
37
+ end
38
+
39
+ it "builds an array if type=array" do
40
+ xml = <<-END
41
+ <root>
42
+ <customers type="array">
43
+ <customer><name>Adam</name></customer>
44
+ <customer><name>Ben</name></customer>
45
+ </customers>
46
+ </root>
47
+ END
48
+ Braintree::Xml::Rexml.parse(xml).should == {"root"=>{"customers"=>{"type"=>"array", "customer"=>[{"name"=>{"__content__"=>"Adam"}}, {"name"=>{"__content__"=>"Ben"}}]}}}
49
+ end
50
+ end
51
+ end
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braintree
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ hash: 1
5
+ prerelease: false
6
+ segments:
7
+ - 2
8
+ - 3
9
+ - 1
10
+ version: 2.3.1
5
11
  platform: ruby
6
12
  authors:
7
13
  - Braintree Payment Solutions
@@ -9,29 +15,23 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-05-17 00:00:00 -05:00
18
+ date: 2010-06-24 00:00:00 -05:00
13
19
  default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: builder
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
27
  - - ">="
22
28
  - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
23
32
  version: "0"
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: libxml-ruby
27
33
  type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: "0"
34
- version:
34
+ version_requirements: *id001
35
35
  description: Ruby library for integrating with the Braintree Gateway
36
36
  email: devs@getbraintree.com
37
37
  executables: []
@@ -77,6 +77,7 @@ files:
77
77
  - lib/braintree/xml/generator.rb
78
78
  - lib/braintree/xml/libxml.rb
79
79
  - lib/braintree/xml/parser.rb
80
+ - lib/braintree/xml/rexml.rb
80
81
  - lib/braintree/xml.rb
81
82
  - lib/braintree.rb
82
83
  - spec/hacks/tcp_socket.rb
@@ -85,6 +86,7 @@ files:
85
86
  - spec/integration/braintree/customer_spec.rb
86
87
  - spec/integration/braintree/error_codes_spec.rb
87
88
  - spec/integration/braintree/http_spec.rb
89
+ - spec/integration/braintree/ssl_expiration_check_spec.rb
88
90
  - spec/integration/braintree/subscription_spec.rb
89
91
  - spec/integration/braintree/test/transaction_amounts_spec.rb
90
92
  - spec/integration/braintree/transaction_search_spec.rb
@@ -104,7 +106,6 @@ files:
104
106
  - spec/unit/braintree/errors_spec.rb
105
107
  - spec/unit/braintree/http_spec.rb
106
108
  - spec/unit/braintree/resource_collection_spec.rb
107
- - spec/unit/braintree/ssl_expiration_check_spec.rb
108
109
  - spec/unit/braintree/subscription_search_spec.rb
109
110
  - spec/unit/braintree/subscription_spec.rb
110
111
  - spec/unit/braintree/successful_result_spec.rb
@@ -117,6 +118,8 @@ files:
117
118
  - spec/unit/braintree/validation_error_collection_spec.rb
118
119
  - spec/unit/braintree/validation_error_spec.rb
119
120
  - spec/unit/braintree/xml/libxml_spec.rb
121
+ - spec/unit/braintree/xml/parser_spec.rb
122
+ - spec/unit/braintree/xml/rexml_spec.rb
120
123
  - spec/unit/braintree/xml_spec.rb
121
124
  - spec/unit/braintree_spec.rb
122
125
  - spec/unit/spec_helper.rb
@@ -133,21 +136,27 @@ rdoc_options: []
133
136
  require_paths:
134
137
  - lib
135
138
  required_ruby_version: !ruby/object:Gem::Requirement
139
+ none: false
136
140
  requirements:
137
141
  - - ">="
138
142
  - !ruby/object:Gem::Version
143
+ hash: 3
144
+ segments:
145
+ - 0
139
146
  version: "0"
140
- version:
141
147
  required_rubygems_version: !ruby/object:Gem::Requirement
148
+ none: false
142
149
  requirements:
143
150
  - - ">="
144
151
  - !ruby/object:Gem::Version
152
+ hash: 3
153
+ segments:
154
+ - 0
145
155
  version: "0"
146
- version:
147
156
  requirements: []
148
157
 
149
158
  rubyforge_project: braintree
150
- rubygems_version: 1.3.5
159
+ rubygems_version: 1.3.7
151
160
  signing_key:
152
161
  specification_version: 3
153
162
  summary: Braintree Gateway Ruby Client Library