Class: Geocoder::Result::Yandex
- Inherits:
-
Base
- Object
- Base
- Geocoder::Result::Yandex
show all
- Defined in:
- lib/geocoder/results/yandex.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
Instance Method Details
#address(format = :full) ⇒ Object
10
11
12
|
# File 'lib/geocoder/results/yandex.rb', line 10
def address(format = :full)
@data['GeoObject']['metaDataProperty']['GeocoderMetaData']['text']
end
|
#city ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/geocoder/results/yandex.rb', line 14
def city
if state.empty? and address_details.has_key? 'Locality'
address_details['Locality']['LocalityName']
elsif sub_state.empty? and address_details['AdministrativeArea'].has_key? 'Locality'
address_details['AdministrativeArea']['Locality']['LocalityName']
elsif not sub_state_city.empty?
sub_state_city
else
""
end
end
|
#coordinates ⇒ Object
6
7
8
|
# File 'lib/geocoder/results/yandex.rb', line 6
def coordinates
@data['GeoObject']['Point']['pos'].split(' ').reverse.map(&:to_f)
end
|
#country ⇒ Object
26
27
28
|
# File 'lib/geocoder/results/yandex.rb', line 26
def country
address_details['CountryName']
end
|
#country_code ⇒ Object
30
31
32
|
# File 'lib/geocoder/results/yandex.rb', line 30
def country_code
address_details['CountryNameCode']
end
|
#kind ⇒ Object
62
63
64
|
# File 'lib/geocoder/results/yandex.rb', line 62
def kind
@data['GeoObject']['metaDataProperty']['GeocoderMetaData']['kind']
end
|
#postal_code ⇒ Object
54
55
56
|
# File 'lib/geocoder/results/yandex.rb', line 54
def postal_code
""
end
|
#precision ⇒ Object
66
67
68
|
# File 'lib/geocoder/results/yandex.rb', line 66
def precision
@data['GeoObject']['metaDataProperty']['GeocoderMetaData']['precision']
end
|
#premise_name ⇒ Object
58
59
60
|
# File 'lib/geocoder/results/yandex.rb', line 58
def premise_name
address_details['Locality']['Premise']['PremiseName']
end
|
#state ⇒ Object
34
35
36
37
38
39
40
|
# File 'lib/geocoder/results/yandex.rb', line 34
def state
if address_details['AdministrativeArea']
address_details['AdministrativeArea']['AdministrativeAreaName']
else
""
end
end
|
#state_code ⇒ Object
50
51
52
|
# File 'lib/geocoder/results/yandex.rb', line 50
def state_code
""
end
|
#sub_state ⇒ Object
42
43
44
45
46
47
48
|
# File 'lib/geocoder/results/yandex.rb', line 42
def sub_state
if !state.empty? and address_details['AdministrativeArea']['SubAdministrativeArea']
address_details['AdministrativeArea']['SubAdministrativeArea']['SubAdministrativeAreaName']
else
""
end
end
|