Class: Egi::Fedcloud::Cloudhound::Connector

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/egi/fedcloud/cloudhound/connector.rb

Direct Known Subclasses

Appdb, Gocdb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}, password = nil) ⇒ Connector

Returns a new instance of Connector.



9
10
11
12
13
14
15
# File 'lib/egi/fedcloud/cloudhound/connector.rb', line 9

def initialize(opts = {}, password = nil)
  Egi::Fedcloud::Cloudhound::Log.debug "[#{self.class}] Initializing with #{opts.inspect}"

  self.class.pem File.read(opts[:credentials]), password
  self.class.ssl_ca_path opts[:ca_path]
  self.class.debug_output $stderr if opts[:debug]
end

Instance Method Details

#retrieve(url = '/') ⇒ Object



18
19
20
21
22
23
24
# File 'lib/egi/fedcloud/cloudhound/connector.rb', line 18

def retrieve(url = '/')
  Egi::Fedcloud::Cloudhound::Log.debug "[#{self.class}] Retrieving #{url.inspect}"
  response = self.class.get url
  raise "Failed to get a response from '#{url}' [#{response.code}]" unless response.code.between?(200,299)

  response.body
end