Class: Geocoder::Result::Ovi

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

Instance Attribute Summary

Attributes inherited from Base

#cache_hit, #data

Instance Method Summary collapse

Methods inherited from Base

#initialize, #latitude, #longitude

Constructor Details

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

Instance Method Details

#address(format = :full) ⇒ Object

A string in the given format.



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

def address(format = :full)
  address_data['Label']
end

#cityObject



33
34
35
# File 'lib/geocoder/results/ovi.rb', line 33

def city
  address_data['City']
end

#coordinatesObject

A two-element array: [lat, lon].



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

def coordinates
  fail unless d = @data['Location']['DisplayPosition']
  [d['Latitude'].to_f, d['Longitude'].to_f]
end

#countryObject



45
46
47
48
49
50
# File 'lib/geocoder/results/ovi.rb', line 45

def country
  fail unless d = address_data['AdditionalData']
  if v = d.find{|ad| ad['key']=='CountryName'}
    return v['value']
  end
end

#country_codeObject



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

def country_code
  address_data['Country']
end

#postal_codeObject



29
30
31
# File 'lib/geocoder/results/ovi.rb', line 29

def postal_code
  address_data['PostalCode']
end

#provinceObject



25
26
27
# File 'lib/geocoder/results/ovi.rb', line 25

def province
  address_data['County']
end

#province_codeObject



41
42
43
# File 'lib/geocoder/results/ovi.rb', line 41

def province_code
  address_data['State']
end

#stateObject



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

def state
  address_data['County']
end

#state_codeObject



37
38
39
# File 'lib/geocoder/results/ovi.rb', line 37

def state_code
  address_data['State']
end