Class: Nanny::HTTPClient

Inherits:
Object
  • Object
show all
Defined in:
lib/nanny/http_client.rb

Defined Under Namespace

Classes: Exception

Class Method Summary collapse

Class Method Details

.get(url) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/nanny/http_client.rb', line 16

def self.get(url)
  RestClient.get(url).body.force_encoding("utf-8")
rescue URI::InvalidURIError
rescue SocketError
rescue RestClient::Exception
  raise Exception
end

.headers(url) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/nanny/http_client.rb', line 8

def self.headers(url)
  RestClient.head(url).headers
rescue URI::InvalidURIError
rescue SocketError
rescue RestClient::Exception
  raise Exception
end