class Firstfm::Location

Attributes

city[RW]
country[RW]
lat[RW]
long[RW]
postalcode[RW]
street[RW]

Public Class Methods

init_location_from_hash(hash) click to toggle source
# 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