Class: Firstfm::Location

Inherits:
Object
  • Object
show all
Defined in:
lib/firstfm/location.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#cityObject

Returns the value of attribute city.



5
6
7
# File 'lib/firstfm/location.rb', line 5

def city
  @city
end

#countryObject

Returns the value of attribute country.



5
6
7
# File 'lib/firstfm/location.rb', line 5

def country
  @country
end

#latObject

Returns the value of attribute lat.



5
6
7
# File 'lib/firstfm/location.rb', line 5

def lat
  @lat
end

#longObject

Returns the value of attribute long.



5
6
7
# File 'lib/firstfm/location.rb', line 5

def long
  @long
end

#postalcodeObject

Returns the value of attribute postalcode.



5
6
7
# File 'lib/firstfm/location.rb', line 5

def postalcode
  @postalcode
end

#streetObject

Returns the value of attribute street.



5
6
7
# File 'lib/firstfm/location.rb', line 5

def street
  @street
end

Class Method Details

.init_location_from_hash(hash) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/firstfm/location.rb', line 7

def self.init_location_from_hash(hash)
  return nil unless hash.is_a?(Hash)

  location = Location.new
  location.city         = hash["city"]
  location.country      = hash["country"]
  location.postalcode   = hash["postalcode"]
  location.street       = hash["street"]
  location.lat          = hash["geo:point"]["geo:lat"] if hash["geo:point"]
  location.long         = hash["geo:point"]["geo:long"] if hash["geo:point"]
  location
end