0
module ActiveMerchant #:nodoc:
0
+ obj.equal?(self) || (obj.instance_of?(self.class) &&
0
+ code(:alpha2) == obj.code(:alpha2) &&
0
+ code(:alpha3) == obj.code(:alpha3) &&
0
+ code(:numeric) == obj.code(:numeric))
0
+ obj.equal?(self) || (obj.instance_of?(self.class) &&
0
+ @value == obj.value &&
0
module Shipping #:nodoc:
0
alias_method :zip, :postal_code
0
alias_method :postal, :postal_code
0
alias_method :state, :province
0
alias_method :territory, :province
0
alias_method :region, :province
0
def initialize(options = {})
0
@country = (options[:country].nil? or options[:country].is_a?(ActiveMerchant::Country)) ?
0
- ActiveMerchant::Country.find(options[:country])
0
+ ActiveMerchant::Country.find(options[:country])
0
@postal_code = options[:postal_code] || options[:postal] || options[:zip]
0
@province = options[:province] || options[:state] || options[:territory] || options[:region]
0
@@ -32,9 +59,9 @@ module ActiveMerchant #:nodoc:
0
@phone = options[:phone]
0
def self.from(object, options={})
0
- return object if object.is_a?
ActiveMerchant::Shipping::Location0
+ return object if object.is_a?
self.class0
:country => [:country_code, :country],
0
:postal_code => [:postal_code, :zip, :postal],
0
@@ -63,15 +90,15 @@ module ActiveMerchant #:nodoc:
0
self.new(attributes.update(options))
0
def country_code(format)
0
@country.nil? ? nil : @country.code(format).first.value
0
prettyprint.gsub(/\n/, ' ')
0
chunks << [@address1,@address2,@address3].reject {|e| e.blank?}.join("\n")
0
@@ -79,14 +106,31 @@ module ActiveMerchant #:nodoc:
0
chunks.reject {|e| e.blank?}.join("\n")
0
string << "\nPhone: #{@phone}" unless @phone.blank?
0
string << "\nFax: #{@fax}" unless @fax.blank?
0
+ obj.equal?(self) || (obj.instance_of?(self.class) &&
0
+ country == obj.country &&
0
+ postal_code == obj.postal_code &&
0
+ province == obj.province &&
0
+ address1 == obj.address1 &&
0
+ address2 == obj.address2 &&
0
+ address3 == obj.address3 &&
0
\ No newline at end of file
Comments
No one has commented yet.