Class: RightScale::Client
- Inherits:
-
Object
- Object
- RightScale::Client
- Includes:
- HTTParty
- Defined in:
- lib/rightscale-api/client.rb
Instance Method Summary collapse
- #deployments ⇒ Object
- #get(path, options = {}) ⇒ Object
-
#initialize(account, email, password) ⇒ Client
constructor
A new instance of Client.
- #post(path, options = {}) ⇒ Object
- #request(method, path, options = {}) ⇒ Object
- #right_scripts ⇒ Object
- #servers ⇒ Object
- #statuses ⇒ Object
Constructor Details
#initialize(account, email, password) ⇒ Client
Returns a new instance of Client.
5 6 7 8 |
# File 'lib/rightscale-api/client.rb', line 5 def initialize(account, email, password) @account, @email, @password = account, email, password self.class.base_uri "https://my.rightscale.com/api/acct/#{@account}" end |
Instance Method Details
#deployments ⇒ Object
29 30 31 |
# File 'lib/rightscale-api/client.rb', line 29 def deployments @deployments ||= Deployments.new(self) end |
#get(path, options = {}) ⇒ Object
10 11 12 |
# File 'lib/rightscale-api/client.rb', line 10 def get(path, ={}) request :get, path, end |
#post(path, options = {}) ⇒ Object
14 15 16 |
# File 'lib/rightscale-api/client.rb', line 14 def post(path, ={}) request :post, path, end |
#request(method, path, options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rightscale-api/client.rb', line 18 def request(method, path, ={}) .merge!({ :basic_auth => {:username => @email, :password => @password}, :headers => {'X-API-VERSION' => '1.0'} }) response = self.class.send(method, "#{path}", ) # puts response.inspect return response end |
#right_scripts ⇒ Object
41 42 43 |
# File 'lib/rightscale-api/client.rb', line 41 def right_scripts @right_scripts ||= RightScripts.new(self, :resource => 'right_scripts') end |