Method: Physical::Location#initialize

Defined in:
lib/physical/location.rb

#initialize(name: nil, company_name: nil, address1: nil, address2: nil, address3: nil, city: nil, region: nil, zip: nil, country: nil, phone: nil, fax: nil, email: nil, address_type: nil, latitude: nil, longitude: nil, properties: {}) ⇒ Location

Returns a new instance of Location.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/physical/location.rb', line 28

def initialize(
  name: nil,
  company_name: nil,
  address1: nil,
  address2: nil,
  address3: nil,
  city: nil,
  region: nil,
  zip: nil,
  country: nil,
  phone: nil,
  fax: nil,
  email: nil,
  address_type: nil,
  latitude: nil,
  longitude: nil,
  properties: {}
)

  @country = if country.is_a?(Carmen::Country)
               country
             else
               Carmen::Country.coded(country.to_s)
             end

  if region.is_a?(Carmen::Region)
    @region = region
  elsif @country.is_a?(Carmen::Country)
    @region = @country.subregions.coded(region.to_s.upcase)
  end

  @name = name
  @company_name = company_name
  @address1 = address1
  @address2 = address2
  @address3 = address3
  @city = city
  @zip = zip
  @phone = phone
  @fax = fax
  @email = email
  @address_type = address_type
  @latitude = latitude
  @longitude = longitude
  @properties = properties
end