Class: Geocoder::Result::Ipbase
- Inherits:
-
Base
- Object
- Base
- Geocoder::Result::Ipbase
show all
- Defined in:
- lib/geocoder/results/ipbase.rb
Instance Attribute Summary
Attributes inherited from Base
#cache_hit, #data
Instance Method Summary
collapse
Methods inherited from Base
#address, #initialize, #latitude, #longitude, #province, #province_code
Instance Method Details
#city ⇒ Object
25
26
27
|
# File 'lib/geocoder/results/ipbase.rb', line 25
def city
@data["data"]["location"]["city"]["name"]
end
|
#coordinates ⇒ Object
33
34
35
36
37
38
|
# File 'lib/geocoder/results/ipbase.rb', line 33
def coordinates
[
@data["data"]["location"]["latitude"].to_f,
@data["data"]["location"]["longitude"].to_f
]
end
|
#country ⇒ Object
13
14
15
|
# File 'lib/geocoder/results/ipbase.rb', line 13
def country
@data["data"]["location"]["country"]["name"]
end
|
#country_code ⇒ Object
9
10
11
|
# File 'lib/geocoder/results/ipbase.rb', line 9
def country_code
@data["data"]["location"]["country"]["alpha2"]
end
|
#ip ⇒ Object
5
6
7
|
# File 'lib/geocoder/results/ipbase.rb', line 5
def ip
@data["data"]['ip']
end
|
#postal_code ⇒ Object
29
30
31
|
# File 'lib/geocoder/results/ipbase.rb', line 29
def postal_code
@data["data"]["location"]["zip"]
end
|
#state ⇒ Object
21
22
23
|
# File 'lib/geocoder/results/ipbase.rb', line 21
def state
@data["data"]["location"]["region"]["name"]
end
|
#state_code ⇒ Object
17
18
19
|
# File 'lib/geocoder/results/ipbase.rb', line 17
def state_code
@data["data"]["location"]["region"]["alpha2"]
end
|