Class: Geocoder::Result::Latlon

Inherits:
Base
  • Object
show all
Defined in:
lib/geocoder/results/latlon.rb

Instance Attribute Summary

Attributes inherited from Base

#cache_hit, #data

Instance Method Summary collapse

Methods inherited from Base

#initialize, #latitude, #longitude, #province, #province_code

Constructor Details

This class inherits a constructor from Geocoder::Result::Base

Instance Method Details

#cityObject



6
7
8
# File 'lib/geocoder/results/latlon.rb', line 6

def city
  address_components["city"]
end

#coordinatesObject



10
11
12
# File 'lib/geocoder/results/latlon.rb', line 10

def coordinates
  [@data['lat'].to_f, @data['lon'].to_f]
end

#countryObject



14
15
16
# File 'lib/geocoder/results/latlon.rb', line 14

def country
  "United States" # LatLon.io only supports the US
end

#country_codeObject



18
19
20
# File 'lib/geocoder/results/latlon.rb', line 18

def country_code
  "US" # LatLon.io only supports the US
end

#formatted_address(format = :full) ⇒ Object Also known as: address



22
23
24
# File 'lib/geocoder/results/latlon.rb', line 22

def formatted_address(format = :full)
  address_components["address"]
end

#numberObject



27
28
29
# File 'lib/geocoder/results/latlon.rb', line 27

def number
  address_components["number"]
end

#prefixObject



31
32
33
# File 'lib/geocoder/results/latlon.rb', line 31

def prefix
  address_components["prefix"]
end

#stateObject Also known as: state_code



35
36
37
# File 'lib/geocoder/results/latlon.rb', line 35

def state
  address_components["state"]
end

#streetObject



40
41
42
# File 'lib/geocoder/results/latlon.rb', line 40

def street
  [street_name, street_type].compact.join(' ')
end

#street_nameObject



44
45
46
# File 'lib/geocoder/results/latlon.rb', line 44

def street_name
  address_components["street_name"]
end

#street_typeObject



48
49
50
# File 'lib/geocoder/results/latlon.rb', line 48

def street_type
  address_components["street_type"]
end

#suffixObject



52
53
54
# File 'lib/geocoder/results/latlon.rb', line 52

def suffix
  address_components["suffix"]
end

#unitObject



56
57
58
# File 'lib/geocoder/results/latlon.rb', line 56

def unit
  address_components["unit"]
end

#zipObject Also known as: postal_code



60
61
62
# File 'lib/geocoder/results/latlon.rb', line 60

def zip
  address_components["zip"]
end