Class: ZipFinder::RestClientAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/zipfinder/rest_client_adapter.rb

Class Method Summary collapse

Class Method Details

.http_get(url, headers = {}) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/zipfinder/rest_client_adapter.rb', line 3

def self.http_get url, headers = {}
  response = RestClient.get(url, headers)
  OpenStruct.new(:status => response.code, :body => response.body)

rescue RestClient::Exception, Errno::EINVAL, Errno::ECONNRESET, Errno::ECONNREFUSED, EOFError => e
  raise ServiceNotAvailableError, e.message
end