Class: Rightstuff::Client
- Inherits:
-
Object
- Object
- Rightstuff::Client
- Defined in:
- lib/rightstuff/client.rb
Instance Method Summary collapse
- #get_rest(rest) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #server_arrays ⇒ Object
- #servers ⇒ Object
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( = {} ) @username = [ :username ] or raise 'no username supplied' @password = [ :password ] or raise 'no password supplied' @account = [ :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( account_url( rest ) ) end |
#server_arrays ⇒ Object
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 |
#servers ⇒ Object
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 |