Class: Geocoder::Result::Freegeoip
- Inherits:
-
Base
- Object
- Base
- Geocoder::Result::Freegeoip
show all
- Defined in:
- lib/geocoder/results/freegeoip.rb
Instance Attribute Summary
Attributes inherited from Base
#data
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#coordinates, #initialize, #latitude, #longitude
Class Method Details
.response_attributes ⇒ Object
26
27
28
29
|
# File 'lib/geocoder/results/freegeoip.rb', line 26
def self.response_attributes
%w[city region_code region_name metrocode
zipcode country_name country_code ip]
end
|
Instance Method Details
#address(format = :full) ⇒ Object
6
7
8
|
# File 'lib/geocoder/results/freegeoip.rb', line 6
def address(format = :full)
"#{city}#{', ' + region_code unless region_code == ''} #{postal_code}, #{country}"
end
|
#city ⇒ Object
10
11
12
|
# File 'lib/geocoder/results/freegeoip.rb', line 10
def city
@data['city']
end
|
#country ⇒ Object
14
15
16
|
# File 'lib/geocoder/results/freegeoip.rb', line 14
def country
@data['country_name']
end
|
#country_code ⇒ Object
18
19
20
|
# File 'lib/geocoder/results/freegeoip.rb', line 18
def country_code
@data['country_code']
end
|
#postal_code ⇒ Object
22
23
24
|
# File 'lib/geocoder/results/freegeoip.rb', line 22
def postal_code
@data['zipcode']
end
|