Class: BombDefuser::CurbAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/bomb_defuser/curb_adapter.rb

Class Method Summary collapse

Class Method Details

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



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/bomb_defuser/curb_adapter.rb', line 6

def self.http_get(url, headers = {})
  begin
    response = Curl::Easy.http_get(url) {|config| config.headers = headers }

    if response
      OpenStruct.new(:body => response.body_str, :code => response.response_code, :headers => response.headers)
    end
  rescue StandardError => e
    raise Errors::WebServiceNotAvailableError, e.message
  end
end