braintree 2.6.0 → 2.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/braintree.rb +46 -46
- data/lib/braintree/address/country_names.rb +2 -1
- data/lib/braintree/util.rb +4 -2
- data/lib/braintree/version.rb +1 -1
- data/spec/integration/braintree/address_spec.rb +12 -1
- data/spec/integration/braintree/advanced_search_spec.rb +1 -1
- data/spec/integration/braintree/credit_card_spec.rb +1 -1
- data/spec/integration/braintree/customer_spec.rb +24 -6
- data/spec/integration/braintree/error_codes_spec.rb +1 -1
- data/spec/integration/braintree/http_spec.rb +2 -2
- data/spec/integration/braintree/subscription_spec.rb +1 -1
- data/spec/integration/braintree/test/transaction_amounts_spec.rb +1 -1
- data/spec/integration/braintree/transaction_search_spec.rb +1 -1
- data/spec/integration/braintree/transaction_spec.rb +1 -1
- data/spec/integration/braintree/transparent_redirect_spec.rb +1 -1
- data/spec/unit/braintree/address_spec.rb +1 -1
- data/spec/unit/braintree/base_module_spec.rb +1 -1
- data/spec/unit/braintree/configuration_spec.rb +1 -1
- data/spec/unit/braintree/credit_card_spec.rb +1 -1
- data/spec/unit/braintree/credit_card_verification_spec.rb +1 -1
- data/spec/unit/braintree/customer_spec.rb +1 -1
- data/spec/unit/braintree/digest_spec.rb +1 -1
- data/spec/unit/braintree/error_result_spec.rb +1 -1
- data/spec/unit/braintree/errors_spec.rb +1 -1
- data/spec/unit/braintree/http_spec.rb +1 -1
- data/spec/unit/braintree/resource_collection_spec.rb +1 -1
- data/spec/unit/braintree/subscription_search_spec.rb +1 -1
- data/spec/unit/braintree/subscription_spec.rb +1 -1
- data/spec/unit/braintree/successful_result_spec.rb +1 -1
- data/spec/unit/braintree/transaction/credit_card_details_spec.rb +1 -1
- data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
- data/spec/unit/braintree/transaction_search_spec.rb +1 -1
- data/spec/unit/braintree/transaction_spec.rb +1 -1
- data/spec/unit/braintree/transparent_redirect_spec.rb +1 -1
- data/spec/unit/braintree/util_spec.rb +1 -1
- data/spec/unit/braintree/validation_error_collection_spec.rb +1 -1
- data/spec/unit/braintree/validation_error_spec.rb +1 -1
- data/spec/unit/braintree/xml/libxml_spec.rb +1 -1
- data/spec/unit/braintree/xml/parser_spec.rb +1 -1
- data/spec/unit/braintree/xml/rexml_spec.rb +1 -1
- data/spec/unit/braintree/xml_spec.rb +1 -1
- data/spec/unit/braintree_spec.rb +2 -2
- data/spec/unit/spec_helper.rb +1 -1
- metadata +11 -4
data/lib/braintree.rb
CHANGED
@@ -17,51 +17,51 @@ require "builder"
|
|
17
17
|
module Braintree
|
18
18
|
end
|
19
19
|
|
20
|
-
require "braintree/exceptions"
|
21
|
-
require "braintree/base_module"
|
22
|
-
require "braintree/modification"
|
20
|
+
require File.dirname(__FILE__) + "/braintree/exceptions"
|
21
|
+
require File.dirname(__FILE__) + "/braintree/base_module"
|
22
|
+
require File.dirname(__FILE__) + "/braintree/modification"
|
23
23
|
|
24
|
-
require "braintree/add_on"
|
25
|
-
require "braintree/address/country_names"
|
26
|
-
require "braintree/address"
|
27
|
-
require "braintree/address_gateway"
|
28
|
-
require "braintree/advanced_search"
|
29
|
-
require "braintree/configuration"
|
30
|
-
require "braintree/credit_card"
|
31
|
-
require "braintree/credit_card_gateway"
|
32
|
-
require "braintree/credit_card_verification"
|
33
|
-
require "braintree/customer"
|
34
|
-
require "braintree/customer_gateway"
|
35
|
-
require "braintree/digest"
|
36
|
-
require "braintree/discount"
|
37
|
-
require "braintree/error_codes"
|
38
|
-
require "braintree/error_result"
|
39
|
-
require "braintree/errors"
|
40
|
-
require "braintree/gateway"
|
41
|
-
require "braintree/http"
|
42
|
-
require "braintree/resource_collection"
|
43
|
-
require "braintree/subscription"
|
44
|
-
require "braintree/subscription_gateway"
|
45
|
-
require "braintree/subscription_search"
|
46
|
-
require "braintree/successful_result"
|
47
|
-
require "braintree/test/credit_card_numbers"
|
48
|
-
require "braintree/test/transaction_amounts"
|
49
|
-
require "braintree/transaction"
|
50
|
-
require "braintree/transaction/address_details"
|
51
|
-
require "braintree/transaction/credit_card_details"
|
52
|
-
require "braintree/transaction/customer_details"
|
53
|
-
require "braintree/transaction_gateway"
|
54
|
-
require "braintree/transaction_search"
|
55
|
-
require "braintree/transaction/status_details"
|
56
|
-
require "braintree/transparent_redirect"
|
57
|
-
require "braintree/transparent_redirect_gateway"
|
58
|
-
require "braintree/util"
|
59
|
-
require "braintree/validation_error"
|
60
|
-
require "braintree/validation_error_collection"
|
61
|
-
require "braintree/version"
|
62
|
-
require "braintree/xml"
|
63
|
-
require "braintree/xml/generator"
|
64
|
-
require "braintree/xml/libxml"
|
65
|
-
require "braintree/xml/rexml"
|
66
|
-
require "braintree/xml/parser"
|
24
|
+
require File.dirname(__FILE__) + "/braintree/add_on"
|
25
|
+
require File.dirname(__FILE__) + "/braintree/address/country_names"
|
26
|
+
require File.dirname(__FILE__) + "/braintree/address"
|
27
|
+
require File.dirname(__FILE__) + "/braintree/address_gateway"
|
28
|
+
require File.dirname(__FILE__) + "/braintree/advanced_search"
|
29
|
+
require File.dirname(__FILE__) + "/braintree/configuration"
|
30
|
+
require File.dirname(__FILE__) + "/braintree/credit_card"
|
31
|
+
require File.dirname(__FILE__) + "/braintree/credit_card_gateway"
|
32
|
+
require File.dirname(__FILE__) + "/braintree/credit_card_verification"
|
33
|
+
require File.dirname(__FILE__) + "/braintree/customer"
|
34
|
+
require File.dirname(__FILE__) + "/braintree/customer_gateway"
|
35
|
+
require File.dirname(__FILE__) + "/braintree/digest"
|
36
|
+
require File.dirname(__FILE__) + "/braintree/discount"
|
37
|
+
require File.dirname(__FILE__) + "/braintree/error_codes"
|
38
|
+
require File.dirname(__FILE__) + "/braintree/error_result"
|
39
|
+
require File.dirname(__FILE__) + "/braintree/errors"
|
40
|
+
require File.dirname(__FILE__) + "/braintree/gateway"
|
41
|
+
require File.dirname(__FILE__) + "/braintree/http"
|
42
|
+
require File.dirname(__FILE__) + "/braintree/resource_collection"
|
43
|
+
require File.dirname(__FILE__) + "/braintree/subscription"
|
44
|
+
require File.dirname(__FILE__) + "/braintree/subscription_gateway"
|
45
|
+
require File.dirname(__FILE__) + "/braintree/subscription_search"
|
46
|
+
require File.dirname(__FILE__) + "/braintree/successful_result"
|
47
|
+
require File.dirname(__FILE__) + "/braintree/test/credit_card_numbers"
|
48
|
+
require File.dirname(__FILE__) + "/braintree/test/transaction_amounts"
|
49
|
+
require File.dirname(__FILE__) + "/braintree/transaction"
|
50
|
+
require File.dirname(__FILE__) + "/braintree/transaction/address_details"
|
51
|
+
require File.dirname(__FILE__) + "/braintree/transaction/credit_card_details"
|
52
|
+
require File.dirname(__FILE__) + "/braintree/transaction/customer_details"
|
53
|
+
require File.dirname(__FILE__) + "/braintree/transaction_gateway"
|
54
|
+
require File.dirname(__FILE__) + "/braintree/transaction_search"
|
55
|
+
require File.dirname(__FILE__) + "/braintree/transaction/status_details"
|
56
|
+
require File.dirname(__FILE__) + "/braintree/transparent_redirect"
|
57
|
+
require File.dirname(__FILE__) + "/braintree/transparent_redirect_gateway"
|
58
|
+
require File.dirname(__FILE__) + "/braintree/util"
|
59
|
+
require File.dirname(__FILE__) + "/braintree/validation_error"
|
60
|
+
require File.dirname(__FILE__) + "/braintree/validation_error_collection"
|
61
|
+
require File.dirname(__FILE__) + "/braintree/version"
|
62
|
+
require File.dirname(__FILE__) + "/braintree/xml"
|
63
|
+
require File.dirname(__FILE__) + "/braintree/xml/generator"
|
64
|
+
require File.dirname(__FILE__) + "/braintree/xml/libxml"
|
65
|
+
require File.dirname(__FILE__) + "/braintree/xml/rexml"
|
66
|
+
require File.dirname(__FILE__) + "/braintree/xml/parser"
|
67
67
|
|
data/lib/braintree/util.rb
CHANGED
@@ -99,8 +99,10 @@ module Braintree
|
|
99
99
|
end.sort
|
100
100
|
end
|
101
101
|
|
102
|
-
def self._flatten_hash_keys(
|
103
|
-
|
102
|
+
def self._flatten_hash_keys(element, namespace = nil)
|
103
|
+
element = [element] if element.is_a?(String)
|
104
|
+
|
105
|
+
element.inject([]) do |result, (key, value)|
|
104
106
|
full_key = (namespace ? "#{namespace}[#{key}]" : key.to_s)
|
105
107
|
if value.is_a?(Hash)
|
106
108
|
result += _flatten_hash_keys(value, full_key)
|
data/lib/braintree/version.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
3
|
|
3
4
|
describe Braintree::Address do
|
4
5
|
describe "self.create" do
|
@@ -47,6 +48,16 @@ describe Braintree::Address do
|
|
47
48
|
result.address.country_code_numeric.should == "016"
|
48
49
|
end
|
49
50
|
|
51
|
+
it "accepts utf-8 country names" do
|
52
|
+
customer = Braintree::Customer.create!
|
53
|
+
result = Braintree::Address.create(
|
54
|
+
:customer_id => customer.id,
|
55
|
+
:country_name => "Åland"
|
56
|
+
)
|
57
|
+
result.success?.should == true
|
58
|
+
result.address.country_name.should == "Åland"
|
59
|
+
end
|
60
|
+
|
50
61
|
it "returns an error response given inconsistent country codes" do
|
51
62
|
customer = Braintree::Customer.create!
|
52
63
|
result = Braintree::Address.create(
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
3
|
|
3
4
|
describe Braintree::Customer do
|
4
5
|
describe "self.all" do
|
@@ -62,11 +63,28 @@ describe Braintree::Customer do
|
|
62
63
|
last_name = "Mu\303\261oz"
|
63
64
|
result = Braintree::Customer.create(:first_name => first_name, :last_name => last_name)
|
64
65
|
result.success?.should == true
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
66
|
+
|
67
|
+
if RUBY_VERSION =~ /^1.8/
|
68
|
+
result.customer.first_name.should == first_name
|
69
|
+
result.customer.last_name.should == last_name
|
70
|
+
|
71
|
+
found_customer = Braintree::Customer.find(result.customer.id)
|
72
|
+
found_customer.first_name.should == first_name
|
73
|
+
found_customer.last_name.should == last_name
|
74
|
+
elsif RUBY_VERSION =~ /^1.9/
|
75
|
+
result.customer.first_name.should == "José"
|
76
|
+
result.customer.first_name.bytes.map {|b| b.to_s(8)}.should == ["112", "157", "163", "303", "251"]
|
77
|
+
result.customer.last_name.should == "Muñoz"
|
78
|
+
result.customer.last_name.bytes.map {|b| b.to_s(8)}.should == ["115", "165", "303", "261", "157", "172"]
|
79
|
+
|
80
|
+
found_customer = Braintree::Customer.find(result.customer.id)
|
81
|
+
found_customer.first_name.should == "José"
|
82
|
+
found_customer.first_name.bytes.map {|b| b.to_s(8)}.should == ["112", "157", "163", "303", "251"]
|
83
|
+
found_customer.last_name.should == "Muñoz"
|
84
|
+
found_customer.last_name.bytes.map {|b| b.to_s(8)}.should == ["115", "165", "303", "261", "157", "172"]
|
85
|
+
else
|
86
|
+
raise "unknown ruby version: #{RUBY_VERSION.inspect}"
|
87
|
+
end
|
70
88
|
end
|
71
89
|
|
72
90
|
it "returns an error response if invalid" do
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/../spec_helper"
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
2
|
|
3
3
|
describe Braintree::Http do
|
4
4
|
describe "self._handle_response" do
|
@@ -161,7 +161,7 @@ describe Braintree::Http do
|
|
161
161
|
Braintree::Configuration.environment = :qa
|
162
162
|
config = Braintree::Configuration.instantiate
|
163
163
|
config.stub(:base_merchant_path).and_return("/")
|
164
|
-
config.stub(:ca_file).and_return(
|
164
|
+
config.stub(:ca_file).and_return("does_not_exist")
|
165
165
|
|
166
166
|
expect do
|
167
167
|
config.http._http_do(Net::HTTP::Get, "/login")
|
data/spec/unit/braintree_spec.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/spec_helper"
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
|
2
2
|
|
3
3
|
describe Braintree do
|
4
4
|
it "doesn't produce warnings if loading braintree.rb twice" do
|
5
|
-
lib_dir = File.dirname(__FILE__) + "/../../lib"
|
5
|
+
lib_dir = File.expand_path(File.dirname(__FILE__) + "/../../lib")
|
6
6
|
braintree_file = "#{lib_dir}/braintree.rb"
|
7
7
|
File.exist?(braintree_file).should == true
|
8
8
|
output = `ruby -r rubygems -I #{lib_dir} -e 'load #{braintree_file.inspect}; load #{braintree_file.inspect}' 2>&1`
|
data/spec/unit/spec_helper.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/../spec_helper"
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: braintree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 21
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 2
|
7
8
|
- 6
|
8
|
-
-
|
9
|
-
version: 2.6.
|
9
|
+
- 1
|
10
|
+
version: 2.6.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Braintree Payment Solutions
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-30 00:00:00 -05:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: builder
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
version: "0"
|
@@ -143,23 +146,27 @@ rdoc_options: []
|
|
143
146
|
require_paths:
|
144
147
|
- lib
|
145
148
|
required_ruby_version: !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
146
150
|
requirements:
|
147
151
|
- - ">="
|
148
152
|
- !ruby/object:Gem::Version
|
153
|
+
hash: 3
|
149
154
|
segments:
|
150
155
|
- 0
|
151
156
|
version: "0"
|
152
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
|
+
none: false
|
153
159
|
requirements:
|
154
160
|
- - ">="
|
155
161
|
- !ruby/object:Gem::Version
|
162
|
+
hash: 3
|
156
163
|
segments:
|
157
164
|
- 0
|
158
165
|
version: "0"
|
159
166
|
requirements: []
|
160
167
|
|
161
168
|
rubyforge_project: braintree
|
162
|
-
rubygems_version: 1.3.
|
169
|
+
rubygems_version: 1.3.7
|
163
170
|
signing_key:
|
164
171
|
specification_version: 3
|
165
172
|
summary: Braintree Gateway Ruby Client Library
|