Permalink
Browse files

2.6.1

  • Loading branch information...
1 parent 2c31b9c commit efde41823fa671d668d1cdb73def31f2d4743d75 @braintreeps braintreeps committed Sep 30, 2010
Showing with 138 additions and 102 deletions.
  1. +7 −3 CHANGELOG.rdoc
  2. +3 −3 Rakefile
  3. +46 −46 lib/braintree.rb
  4. +2 −1 lib/braintree/address/country_names.rb
  5. +4 −2 lib/braintree/util.rb
  6. +1 −1 lib/braintree/version.rb
  7. +12 −1 spec/integration/braintree/address_spec.rb
  8. +1 −1 spec/integration/braintree/advanced_search_spec.rb
  9. +1 −1 spec/integration/braintree/credit_card_spec.rb
  10. +24 −6 spec/integration/braintree/customer_spec.rb
  11. +1 −1 spec/integration/braintree/error_codes_spec.rb
  12. +2 −2 spec/integration/braintree/http_spec.rb
  13. +1 −1 spec/integration/braintree/subscription_spec.rb
  14. +1 −1 spec/integration/braintree/test/transaction_amounts_spec.rb
  15. +1 −1 spec/integration/braintree/transaction_search_spec.rb
  16. +1 −1 spec/integration/braintree/transaction_spec.rb
  17. +1 −1 spec/integration/braintree/transparent_redirect_spec.rb
  18. +1 −1 spec/unit/braintree/address_spec.rb
  19. +1 −1 spec/unit/braintree/base_module_spec.rb
  20. +1 −1 spec/unit/braintree/configuration_spec.rb
  21. +1 −1 spec/unit/braintree/credit_card_spec.rb
  22. +1 −1 spec/unit/braintree/credit_card_verification_spec.rb
  23. +1 −1 spec/unit/braintree/customer_spec.rb
  24. +1 −1 spec/unit/braintree/digest_spec.rb
  25. +1 −1 spec/unit/braintree/error_result_spec.rb
  26. +1 −1 spec/unit/braintree/errors_spec.rb
  27. +1 −1 spec/unit/braintree/http_spec.rb
  28. +1 −1 spec/unit/braintree/resource_collection_spec.rb
  29. +1 −1 spec/unit/braintree/subscription_search_spec.rb
  30. +1 −1 spec/unit/braintree/subscription_spec.rb
  31. +1 −1 spec/unit/braintree/successful_result_spec.rb
  32. +1 −1 spec/unit/braintree/transaction/credit_card_details_spec.rb
  33. +1 −1 spec/unit/braintree/transaction/customer_details_spec.rb
  34. +1 −1 spec/unit/braintree/transaction_search_spec.rb
  35. +1 −1 spec/unit/braintree/transaction_spec.rb
  36. +1 −1 spec/unit/braintree/transparent_redirect_spec.rb
  37. +1 −1 spec/unit/braintree/util_spec.rb
  38. +1 −1 spec/unit/braintree/validation_error_collection_spec.rb
  39. +1 −1 spec/unit/braintree/validation_error_spec.rb
  40. +1 −1 spec/unit/braintree/xml/libxml_spec.rb
  41. +1 −1 spec/unit/braintree/xml/parser_spec.rb
  42. +1 −1 spec/unit/braintree/xml/rexml_spec.rb
  43. +1 −1 spec/unit/braintree/xml_spec.rb
  44. +2 −2 spec/unit/braintree_spec.rb
  45. +1 −1 spec/unit/spec_helper.rb
