Class: PublicIp::Service::IpChicken

Inherits:
ParsedHTML show all
Defined in:
lib/public_ip/service/ip_chicken.rb

Instance Attribute Summary

Attributes inherited from Simple

#headers, #uri

Class Method Summary collapse

Methods inherited from ParsedHTML

extract_ip

Methods included from Registrable

#inherited

Methods inherited from Simple

headers, ip, perform_request, symbol

Class Method Details

.parse_ip_address(response_body) ⇒ Object



10
11
12
13
# File 'lib/public_ip/service/ip_chicken.rb', line 10

def self.parse_ip_address(response_body)
  parsed_html = Nokogiri::HTML(response_body).css('table:nth-of-type(2) p:nth-of-type(2) b')
  parsed_html.text.match(/^(?:[0-9]{1,3}\.){3}[0-9]{1,3}/)[0]
end

.uriObject



6
7
8
# File 'lib/public_ip/service/ip_chicken.rb', line 6

def self.uri
  URI('http://www.ipchicken.com/')
end