lib/braintree/address.rb in braintree-2.3.1 vs lib/braintree/address.rb in braintree-2.4.0

- old
+ new

@@ -4,11 +4,12 @@ # as the shipping address when creating a Transaction. class Address include BaseModule # :nodoc: attr_reader :company, :country_name, :created_at, :customer_id, :extended_address, :first_name, :id, - :last_name, :locality, :postal_code, :region, :street_address, :updated_at + :last_name, :locality, :postal_code, :region, :street_address, :updated_at, + :country_code_alpha2, :country_code_alpha3, :country_code_numeric def self.create(attributes) Util.verify_keys(_create_signature, attributes) unless attributes[:customer_id] raise ArgumentError, "Expected hash to contain a :customer_id" @@ -97,19 +98,24 @@ class << self protected :new end def self._create_signature # :nodoc: - [:company, :country_name, :customer_id, :extended_address, :first_name, - :last_name, :locality, :postal_code, :region, :street_address] + _shared_signature + [:customer_id] end def self._determine_customer_id(customer_or_customer_id) # :nodoc: customer_id = customer_or_customer_id.is_a?(Customer) ? customer_or_customer_id.id : customer_or_customer_id unless customer_id =~ /\A[\w_-]+\z/ raise ArgumentError, "customer_id contains invalid characters" end customer_id + end + + def self._shared_signature # :nodoc: + [:company, :country_code_alpha2, :country_code_alpha3, :country_code_numeric, + :country_name, :extended_address, :first_name, + :last_name, :locality, :postal_code, :region, :street_address] end def self._new(*args) # :nodoc: self.new *args end