From e2f9950aa6904f14c63742e9c0a76024e9187aec Mon Sep 17 00:00:00 2001 From: Braintree Date: Tue, 7 Jun 2011 13:39:28 -0500 Subject: [PATCH] 2.10.1 --- CHANGELOG.rdoc | 5 ++ README.rdoc | 2 +- Rakefile | 8 ++-- lib/braintree/address.rb | 2 +- lib/braintree/configuration.rb | 2 +- lib/braintree/credit_card.rb | 48 +++++++++---------- lib/braintree/credit_card_verification.rb | 2 +- lib/braintree/customer.rb | 48 +++++++++---------- lib/braintree/error_codes.rb | 10 ++-- lib/braintree/error_result.rb | 2 +- lib/braintree/errors.rb | 2 +- lib/braintree/exceptions.rb | 22 ++++----- lib/braintree/subscription.rb | 12 ++--- lib/braintree/successful_result.rb | 2 +- lib/braintree/test/credit_card_numbers.rb | 2 +- lib/braintree/test/transaction_amounts.rb | 2 +- lib/braintree/transaction.rb | 38 +++++++-------- lib/braintree/transparent_redirect.rb | 20 ++++---- lib/braintree/validation_error.rb | 2 +- lib/braintree/validation_error_collection.rb | 2 +- lib/braintree/version.rb | 2 +- lib/braintree/xml/generator.rb | 8 +++- spec/integration/braintree/http_spec.rb | 16 +------ .../integration/braintree/transaction_spec.rb | 8 ++-- spec/spec.opts | 2 +- 25 files changed, 133 insertions(+), 136 deletions(-) diff --git a/CHANGELOG.rdoc b/CHANGELOG.rdoc index 5b757da9..c493c0e5 100644 --- a/CHANGELOG.rdoc +++ b/CHANGELOG.rdoc @@ -1,3 +1,8 @@ +== 2.10.1 + +* Support builder >= 2.0 +* Changed comments to point to new doc site + == 2.10.0 * Added subscription_details to Transaction diff --git a/README.rdoc b/README.rdoc index bb77ba00..f4785540 100644 --- a/README.rdoc +++ b/README.rdoc @@ -67,7 +67,7 @@ Otherwise, we recommend using the non-bang methods. == More Information -* Documentation[http://www.braintreepaymentsolutions.com/docs/ruby] +* Documentation[http://www.braintreepayments.com/docs/ruby] == Tests diff --git a/Rakefile b/Rakefile index 2c285e25..236f3903 100644 --- a/Rakefile +++ b/Rakefile @@ -24,13 +24,13 @@ gem_spec = Gem::Specification.new do |s| s.summary = "Braintree Gateway Ruby Client Library" s.description = "Ruby library for integrating with the Braintree Gateway" s.version = Braintree::Version::String - s.author = "Braintree Payment Solutions" - s.email = "devs@getbraintree.com" - s.homepage = "http://www.braintreepaymentsolutions.com/gateway" + s.author = "Braintree" + s.email = "code@getbraintree.com" + s.homepage = "http://www.braintreepayments.com/" s.rubyforge_project = "braintree" s.has_rdoc = false s.files = FileList["README.rdoc", "LICENSE", "{lib,spec}/**/*.rb", "lib/**/*.crt"] - s.add_dependency "builder" + s.add_dependency "builder", ">= 2.0.0" end task :gem do diff --git a/lib/braintree/address.rb b/lib/braintree/address.rb index be754db1..805303d5 100644 --- a/lib/braintree/address.rb +++ b/lib/braintree/address.rb @@ -1,5 +1,5 @@ module Braintree - # See http://www.braintreepaymentsolutions.com/docs/ruby/addresses/details + # See http://www.braintreepayments.com/docs/ruby/addresses/details class Address include BaseModule # :nodoc: diff --git a/lib/braintree/configuration.rb b/lib/braintree/configuration.rb index 6a5fd83f..d33ef332 100644 --- a/lib/braintree/configuration.rb +++ b/lib/braintree/configuration.rb @@ -1,5 +1,5 @@ module Braintree - # See http://www.braintreepaymentsolutions.com/docs/ruby + # See http://www.braintreepayments.com/docs/ruby class Configuration API_VERSION = "2" # :nodoc: diff --git a/lib/braintree/credit_card.rb b/lib/braintree/credit_card.rb index 270d5480..9d75d617 100644 --- a/lib/braintree/credit_card.rb +++ b/lib/braintree/credit_card.rb @@ -1,5 +1,5 @@ module Braintree - # See http://www.braintreepaymentsolutions.com/docs/ruby + # See http://www.braintreepayments.com/docs/ruby class CreditCard include BaseModule # :nodoc: @@ -29,83 +29,83 @@ module CustomerLocation attr_reader :billing_address, :bin, :card_type, :cardholder_name, :created_at, :customer_id, :expiration_month, :expiration_year, :last_4, :subscriptions, :token, :updated_at - # See http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/create + # See http://www.braintreepayments.com/docs/ruby/credit_cards/create def self.create(attributes) Configuration.gateway.credit_card.create(attributes) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/create + # See http://www.braintreepayments.com/docs/ruby/credit_cards/create def self.create!(attributes) return_object_or_raise(:credit_card) { create(attributes) } end # Deprecated. Use Braintree::TransparentRedirect.url - # See http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/create_tr + # See http://www.braintreepayments.com/docs/ruby/credit_cards/create_tr def self.create_credit_card_url warn "[DEPRECATED] CreditCard.create_credit_card_url is deprecated. Please use TransparentRedirect.url" Configuration.gateway.credit_card.create_credit_card_url end # Deprecated. Use Braintree::TransparentRedirect.confirm - # See http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/create_tr + # See http://www.braintreepayments.com/docs/ruby/credit_cards/create_tr def self.create_from_transparent_redirect(query_string) warn "[DEPRECATED] CreditCard.create_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm" Configuration.gateway.credit_card.create_from_transparent_redirect(query_string) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault + # See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault def self.credit(token, transaction_attributes) Transaction.credit(transaction_attributes.merge(:payment_method_token => token)) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault + # See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault def self.credit!(token, transaction_attributes) return_object_or_raise(:transaction) { credit(token, transaction_attributes) } end - # See http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/delete + # See http://www.braintreepayments.com/docs/ruby/credit_cards/delete def self.delete(token) Configuration.gateway.credit_card.delete(token) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/search + # See http://www.braintreepayments.com/docs/ruby/credit_cards/search def self.expired(options = {}) Configuration.gateway.credit_card.expired(options) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/search + # See http://www.braintreepayments.com/docs/ruby/credit_cards/search def self.expiring_between(start_date, end_date, options = {}) Configuration.gateway.credit_card.expiring_between(start_date, end_date, options) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/search + # See http://www.braintreepayments.com/docs/ruby/credit_cards/search def self.find(token) Configuration.gateway.credit_card.find(token) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault + # See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault def self.sale(token, transaction_attributes) Configuration.gateway.transaction.sale(transaction_attributes.merge(:payment_method_token => token)) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault + # See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault def self.sale!(token, transaction_attributes) return_object_or_raise(:transaction) { sale(token, transaction_attributes) } end - # See http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/update + # See http://www.braintreepayments.com/docs/ruby/credit_cards/update def self.update(token, attributes) Configuration.gateway.credit_card.update(token, attributes) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/update + # See http://www.braintreepayments.com/docs/ruby/credit_cards/update def self.update!(token, attributes) return_object_or_raise(:credit_card) { update(token, attributes) } end # Deprecated. Use Braintree::TransparentRedirect.confirm # - # See http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/update_tr + # See http://www.braintreepayments.com/docs/ruby/credit_cards/update_tr def self.update_from_transparent_redirect(query_string) warn "[DEPRECATED] CreditCard.update_via_transparent_redirect_request is deprecated. Please use TransparentRedirect.confirm" Configuration.gateway.credit_card.update_from_transparent_redirect(query_string) @@ -113,7 +113,7 @@ def self.update_from_transparent_redirect(query_string) # Deprecated. Use Braintree::TransparentRedirect.url # - # See http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/update_tr + # See http://www.braintreepayments.com/docs/ruby/credit_cards/update_tr def self.update_credit_card_url warn "[DEPRECATED] CreditCard.update_credit_card_url is deprecated. Please use TransparentRedirect.url" Configuration.gateway.credit_card.update_credit_card_url @@ -128,7 +128,7 @@ def initialize(gateway, attributes) # :nodoc: # Deprecated. Use Braintree::CreditCard.credit # - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault + # See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault def credit(transaction_attributes) warn "[DEPRECATED] credit as an instance method is deprecated. Please use CreditCard.credit" @gateway.transaction.credit(transaction_attributes.merge(:payment_method_token => token)) @@ -136,7 +136,7 @@ def credit(transaction_attributes) # Deprecated. Use Braintree::CreditCard.credit! # - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault + # See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault def credit!(transaction_attributes) warn "[DEPRECATED] credit! as an instance method is deprecated. Please use CreditCard.credit!" return_object_or_raise(:transaction) { credit(transaction_attributes) } @@ -144,7 +144,7 @@ def credit!(transaction_attributes) # Deprecated. Use Braintree::CreditCard.delete # - # http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/delete + # http://www.braintreepayments.com/docs/ruby/credit_cards/delete def delete warn "[DEPRECATED] delete as an instance method is deprecated. Please use CreditCard.delete" @gateway.credit_card.delete(token) @@ -180,7 +180,7 @@ def masked_number # Deprecated. Use Braintree::CreditCard.sale # - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault + # See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault def sale(transaction_attributes) warn "[DEPRECATED] sale as an instance method is deprecated. Please use CreditCard.sale" @gateway.transaction.sale(transaction_attributes.merge(:payment_method_token => token)) @@ -188,7 +188,7 @@ def sale(transaction_attributes) # Deprecated. Use Braintree::CreditCard.sale! # - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault + # See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault def sale!(transaction_attributes) warn "[DEPRECATED] sale! as an instance method is deprecated. Please use CreditCard.sale!" return_object_or_raise(:transaction) { sale(transaction_attributes) } @@ -196,7 +196,7 @@ def sale!(transaction_attributes) # Deprecated. Use Braintree::CreditCard.update # - # See http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/update + # See http://www.braintreepayments.com/docs/ruby/credit_cards/update def update(attributes) warn "[DEPRECATED] update as an instance method is deprecated. Please use CreditCard.update" result = @gateway.credit_card.update(token, attributes) @@ -208,7 +208,7 @@ def update(attributes) # Deprecated. Use Braintree::CreditCard.update! # - # See http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/update + # See http://www.braintreepayments.com/docs/ruby/credit_cards/update def update!(attributes) warn "[DEPRECATED] update! as an instance method is deprecated. Please use CreditCard.update!" return_object_or_raise(:credit_card) { update(attributes) } diff --git a/lib/braintree/credit_card_verification.rb b/lib/braintree/credit_card_verification.rb index a480f99f..c40c656f 100644 --- a/lib/braintree/credit_card_verification.rb +++ b/lib/braintree/credit_card_verification.rb @@ -1,5 +1,5 @@ module Braintree - # See http://www.braintreepaymentsolutions.com/docs/ruby/general/card_verification + # See http://www.braintreepayments.com/docs/ruby/general/card_verification class CreditCardVerification include BaseModule diff --git a/lib/braintree/customer.rb b/lib/braintree/customer.rb index 36aec81a..1c01e0ec 100644 --- a/lib/braintree/customer.rb +++ b/lib/braintree/customer.rb @@ -1,29 +1,29 @@ module Braintree - # See http://www.braintreepaymentsolutions.com/docs/ruby + # See http://www.braintreepayments.com/docs/ruby class Customer include BaseModule attr_reader :addresses, :company, :created_at, :credit_cards, :email, :fax, :first_name, :id, :last_name, :phone, :updated_at, :website, :custom_fields - # See http://www.braintreepaymentsolutions.com/docs/ruby/customers/search + # See http://www.braintreepayments.com/docs/ruby/customers/search def self.all Configuration.gateway.customer.all end - # See http://www.braintreepaymentsolutions.com/docs/ruby/customers/create + # See http://www.braintreepayments.com/docs/ruby/customers/create def self.create(attributes = {}) Configuration.gateway.customer.create(attributes) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/customers/create + # See http://www.braintreepayments.com/docs/ruby/customers/create def self.create!(attributes = {}) return_object_or_raise(:customer) { create(attributes) } end # Deprecated. Use Braintree::TransparentRedirect.url # - # See http://www.braintreepaymentsolutions.com/docs/ruby/customers/create_tr + # See http://www.braintreepayments.com/docs/ruby/customers/create_tr def self.create_customer_url warn "[DEPRECATED] Customer.create_customer_url is deprecated. Please use TransparentRedirect.url" Configuration.gateway.customer.create_customer_url @@ -31,43 +31,43 @@ def self.create_customer_url # Deprecated. Use Braintree::TransparentRedirect.confirm # - # See http://www.braintreepaymentsolutions.com/docs/ruby/customers/create_tr + # See http://www.braintreepayments.com/docs/ruby/customers/create_tr def self.create_from_transparent_redirect(query_string) warn "[DEPRECATED] Customer.create_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm" Configuration.gateway.customer.create_from_transparent_redirect(query_string) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault + # See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault def self.credit(customer_id, transaction_attributes) Transaction.credit(transaction_attributes.merge(:customer_id => customer_id)) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault + # See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault def self.credit!(customer_id, transaction_attributes) return_object_or_raise(:transaction){ credit(customer_id, transaction_attributes) } end - # See http://www.braintreepaymentsolutions.com/docs/ruby/customers/delete + # See http://www.braintreepayments.com/docs/ruby/customers/delete def self.delete(customer_id) Configuration.gateway.customer.delete(customer_id) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/customers/search + # See http://www.braintreepayments.com/docs/ruby/customers/search def self.find(customer_id) Configuration.gateway.customer.find(customer_id) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault + # See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault def self.sale(customer_id, transaction_attributes) Transaction.sale(transaction_attributes.merge(:customer_id => customer_id)) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault + # See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault def self.sale!(customer_id, transaction_attributes) return_object_or_raise(:transaction) { sale(customer_id, transaction_attributes) } end - # See http://www.braintreepaymentsolutions.com/docs/ruby/customers/search + # See http://www.braintreepayments.com/docs/ruby/customers/search def self.search(&block) Configuration.gateway.customer.search(&block) end @@ -77,19 +77,19 @@ def self.transactions(customer_id, options = {}) Configuration.gateway.customer.transactions(customer_id, options = {}) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/customers/update + # See http://www.braintreepayments.com/docs/ruby/customers/update def self.update(customer_id, attributes) Configuration.gateway.customer.update(customer_id, attributes) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/customers/update + # See http://www.braintreepayments.com/docs/ruby/customers/update def self.update!(customer_id, attributes) return_object_or_raise(:customer) { update(customer_id, attributes) } end # Deprecated. Use Braintree::TransparentRedirect.url # - # See http://www.braintreepaymentsolutions.com/docs/ruby/customers/update_tr + # See http://www.braintreepayments.com/docs/ruby/customers/update_tr def self.update_customer_url warn "[DEPRECATED] Customer.update_customer_url is deprecated. Please use TransparentRedirect.url" Configuration.gateway.customer.update_customer_url @@ -97,7 +97,7 @@ def self.update_customer_url # Deprecated. Use Braintree::TransparentRedirect.confirm # - # See http://www.braintreepaymentsolutions.com/docs/ruby/customers/update_tr + # See http://www.braintreepayments.com/docs/ruby/customers/update_tr def self.update_from_transparent_redirect(query_string) warn "[DEPRECATED] Customer.update_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm" Configuration.gateway.customer.update_from_transparent_redirect(query_string) @@ -110,17 +110,17 @@ def initialize(gateway, attributes) # :nodoc: @addresses = (@addresses || []).map { |addr| Address._new gateway, addr } end - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault + # See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault def credit(transaction_attributes) @gateway.transaction.credit(transaction_attributes.merge(:customer_id => id)) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault + # See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault def credit!(transaction_attributes) return_object_or_raise(:transaction) { credit(transaction_attributes) } end - # See http://www.braintreepaymentsolutions.com/docs/ruby/customers/delete + # See http://www.braintreepayments.com/docs/ruby/customers/delete def delete @gateway.customer.delete(id) end @@ -137,7 +137,7 @@ def inspect # :nodoc: # Deprecated. Use Braintree::Customer.sale # - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault + # See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault def sale(transaction_attributes) warn "[DEPRECATED] sale as an instance method is deprecated. Please use Customer.sale" @gateway.transaction.sale(transaction_attributes.merge(:customer_id => id)) @@ -145,7 +145,7 @@ def sale(transaction_attributes) # Deprecated. Use Braintree::Customer.sale! # - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault + # See http://www.braintreepayments.com/docs/ruby/transactions/create_from_vault def sale!(transaction_attributes) warn "[DEPRECATED] sale! as an instance method is deprecated. Please use Customer.sale!" return_object_or_raise(:transaction) { sale(transaction_attributes) } @@ -158,7 +158,7 @@ def transactions(options = {}) # Deprecated. Use Braintree::Customer.update # - # See http://www.braintreepaymentsolutions.com/docs/ruby/customers/update + # See http://www.braintreepayments.com/docs/ruby/customers/update def update(attributes) warn "[DEPRECATED] update as an instance method is deprecated. Please use Customer.update" result = @gateway.customer.update(id, attributes) @@ -170,7 +170,7 @@ def update(attributes) # Deprecated. Use Braintree::Customer.update! # - # See http://www.braintreepaymentsolutions.com/docs/ruby/customers/update + # See http://www.braintreepayments.com/docs/ruby/customers/update def update!(attributes) warn "[DEPRECATED] update! as an instance method is deprecated. Please use Customer.update!" return_object_or_raise(:customer) { update(attributes) } diff --git a/lib/braintree/error_codes.rb b/lib/braintree/error_codes.rb index a5c33402..6e4dde31 100644 --- a/lib/braintree/error_codes.rb +++ b/lib/braintree/error_codes.rb @@ -3,7 +3,7 @@ module Braintree # The constants should be used to check for a specific validation error in a ValidationErrorCollection. # The error messages returned from the server may change, but the codes will remain the same. module ErrorCodes - # See http://www.braintreepaymentsolutions.com/docs/ruby/addresses/validations + # See http://www.braintreepayments.com/docs/ruby/addresses/validations module Address CannotBeBlank = "81801" CompanyIsTooLong = "81802" @@ -25,7 +25,7 @@ module Address TooManyAddressesPerCustomer = "91818" end - # See http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/validations + # See http://www.braintreepayments.com/docs/ruby/credit_cards/validations module CreditCard BillingAddressConflict = "91701" BillingAddressIdIsInvalid = "91702" @@ -57,7 +57,7 @@ module Options end end - # See http://www.braintreepaymentsolutions.com/docs/ruby/customers/validations + # See http://www.braintreepayments.com/docs/ruby/customers/validations module Customer CompanyIsTooLong = "81601" CustomFieldIsInvalid = "91602" @@ -84,7 +84,7 @@ module Descriptor NameFormatIsInvalid = "92201" end - # See http://www.braintreepaymentsolutions.com/docs/ruby/subscriptions/validations + # See http://www.braintreepayments.com/docs/ruby/subscriptions/validations module Subscription BillingDayOfMonthCannotBeUpdated = "91918" BillingDayOfMonthIsInvalid = "91914" @@ -142,7 +142,7 @@ module Modification end end - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/validations + # See http://www.braintreepayments.com/docs/ruby/transactions/validations module Transaction AmountCannotBeNegative = "81501" AmountIsInvalid = "81503" diff --git a/lib/braintree/error_result.rb b/lib/braintree/error_result.rb index d918abf9..5da4f239 100644 --- a/lib/braintree/error_result.rb +++ b/lib/braintree/error_result.rb @@ -1,5 +1,5 @@ module Braintree - # See http://www.braintreepaymentsolutions.com/docs/ruby/general/result_objects + # See http://www.braintreepayments.com/docs/ruby/general/result_objects class ErrorResult attr_reader :credit_card_verification, :transaction, :subscription, :errors, :params, :message diff --git a/lib/braintree/errors.rb b/lib/braintree/errors.rb index b02dc8c5..75aeba05 100644 --- a/lib/braintree/errors.rb +++ b/lib/braintree/errors.rb @@ -1,5 +1,5 @@ module Braintree - # See http://www.braintreepaymentsolutions.com/docs/ruby/general/validation_errors + # See http://www.braintreepayments.com/docs/ruby/general/validation_errors class Errors include Enumerable diff --git a/lib/braintree/exceptions.rb b/lib/braintree/exceptions.rb index f1078253..04a35c8e 100644 --- a/lib/braintree/exceptions.rb +++ b/lib/braintree/exceptions.rb @@ -2,41 +2,41 @@ module Braintree # :nodoc: # Super class for all Braintree exceptions. class BraintreeError < ::StandardError; end - # See http://www.braintreepaymentsolutions.com/docs/ruby/general/exceptions + # See http://www.braintreepayments.com/docs/ruby/general/exceptions class AuthenticationError < BraintreeError; end - # See http://www.braintreepaymentsolutions.com/docs/ruby/general/exceptions + # See http://www.braintreepayments.com/docs/ruby/general/exceptions class AuthorizationError < BraintreeError; end - # See http://www.braintreepaymentsolutions.com/docs/ruby/general/exceptions + # See http://www.braintreepayments.com/docs/ruby/general/exceptions class ConfigurationError < BraintreeError def initialize(setting, message) # :nodoc: super "Braintree::Configuration.#{setting} #{message}" end end - # See http://www.braintreepaymentsolutions.com/docs/ruby/general/exceptions + # See http://www.braintreepayments.com/docs/ruby/general/exceptions class DownForMaintenanceError < BraintreeError; end - # See http://www.braintreepaymentsolutions.com/docs/ruby/general/exceptions + # See http://www.braintreepayments.com/docs/ruby/general/exceptions class ForgedQueryString < BraintreeError; end - # See http://www.braintreepaymentsolutions.com/docs/ruby/general/exceptions + # See http://www.braintreepayments.com/docs/ruby/general/exceptions class NotFoundError < BraintreeError; end - # See http://www.braintreepaymentsolutions.com/docs/ruby/general/exceptions + # See http://www.braintreepayments.com/docs/ruby/general/exceptions class ServerError < BraintreeError; end - # See http://www.braintreepaymentsolutions.com/docs/ruby/general/exceptions + # See http://www.braintreepayments.com/docs/ruby/general/exceptions class SSLCertificateError < BraintreeError; end - # See http://www.braintreepaymentsolutions.com/docs/ruby/general/exceptions + # See http://www.braintreepayments.com/docs/ruby/general/exceptions class UnexpectedError < BraintreeError; end - # See http://www.braintreepaymentsolutions.com/docs/ruby/general/exceptions + # See http://www.braintreepayments.com/docs/ruby/general/exceptions class UpgradeRequiredError < BraintreeError; end - # See http://www.braintreepaymentsolutions.com/docs/ruby/general/exceptions + # See http://www.braintreepayments.com/docs/ruby/general/exceptions class ValidationsFailed < BraintreeError attr_reader :error_result diff --git a/lib/braintree/subscription.rb b/lib/braintree/subscription.rb index 85667f93..af551324 100644 --- a/lib/braintree/subscription.rb +++ b/lib/braintree/subscription.rb @@ -1,5 +1,5 @@ module Braintree - # See http://www.braintreepaymentsolutions.com/docs/ruby/subscriptions/overview + # See http://www.braintreepayments.com/docs/ruby/subscriptions/overview class Subscription include BaseModule @@ -29,12 +29,12 @@ module TrialDurationUnit attr_reader :add_ons, :discounts attr_reader :descriptor - # See http://www.braintreepaymentsolutions.com/docs/ruby/subscriptions/cancel + # See http://www.braintreepayments.com/docs/ruby/subscriptions/cancel def self.cancel(subscription_id) Configuration.gateway.subscription.cancel(subscription_id) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/subscriptions/create + # See http://www.braintreepayments.com/docs/ruby/subscriptions/create def self.create(attributes) Configuration.gateway.subscription.create(attributes) end @@ -43,7 +43,7 @@ def self.create!(attributes) return_object_or_raise(:subscription) { create(attributes) } end - # See http://www.braintreepaymentsolutions.com/docs/ruby/subscriptions/search + # See http://www.braintreepayments.com/docs/ruby/subscriptions/search def self.find(id) Configuration.gateway.subscription.find(id) end @@ -52,12 +52,12 @@ def self.retry_charge(subscription_id, amount=nil) Configuration.gateway.transaction.retry_subscription_charge(subscription_id, amount) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/subscriptions/search + # See http://www.braintreepayments.com/docs/ruby/subscriptions/search def self.search(&block) Configuration.gateway.subscription.search(&block) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/subscriptions/update + # See http://www.braintreepayments.com/docs/ruby/subscriptions/update def self.update(subscription_id, attributes) Configuration.gateway.subscription.update(subscription_id, attributes) end diff --git a/lib/braintree/successful_result.rb b/lib/braintree/successful_result.rb index b1ee8419..83476cac 100644 --- a/lib/braintree/successful_result.rb +++ b/lib/braintree/successful_result.rb @@ -1,5 +1,5 @@ module Braintree - # See http://www.braintreepaymentsolutions.com/docs/ruby/general/result_objects + # See http://www.braintreepayments.com/docs/ruby/general/result_objects class SuccessfulResult include BaseModule diff --git a/lib/braintree/test/credit_card_numbers.rb b/lib/braintree/test/credit_card_numbers.rb index cf5a81dc..9bc8a18f 100644 --- a/lib/braintree/test/credit_card_numbers.rb +++ b/lib/braintree/test/credit_card_numbers.rb @@ -4,7 +4,7 @@ module Test # :nodoc: # credit card numbers that should be used when working in the sandbox environment. The sandbox # will not accept any credit card numbers other than the ones listed below. # - # See http://www.braintreepaymentsolutions.com/docs/ruby/reference/sandbox + # See http://www.braintreepayments.com/docs/ruby/reference/sandbox module CreditCardNumbers AmExes = %w[ 378282246310005 diff --git a/lib/braintree/test/transaction_amounts.rb b/lib/braintree/test/transaction_amounts.rb index c993b53d..50cbf0db 100644 --- a/lib/braintree/test/transaction_amounts.rb +++ b/lib/braintree/test/transaction_amounts.rb @@ -3,7 +3,7 @@ module Test # :nodoc: # The constants in this module can be used to create transactions with # the desired status in the sandbox environment. # - # See http://www.braintreepaymentsolutions.com/docs/ruby/reference/sandbox + # See http://www.braintreepayments.com/docs/ruby/reference/sandbox module TransactionAmounts Authorize = "1000.00" Decline = "2000.00" diff --git a/lib/braintree/transaction.rb b/lib/braintree/transaction.rb index 5e56d1f0..c21c6c0c 100644 --- a/lib/braintree/transaction.rb +++ b/lib/braintree/transaction.rb @@ -1,5 +1,5 @@ module Braintree - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/overview + # See http://www.braintreepayments.com/docs/ruby/transactions/overview class Transaction include BaseModule @@ -71,19 +71,19 @@ module Type # :nodoc: attr_reader :updated_at attr_reader :add_ons, :discounts - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create + # See http://www.braintreepayments.com/docs/ruby/transactions/create def self.create(attributes) Configuration.gateway.transaction.create(attributes) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create + # See http://www.braintreepayments.com/docs/ruby/transactions/create def self.create!(attributes) return_object_or_raise(:transaction) { create(attributes) } end # Deprecated. Use Braintree::TransparentRedirect.confirm # - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_tr + # See http://www.braintreepayments.com/docs/ruby/transactions/create_tr def self.create_from_transparent_redirect(query_string) warn "[DEPRECATED] Transaction.create_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm" Configuration.gateway.transaction.create_from_transparent_redirect(query_string) @@ -91,7 +91,7 @@ def self.create_from_transparent_redirect(query_string) # Deprecated. Use Braintree::TransparentRedirect.url # - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_tr + # See http://www.braintreepayments.com/docs/ruby/transactions/create_tr def self.create_transaction_url warn "[DEPRECATED] Transaction.create_transaction_url is deprecated. Please use TransparentRedirect.url" Configuration.gateway.transaction.create_transaction_url @@ -105,47 +105,47 @@ def self.credit!(attributes) return_object_or_raise(:transaction) { credit(attributes) } end - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/search + # See http://www.braintreepayments.com/docs/ruby/transactions/search def self.find(id) Configuration.gateway.transaction.find(id) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/refund + # See http://www.braintreepayments.com/docs/ruby/transactions/refund def self.refund(id, amount = nil) Configuration.gateway.transaction.refund(id, amount) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create + # See http://www.braintreepayments.com/docs/ruby/transactions/create def self.sale(attributes) Configuration.gateway.transaction.sale(attributes) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create + # See http://www.braintreepayments.com/docs/ruby/transactions/create def self.sale!(attributes) return_object_or_raise(:transaction) { sale(attributes) } end - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/search + # See http://www.braintreepayments.com/docs/ruby/transactions/search def self.search(&block) Configuration.gateway.transaction.search(&block) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/submit_for_settlement + # See http://www.braintreepayments.com/docs/ruby/transactions/submit_for_settlement def self.submit_for_settlement(transaction_id, amount = nil) Configuration.gateway.transaction.submit_for_settlement(transaction_id, amount) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/submit_for_settlement + # See http://www.braintreepayments.com/docs/ruby/transactions/submit_for_settlement def self.submit_for_settlement!(transaction_id, amount = nil) return_object_or_raise(:transaction) { submit_for_settlement(transaction_id, amount) } end - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/void + # See http://www.braintreepayments.com/docs/ruby/transactions/void def self.void(transaction_id) Configuration.gateway.transaction.void(transaction_id) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/void + # See http://www.braintreepayments.com/docs/ruby/transactions/void def self.void!(transaction_id) return_object_or_raise(:transaction) { void(transaction_id) } end @@ -187,7 +187,7 @@ def inspect # :nodoc: # Deprecated. Use Braintree::Transaction.refund # - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/refund + # See http://www.braintreepayments.com/docs/ruby/transactions/refund def refund(amount = nil) warn "[DEPRECATED] refund as an instance method is deprecated. Please use Transaction.refund" result = @gateway.transaction.refund(id, amount) @@ -211,7 +211,7 @@ def refund_id # Deprecated. Use Braintree::Transaction.submit_for_settlement # - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/submit_for_settlement + # See http://www.braintreepayments.com/docs/ruby/transactions/submit_for_settlement def submit_for_settlement(amount = nil) warn "[DEPRECATED] submit_for_settlement as an instance method is deprecated. Please use Transaction.submit_for_settlement" result = @gateway.transaction.submit_for_settlement(id, amount) @@ -223,7 +223,7 @@ def submit_for_settlement(amount = nil) # Deprecated. Use Braintree::Transaction.submit_for_settlement! # - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/submit_for_settlement + # See http://www.braintreepayments.com/docs/ruby/transactions/submit_for_settlement def submit_for_settlement!(amount = nil) warn "[DEPRECATED] submit_for_settlement! as an instance method is deprecated. Please use Transaction.submit_for_settlement!" return_object_or_raise(:transaction) { submit_for_settlement(amount) } @@ -267,7 +267,7 @@ def vault_shipping_address # Deprecated. Use Braintree::Transaction.void # - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/void + # See http://www.braintreepayments.com/docs/ruby/transactions/void def void warn "[DEPRECATED] void as an instance method is deprecated. Please use Transaction.void" result = @gateway.transaction.void(id) @@ -279,7 +279,7 @@ def void # Deprecated. Use Braintree::Transaction.void! # - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/void + # See http://www.braintreepayments.com/docs/ruby/transactions/void def void! warn "[DEPRECATED] void! as an instance method is deprecated. Please use Transaction.void!" return_object_or_raise(:transaction) { void } diff --git a/lib/braintree/transparent_redirect.rb b/lib/braintree/transparent_redirect.rb index 4116932c..03911fb5 100644 --- a/lib/braintree/transparent_redirect.rb +++ b/lib/braintree/transparent_redirect.rb @@ -1,10 +1,10 @@ module Braintree # See: - # * http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_tr - # * http://www.braintreepaymentsolutions.com/docs/ruby/customers/create_tr - # * http://www.braintreepaymentsolutions.com/docs/ruby/customers/update_tr - # * http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/create_tr - # * http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/update_tr + # * http://www.braintreepayments.com/docs/ruby/transactions/create_tr + # * http://www.braintreepayments.com/docs/ruby/customers/create_tr + # * http://www.braintreepayments.com/docs/ruby/customers/update_tr + # * http://www.braintreepayments.com/docs/ruby/credit_cards/create_tr + # * http://www.braintreepayments.com/docs/ruby/credit_cards/update_tr module TransparentRedirect module Kind # :nodoc: CreateCustomer = "create_customer" @@ -18,27 +18,27 @@ def self.confirm(query_string) Configuration.gateway.transparent_redirect.confirm(query_string) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/create_tr + # See http://www.braintreepayments.com/docs/ruby/credit_cards/create_tr def self.create_credit_card_data(params) Configuration.gateway.transparent_redirect.create_credit_card_data(params) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/customers/create_tr + # See http://www.braintreepayments.com/docs/ruby/customers/create_tr def self.create_customer_data(params) Configuration.gateway.transparent_redirect.create_customer_data(params) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_tr + # See http://www.braintreepayments.com/docs/ruby/transactions/create_tr def self.transaction_data(params) Configuration.gateway.transparent_redirect.transaction_data(params) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/update_tr + # See http://www.braintreepayments.com/docs/ruby/credit_cards/update_tr def self.update_credit_card_data(params) Configuration.gateway.transparent_redirect.update_credit_card_data(params) end - # See http://www.braintreepaymentsolutions.com/docs/ruby/customers/update_tr + # See http://www.braintreepayments.com/docs/ruby/customers/update_tr def self.update_customer_data(params) Configuration.gateway.transparent_redirect.update_customer_data(params) end diff --git a/lib/braintree/validation_error.rb b/lib/braintree/validation_error.rb index abfb52bd..e9d2094a 100644 --- a/lib/braintree/validation_error.rb +++ b/lib/braintree/validation_error.rb @@ -1,5 +1,5 @@ module Braintree - # See http://www.braintreepaymentsolutions.com/docs/ruby/general/validation_errors + # See http://www.braintreepayments.com/docs/ruby/general/validation_errors class ValidationError include BaseModule diff --git a/lib/braintree/validation_error_collection.rb b/lib/braintree/validation_error_collection.rb index d0395903..d4bf79b8 100644 --- a/lib/braintree/validation_error_collection.rb +++ b/lib/braintree/validation_error_collection.rb @@ -1,5 +1,5 @@ module Braintree - # See http://www.braintreepaymentsolutions.com/docs/ruby/general/validation_errors + # See http://www.braintreepayments.com/docs/ruby/general/validation_errors class ValidationErrorCollection include Enumerable diff --git a/lib/braintree/version.rb b/lib/braintree/version.rb index 3236d583..59fcb54c 100644 --- a/lib/braintree/version.rb +++ b/lib/braintree/version.rb @@ -2,7 +2,7 @@ module Braintree module Version Major = 2 Minor = 10 - Tiny = 0 + Tiny = 1 String = "#{Major}.#{Minor}.#{Tiny}" end diff --git a/lib/braintree/xml/generator.rb b/lib/braintree/xml/generator.rb index d981f825..724eb452 100644 --- a/lib/braintree/xml/generator.rb +++ b/lib/braintree/xml/generator.rb @@ -97,7 +97,13 @@ def self._array_to_xml(array, options = {}) end def self._xml_escape(key) - key.to_s.tr("_", "-").to_xs + dasherized_key = key.to_s.tr("_", "-") + + if Builder::XChar.respond_to?(:encode) + Builder::XChar.encode(dasherized_key) + else + dasherized_key.to_xs + end end end end diff --git a/spec/integration/braintree/http_spec.rb b/spec/integration/braintree/http_spec.rb index 49691f33..5a9a7b7f 100644 --- a/spec/integration/braintree/http_spec.rb +++ b/spec/integration/braintree/http_spec.rb @@ -113,20 +113,6 @@ end end - it "accepts the certificate on the QA server" do - begin - original_env = Braintree::Configuration.environment - Braintree::Configuration.environment = :qa - Braintree::Configuration.stub(:base_merchant_path).and_return("/") - - expect do - Braintree::Configuration.instantiate.http._http_do(Net::HTTP::Get, "/login") - end.to_not raise_error - ensure - Braintree::Configuration.environment = original_env - end - end - it "accepts the certificate on the sandbox server" do begin original_env = Braintree::Configuration.environment @@ -158,7 +144,7 @@ it "raises an appropriate error if certificate fails validation" do begin original_env = Braintree::Configuration.environment - Braintree::Configuration.environment = :qa + Braintree::Configuration.environment = :sandbox config = Braintree::Configuration.instantiate config.stub(:base_merchant_path).and_return("/") config.stub(:ca_file).and_return("does_not_exist") diff --git a/spec/integration/braintree/transaction_spec.rb b/spec/integration/braintree/transaction_spec.rb index 06e88783..472ec163 100644 --- a/spec/integration/braintree/transaction_spec.rb +++ b/spec/integration/braintree/transaction_spec.rb @@ -811,7 +811,7 @@ :email => "dan@example.com", :phone => "419-555-1234", :fax => "419-555-1235", - :website => "http://braintreepaymentsolutions.com" + :website => "http://braintreepayments.com" }, :billing => { :first_name => "Carl", @@ -862,7 +862,7 @@ transaction.customer_details.email.should == "dan@example.com" transaction.customer_details.phone.should == "419-555-1234" transaction.customer_details.fax.should == "419-555-1235" - transaction.customer_details.website.should == "http://braintreepaymentsolutions.com" + transaction.customer_details.website.should == "http://braintreepayments.com" transaction.billing_details.first_name.should == "Carl" transaction.billing_details.last_name.should == "Jones" transaction.billing_details.company.should == "Braintree" @@ -1390,7 +1390,7 @@ :email => "dan@example.com", :phone => "419-555-1234", :fax => "419-555-1235", - :website => "http://braintreepaymentsolutions.com" + :website => "http://braintreepayments.com" }, :billing => { :first_name => "Carl", @@ -1444,7 +1444,7 @@ transaction.customer_details.email.should == "dan@example.com" transaction.customer_details.phone.should == "419-555-1234" transaction.customer_details.fax.should == "419-555-1235" - transaction.customer_details.website.should == "http://braintreepaymentsolutions.com" + transaction.customer_details.website.should == "http://braintreepayments.com" transaction.billing_details.first_name.should == "Carl" transaction.billing_details.last_name.should == "Jones" transaction.billing_details.company.should == "Braintree" diff --git a/spec/spec.opts b/spec/spec.opts index c1257ed7..673bdaea 100644 --- a/spec/spec.opts +++ b/spec/spec.opts @@ -1,4 +1,4 @@ --format progress --loadby mtime --reverse ---backtrace \ No newline at end of file +--backtrace