Method: ActiveShipping::Location#initialize

Defined in:
lib/active_shipping/location.rb

#initialize(options = {}) ⇒ Location

Returns a new instance of Location.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/active_shipping/location.rb', line 26

def initialize(options = {})
  @country = (options[:country].nil? or options[:country].is_a?(ActiveUtils::Country)) ?
                options[:country] :
                ActiveUtils::Country.find(options[:country])
  @postal_code = options[:postal_code] || options[:postal] || options[:zip]
  @province = options[:province] || options[:state] || options[:territory] || options[:region]
  @city = options[:city]
  @name = options[:name]
  @address1 = options[:address1]
  @address2 = options[:address2]
  @address3 = options[:address3]
  @phone = options[:phone]
  @fax = options[:fax]
  @company_name = options[:company_name] || options[:company]

  self.address_type = options[:address_type]
end