Class: Geocoder::Result::Twogis
- Inherits:
-
Base
- Object
- Base
- Geocoder::Result::Twogis
show all
- Defined in:
- lib/geocoder/results/twogis.rb
Instance Attribute Summary
Attributes inherited from Base
#cache_hit, #data
Instance Method Summary
collapse
Methods inherited from Base
#country_code, #initialize, #latitude, #longitude, #province, #province_code, #state, #state_code
Instance Method Details
#address(_format = :full) ⇒ Object
9
10
11
|
# File 'lib/geocoder/results/twogis.rb', line 9
def address(_format = :full)
@data['full_address_name'] || ''
end
|
#building_name ⇒ Object
60
61
62
|
# File 'lib/geocoder/results/twogis.rb', line 60
def building_name
@data['building_name'] || ''
end
|
#city ⇒ Object
13
14
15
16
|
# File 'lib/geocoder/results/twogis.rb', line 13
def city
return '' unless @data['adm_div']
@data['adm_div'].select{|u| u["type"] == "city"}.first.try(:[], 'name') || ''
end
|
#coordinates ⇒ Object
5
6
7
|
# File 'lib/geocoder/results/twogis.rb', line 5
def coordinates
['lat', 'lon'].map{ |i| @data['point'][i] } if @data['point']
end
|
#country ⇒ Object
23
24
25
26
|
# File 'lib/geocoder/results/twogis.rb', line 23
def country
return '' unless @data['adm_div']
@data['adm_div'].select{|u| u["type"] == "country"}.first.try(:[], 'name') || ''
end
|
#district ⇒ Object
28
29
30
31
|
# File 'lib/geocoder/results/twogis.rb', line 28
def district
return '' unless @data['adm_div']
@data['adm_div'].select{|u| u["type"] == "district"}.first.try(:[], 'name') || ''
end
|
#district_area ⇒ Object
33
34
35
36
|
# File 'lib/geocoder/results/twogis.rb', line 33
def district_area
return '' unless @data['adm_div']
@data['adm_div'].select{|u| u["type"] == "district_area"}.first.try(:[], 'name') || ''
end
|
#name ⇒ Object
72
73
74
|
# File 'lib/geocoder/results/twogis.rb', line 72
def name
@data['name'] || ''
end
|
#purpose_name ⇒ Object
56
57
58
|
# File 'lib/geocoder/results/twogis.rb', line 56
def purpose_name
@data['purpose_name'] || ''
end
|
#region ⇒ Object
18
19
20
21
|
# File 'lib/geocoder/results/twogis.rb', line 18
def region
return '' unless @data['adm_div']
@data['adm_div'].select{|u| u["type"] == "region"}.first.try(:[], 'name') || ''
end
|
#street ⇒ Object
42
43
44
45
|
# File 'lib/geocoder/results/twogis.rb', line 42
def street
return '' unless @data['address_name']
@data['address_name'].split(', ').first
end
|
#street_address ⇒ Object
38
39
40
|
# File 'lib/geocoder/results/twogis.rb', line 38
def street_address
@data['address_name'] || ''
end
|
#street_number ⇒ Object
47
48
49
50
|
# File 'lib/geocoder/results/twogis.rb', line 47
def street_number
return '' unless @data['address_name']
@data['address_name'].split(', ')[1] || ''
end
|
#subtype ⇒ Object
64
65
66
|
# File 'lib/geocoder/results/twogis.rb', line 64
def subtype
@data['subtype'] || ''
end
|
#subtype_specification ⇒ Object
68
69
70
|
# File 'lib/geocoder/results/twogis.rb', line 68
def subtype_specification
@data['subtype_specification'] || ''
end
|
#type ⇒ Object
52
53
54
|
# File 'lib/geocoder/results/twogis.rb', line 52
def type
@data['type'] || ''
end
|