Class: JamBase4R::HttpGateway

Inherits:
Object
  • Object
show all
Includes:
Utility
Defined in:
lib/http_gateway.rb

Instance Method Summary collapse

Methods included from Utility

#log_error, #log_info

Instance Method Details

#get(url) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/http_gateway.rb', line 19

def get(url)
  log_info("#{self.class.name} - Performing GET with URL: #{url}.")
  url = URI.parse(url)
  request = Net::HTTP::Get.new(url.path_with_querystring)
  response = Net::HTTP.start(url.host, url.port) { |http| http.request(request) }
  handle_response(response)
rescue Timeout::Error => e
  log_error("Connection to JamBase timed out: #{e.message}")
  raise JamBaseError.new(e.message)
end