Class: MaxMind::CityIspOrgService
- Inherits:
-
Service
- Object
- Service
- MaxMind::CityIspOrgService
show all
- Defined in:
- lib/max_mind/service/city_isp_org.rb
Instance Attribute Summary
Attributes inherited from Service
#response
Instance Method Summary
collapse
Methods inherited from Service
#build_path, fetch_for_ip, #make_request
Instance Method Details
#parsed_response ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/max_mind/service/city_isp_org.rb', line 6
def parsed_response
if self.valid_response?
parsed_response = CSV.parse_line(self.response)
{
:country => parsed_response[0],
:state => parsed_response[1],
:city => parsed_response[2],
:postal_code => parsed_response[3],
:latitude => parsed_response[4],
:longitude => parsed_response[5],
:api_response => self.response
}
else
{
:api_response => self.response
}
end
end
|
#valid_response? ⇒ Boolean
25
26
27
|
# File 'lib/max_mind/service/city_isp_org.rb', line 25
def valid_response?
super && !(self.response =~ /,,,,,,,,,,(.+?)/)
end
|