Class: Geocoder::Result::Geocodio

Inherits:
Base
  • Object
show all
Defined in:
lib/geocoder/results/geocodio.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

#accuracyObject



55
56
57
# File 'lib/geocoder/results/geocodio.rb', line 55

def accuracy
  @data['accuracy'].to_f if @data.key?('accuracy')
end

#cityObject



39
40
41
# File 'lib/geocoder/results/geocodio.rb', line 39

def city
  address_components["city"]
end

#coordinatesObject



51
52
53
# File 'lib/geocoder/results/geocodio.rb', line 51

def coordinates
  ['lat', 'lng'].map{ |i| location[i].to_f } if location
end

#countryObject



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

def country
  "United States" # Geocodio only supports the US
end

#country_codeObject



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

def country_code
  "US" # Geocodio only supports the US
end

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



59
60
61
# File 'lib/geocoder/results/geocodio.rb', line 59

def formatted_address(format = :full)
  @data['formatted_address']
end

#locationObject



47
48
49
# File 'lib/geocoder/results/geocodio.rb', line 47

def location
  @data['location']
end

#numberObject



5
6
7
# File 'lib/geocoder/results/geocodio.rb', line 5

def number
  address_components["number"]
end

#postdirectionalObject



43
44
45
# File 'lib/geocoder/results/geocodio.rb', line 43

def postdirectional
  address_components["postdirectional"]
end

#stateObject Also known as: state_code



21
22
23
# File 'lib/geocoder/results/geocodio.rb', line 21

def state
  address_components["state"]
end

#streetObject



9
10
11
# File 'lib/geocoder/results/geocodio.rb', line 9

def street
  address_components["street"]
end

#street_addressObject



17
18
19
# File 'lib/geocoder/results/geocodio.rb', line 17

def street_address
  [number, address_components["formatted_street"]].compact.join(' ')
end

#suffixObject



13
14
15
# File 'lib/geocoder/results/geocodio.rb', line 13

def suffix
  address_components["suffix"]
end

#zipObject Also known as: postal_code



26
27
28
# File 'lib/geocoder/results/geocodio.rb', line 26

def zip
  address_components["zip"]
end