Class: Geocoder::Result::IpapiCom
- Inherits:
-
Base
- Object
- Base
- Geocoder::Result::IpapiCom
show all
- Defined in:
- lib/geocoder/results/ipapi_com.rb
Instance Attribute Summary
Attributes inherited from Base
#cache_hit, #data
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#country, #initialize, #latitude, #longitude, #province, #province_code
Class Method Details
.response_attributes ⇒ Object
34
35
36
|
# File 'lib/geocoder/results/ipapi_com.rb', line 34
def self.response_attributes
%w[country region city zip timezone isp org as reverse query status message mobile proxy lat lon]
end
|
Instance Method Details
#address ⇒ Object
10
11
12
|
# File 'lib/geocoder/results/ipapi_com.rb', line 10
def address
"#{city}, #{state_code} #{postal_code}, #{country}".sub(/^[ ,]*/, "")
end
|
#coordinates ⇒ Object
6
7
8
|
# File 'lib/geocoder/results/ipapi_com.rb', line 6
def coordinates
[lat, lon]
end
|
#country_code ⇒ Object
26
27
28
|
# File 'lib/geocoder/results/ipapi_com.rb', line 26
def country_code
@data['countryCode']
end
|
#postal_code ⇒ Object
22
23
24
|
# File 'lib/geocoder/results/ipapi_com.rb', line 22
def postal_code
zip
end
|
#region_name ⇒ Object
30
31
32
|
# File 'lib/geocoder/results/ipapi_com.rb', line 30
def region_name
@data['regionName']
end
|
#state ⇒ Object
14
15
16
|
# File 'lib/geocoder/results/ipapi_com.rb', line 14
def state
region_name
end
|
#state_code ⇒ Object
18
19
20
|
# File 'lib/geocoder/results/ipapi_com.rb', line 18
def state_code
region
end
|