Class: HDeploy::APIClient
- Inherits:
-
Object
- Object
- HDeploy::APIClient
- Includes:
- Singleton
- Defined in:
- lib/hdeploy/apiclient.rb
Instance Method Summary collapse
- #delete(uri) ⇒ Object
- #get(url) ⇒ Object
-
#initialize ⇒ APIClient
constructor
A new instance of APIClient.
- #put(uri, data) ⇒ Object
Constructor Details
Instance Method Details
#delete(uri) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/hdeploy/apiclient.rb', line 31 def delete(uri) @c.url = @config.conf['global']['endpoint'] + uri @c.http_delete raise "response code for #{url} was not 200 : #{@c.response_code} - #{@c.body_str}" unless @c.response_code == 200 return @c.body_str end |
#get(url) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/hdeploy/apiclient.rb', line 17 def get(url) @c.url = @conf.api['endpoint'] + url @c.perform raise "response code for #{url} was not 200 : #{@c.response_code}" unless @c.response_code == 200 return @c.body_str end |
#put(uri, data) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/hdeploy/apiclient.rb', line 24 def put(uri,data) @c.url = @config.api['endpoint'] + uri @c.http_put(data) raise "response code for #{url} was not 200 : #{@c.response_code} - #{@c.body_str}" unless @c.response_code == 200 return @c.body_str end |