View
@@ -1,3 +1,7 @@
+== 2.6.1
+
+* Now supports ruby 1.9.1 and 1.9.2
+
== 2.6.0
* Added ability to perform multiple partial refunds on Transactions
@@ -12,12 +16,12 @@
== 2.5.2
-* removed ssl expiration check
-* lazy initialize Configuration.logger when directly instantiating configuration
+* Removed ssl expiration check
+* Lazy initialize Configuration.logger when directly instantiating configuration
== 2.5.1
-* lazy initialize Configuration.logger to fix bug with ssl expiration check
+* Lazy initialize Configuration.logger to fix bug with ssl expiration check
== 2.5.0
View
@@ -74,8 +74,8 @@ PID_FILE = "/tmp/gateway_server_#{GATEWAY_PORT}.pid"
task :prep_gateway do
Dir.chdir(GATEWAY_ROOT) do
sh "git pull"
- sh "env RAILS_ENV=integration #{CRUISE_BUILD} rake db:migrate:reset --trace"
- sh "env RAILS_ENV=integration #{CRUISE_BUILD} ruby script/populate_data"
+ sh "env RAILS_ENV=integration #{CRUISE_BUILD} rvm system exec rake db:migrate:reset --trace"
+ sh "env RAILS_ENV=integration #{CRUISE_BUILD} rvm system exec ruby script/populate_data"
Rake::Task[:start_gateway].invoke
end
end
@@ -103,7 +103,7 @@ def spawn_server(pid_file, port, environment="test")
require File.dirname(__FILE__) + "/spec/hacks/tcp_socket"
FileUtils.rm(pid_file) if File.exist?(pid_file)
- command = "mongrel_rails start --environment #{environment} --daemon --port #{port} --pid #{pid_file}"
+ command = "rvm system exec mongrel_rails start --environment #{environment} --daemon --port #{port} --pid #{pid_file}"
sh command
puts "== waiting for web server - port: #{port}"
View
@@ -17,51 +17,51 @@
module Braintree
end
-require "braintree/exceptions"
-require "braintree/base_module"
-require "braintree/modification"
+require File.dirname(__FILE__) + "/braintree/exceptions"
+require File.dirname(__FILE__) + "/braintree/base_module"
+require File.dirname(__FILE__) + "/braintree/modification"
-require "braintree/add_on"
-require "braintree/address/country_names"
-require "braintree/address"
-require "braintree/address_gateway"
-require "braintree/advanced_search"
-require "braintree/configuration"
-require "braintree/credit_card"
-require "braintree/credit_card_gateway"
-require "braintree/credit_card_verification"
-require "braintree/customer"
-require "braintree/customer_gateway"
-require "braintree/digest"
-require "braintree/discount"
-require "braintree/error_codes"
-require "braintree/error_result"
-require "braintree/errors"
-require "braintree/gateway"
-require "braintree/http"
-require "braintree/resource_collection"
-require "braintree/subscription"
-require "braintree/subscription_gateway"
-require "braintree/subscription_search"
-require "braintree/successful_result"
-require "braintree/test/credit_card_numbers"
-require "braintree/test/transaction_amounts"
-require "braintree/transaction"
-require "braintree/transaction/address_details"
-require "braintree/transaction/credit_card_details"
-require "braintree/transaction/customer_details"
-require "braintree/transaction_gateway"
-require "braintree/transaction_search"
-require "braintree/transaction/status_details"
-require "braintree/transparent_redirect"
-require "braintree/transparent_redirect_gateway"
-require "braintree/util"
-require "braintree/validation_error"
-require "braintree/validation_error_collection"
-require "braintree/version"
-require "braintree/xml"
-require "braintree/xml/generator"
-require "braintree/xml/libxml"
-require "braintree/xml/rexml"
-require "braintree/xml/parser"
+require File.dirname(__FILE__) + "/braintree/add_on"
+require File.dirname(__FILE__) + "/braintree/address/country_names"
+require File.dirname(__FILE__) + "/braintree/address"
+require File.dirname(__FILE__) + "/braintree/address_gateway"
+require File.dirname(__FILE__) + "/braintree/advanced_search"
+require File.dirname(__FILE__) + "/braintree/configuration"
+require File.dirname(__FILE__) + "/braintree/credit_card"
+require File.dirname(__FILE__) + "/braintree/credit_card_gateway"
+require File.dirname(__FILE__) + "/braintree/credit_card_verification"
+require File.dirname(__FILE__) + "/braintree/customer"
+require File.dirname(__FILE__) + "/braintree/customer_gateway"
+require File.dirname(__FILE__) + "/braintree/digest"
+require File.dirname(__FILE__) + "/braintree/discount"
+require File.dirname(__FILE__) + "/braintree/error_codes"
+require File.dirname(__FILE__) + "/braintree/error_result"
+require File.dirname(__FILE__) + "/braintree/errors"
+require File.dirname(__FILE__) + "/braintree/gateway"
+require File.dirname(__FILE__) + "/braintree/http"
+require File.dirname(__FILE__) + "/braintree/resource_collection"
+require File.dirname(__FILE__) + "/braintree/subscription"
+require File.dirname(__FILE__) + "/braintree/subscription_gateway"
+require File.dirname(__FILE__) + "/braintree/subscription_search"
+require File.dirname(__FILE__) + "/braintree/successful_result"
+require File.dirname(__FILE__) + "/braintree/test/credit_card_numbers"
+require File.dirname(__FILE__) + "/braintree/test/transaction_amounts"
+require File.dirname(__FILE__) + "/braintree/transaction"
+require File.dirname(__FILE__) + "/braintree/transaction/address_details"
+require File.dirname(__FILE__) + "/braintree/transaction/credit_card_details"
+require File.dirname(__FILE__) + "/braintree/transaction/customer_details"
+require File.dirname(__FILE__) + "/braintree/transaction_gateway"
+require File.dirname(__FILE__) + "/braintree/transaction_search"
+require File.dirname(__FILE__) + "/braintree/transaction/status_details"
+require File.dirname(__FILE__) + "/braintree/transparent_redirect"
+require File.dirname(__FILE__) + "/braintree/transparent_redirect_gateway"
+require File.dirname(__FILE__) + "/braintree/util"
+require File.dirname(__FILE__) + "/braintree/validation_error"
+require File.dirname(__FILE__) + "/braintree/validation_error_collection"
+require File.dirname(__FILE__) + "/braintree/version"
+require File.dirname(__FILE__) + "/braintree/xml"
+require File.dirname(__FILE__) + "/braintree/xml/generator"
+require File.dirname(__FILE__) + "/braintree/xml/libxml"
+require File.dirname(__FILE__) + "/braintree/xml/rexml"
+require File.dirname(__FILE__) + "/braintree/xml/parser"
@@ -1,3 +1,4 @@
+# encoding: utf-8
module Braintree
class Address
CountryNames = [
@@ -248,4 +249,4 @@ class Address
["Zambia", "ZM", "ZMB", "894"],
["Zimbabwe", "ZW", "ZWE", "716"]]
end
-end
+end
View
@@ -99,8 +99,10 @@ def self._flatten_valid_keys(valid_keys, namespace = nil)
end.sort
end
- def self._flatten_hash_keys(hash, namespace = nil)
- hash.inject([]) do |result, (key, value)|
+ def self._flatten_hash_keys(element, namespace = nil)
+ element = [element] if element.is_a?(String)
+
+ element.inject([]) do |result, (key, value)|
full_key = (namespace ? "#{namespace}[#{key}]" : key.to_s)
if value.is_a?(Hash)
result += _flatten_hash_keys(value, full_key)
View
@@ -2,7 +2,7 @@ module Braintree
module Version
Major = 2
Minor = 6
- Tiny = 0
+ Tiny = 1
String = "#{Major}.#{Minor}.#{Tiny}"
end
@@ -1,4 +1,5 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+# encoding: utf-8
+require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe Braintree::Address do
describe "self.create" do
@@ -47,6 +48,16 @@
result.address.country_code_numeric.should == "016"
end
+ it "accepts utf-8 country names" do
+ customer = Braintree::Customer.create!
+ result = Braintree::Address.create(
+ :customer_id => customer.id,
+ :country_name => "Åland"
+ )
+ result.success?.should == true
+ result.address.country_name.should == "Åland"
+ end
+
it "returns an error response given inconsistent country codes" do
customer = Braintree::Customer.create!
result = Braintree::Address.create(
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe Braintree::AdvancedSearch do
before(:each) do
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe Braintree::CreditCard do
describe "self.create" do
@@ -1,4 +1,5 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+# encoding: utf-8
+require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe Braintree::Customer do
describe "self.all" do
@@ -62,11 +63,28 @@
last_name = "Mu\303\261oz"
result = Braintree::Customer.create(:first_name => first_name, :last_name => last_name)
result.success?.should == true
- result.customer.first_name.should == first_name
- result.customer.last_name.should == last_name
- found_customer = Braintree::Customer.find(result.customer.id)
- found_customer.first_name.should == first_name
- found_customer.last_name.should == last_name
+
+ if RUBY_VERSION =~ /^1.8/
+ result.customer.first_name.should == first_name
+ result.customer.last_name.should == last_name
+
+ found_customer = Braintree::Customer.find(result.customer.id)
+ found_customer.first_name.should == first_name
+ found_customer.last_name.should == last_name
+ elsif RUBY_VERSION =~ /^1.9/
+ result.customer.first_name.should == "José"
+ result.customer.first_name.bytes.map {|b| b.to_s(8)}.should == ["112", "157", "163", "303", "251"]
+ result.customer.last_name.should == "Muñoz"
+ result.customer.last_name.bytes.map {|b| b.to_s(8)}.should == ["115", "165", "303", "261", "157", "172"]
+
+ found_customer = Braintree::Customer.find(result.customer.id)
+ found_customer.first_name.should == "José"
+ found_customer.first_name.bytes.map {|b| b.to_s(8)}.should == ["112", "157", "163", "303", "251"]
+ found_customer.last_name.should == "Muñoz"
+ found_customer.last_name.bytes.map {|b| b.to_s(8)}.should == ["115", "165", "303", "261", "157", "172"]
+ else
+ raise "unknown ruby version: #{RUBY_VERSION.inspect}"
+ end
end
it "returns an error response if invalid" do
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe Braintree::ErrorCodes do
describe Braintree::ErrorCodes::CreditCard do
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe Braintree::Http do
describe "self._handle_response" do
@@ -161,7 +161,7 @@
Braintree::Configuration.environment = :qa
config = Braintree::Configuration.instantiate
config.stub(:base_merchant_path).and_return("/")
- config.stub(:ca_file).and_return(nil)
+ config.stub(:ca_file).and_return("does_not_exist")
expect do
config.http._http_do(Net::HTTP::Get, "/login")
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe Braintree::Subscription do
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
describe Braintree::Test::TransactionAmounts do
describe "Authorize" do
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe Braintree::Transaction, "search" do
context "advanced" do
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe Braintree::Transaction do
describe "self.create" do
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe Braintree::TransparentRedirect do
it "raises a DownForMaintenanceError when app is in maintenance mode on TR requests" do
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe Braintree::Address do
describe "==" do
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe Braintree::BaseModule do
describe "return_object_or_raise" do
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe Braintree::Configuration do
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe Braintree::CreditCard do
describe "self.create" do
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe Braintree::CreditCardVerification do
describe "inspect" do
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe Braintree::Customer do
describe "inspect" do
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe Braintree::Digest do
describe "self.hexdigest" do
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe Braintree::ErrorResult do
describe "initialize" do
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe Braintree::Errors do
describe "for" do
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe Braintree::Http do
describe "self._format_and_sanitize_body_for_log" do
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe "Braintree::ResourceCollection" do
describe "enumeration" do
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
module Braintree
describe SubscriptionSearch do
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe Braintree::Subscription do
def default_params
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe Braintree::SuccessfulResult do
describe "initialize" do
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
describe Braintree::Transaction::CreditCardDetails do
describe "expiration_date" do
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/../../spec_helper"
+require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
describe Braintree::Transaction::CustomerDetails do
describe "inspect" do
Oops, something went wrong.

0 comments on commit efde418

Please sign in to comment.