Class: Deltacloud::Drivers::Digitalocean::DigitaloceanDriver::Client
- Inherits:
-
Object
- Object
- Deltacloud::Drivers::Digitalocean::DigitaloceanDriver::Client
- Defined in:
- lib/deltacloud/drivers/digitalocean/digitalocean_driver.rb
Constant Summary collapse
- API_URL =
"https://api.digitalocean.com/"
Instance Attribute Summary collapse
-
#credentials ⇒ Object
readonly
Returns the value of attribute credentials.
Instance Method Summary collapse
- #get(uri, opts = {}) ⇒ Object
-
#initialize(credentials) ⇒ Client
constructor
A new instance of Client.
Constructor Details
Instance Attribute Details
#credentials ⇒ Object (readonly)
Returns the value of attribute credentials.
191 192 193 |
# File 'lib/deltacloud/drivers/digitalocean/digitalocean_driver.rb', line 191 def credentials @credentials end |
Instance Method Details
#get(uri, opts = {}) ⇒ Object
198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/deltacloud/drivers/digitalocean/digitalocean_driver.rb', line 198 def get(uri, opts={}) opts.merge!( :client_id => credentials.user, :api_key => credentials.password ) result = @resource[uri].get(:params => opts) json_result = JSON::parse(result) if json_result['status'] != 'OK' p result = json_result['error_message'] || json_result['status'] raise end json_result end |