Class: Rightstuff::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/rightstuff/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rightstuff/client.rb', line 10

def initialize( options = {} )
  @username = options[ :username ] or raise 'no username supplied'
  @password = options[ :password ] or raise 'no password supplied'
  @account  = options[ :account ]  or raise 'no account id supplied'
  @account  = @account.to_s

  @base_url               = 'https://my.rightscale.com/api/acct'
  url                     = URI.parse( @base_url )
  @connection             = Net::HTTP.new( url.host, url.port )
  @connection.use_ssl     = true
  @connection.verify_mode = OpenSSL::SSL::VERIFY_NONE
end

Instance Method Details

#get_rest(rest) ⇒ Object



23
24
25
# File 'lib/rightstuff/client.rb', line 23

def get_rest( rest )
  get( ( rest ) )
end

#server_arraysObject



33
34
35
36
37
# File 'lib/rightstuff/client.rb', line 33

def server_arrays
  return @server_arrays if @server_arrays
  body     = Nokogiri::XML( get_rest( 'server_arrays' ) )
  @server_arrays = Rightstuff::ServerArray.load_collection( self, body )
end

#serversObject



27
28
29
30
31
# File 'lib/rightstuff/client.rb', line 27

def servers
  return @servers if @servers
  body     = Nokogiri::XML( get_rest( 'servers' ) )
  @servers = Rightstuff::Server.load_collection( self, body )
end