Class: Arukas::API
- Inherits:
-
Object
- Object
- Arukas::API
- Defined in:
- lib/arukas/api.rb
Instance Method Summary collapse
- #create_apps(params) ⇒ Object
- #delete_app(id) ⇒ Object
- #get_app(id) ⇒ Object
- #get_apps ⇒ Object
- #get_service(id) ⇒ Object
- #get_services ⇒ Object
-
#initialize(token, secret) ⇒ API
constructor
A new instance of API.
- #patch_service(id, params) ⇒ Object
- #power_off_service(id) ⇒ Object
- #power_on_service(id) ⇒ Object
Constructor Details
#initialize(token, secret) ⇒ API
Returns a new instance of API.
6 7 8 |
# File 'lib/arukas/api.rb', line 6 def initialize(token, secret) @url = "https://#{token}:#{secret}@app.arukas.io/api/" end |
Instance Method Details
#create_apps(params) ⇒ Object
14 15 16 |
# File 'lib/arukas/api.rb', line 14 def create_apps(params) RestClient.post @url + "apps/", payload=params, {:content_type => :json} end |
#delete_app(id) ⇒ Object
22 23 24 |
# File 'lib/arukas/api.rb', line 22 def delete_app(id) RestClient.delete @url + "apps/#{id}" end |
#get_app(id) ⇒ Object
18 19 20 |
# File 'lib/arukas/api.rb', line 18 def get_app(id) RestClient.get @url + "apps/#{id}" end |
#get_apps ⇒ Object
10 11 12 |
# File 'lib/arukas/api.rb', line 10 def get_apps RestClient.get @url + "apps/" end |
#get_service(id) ⇒ Object
30 31 32 |
# File 'lib/arukas/api.rb', line 30 def get_service(id) RestClient.get @url + "services/#{id}" end |
#get_services ⇒ Object
26 27 28 |
# File 'lib/arukas/api.rb', line 26 def get_services RestClient.get @url + "services/" end |
#patch_service(id, params) ⇒ Object
34 35 36 |
# File 'lib/arukas/api.rb', line 34 def patch_service(id, params) RestClient.patch @url + "services/#{id}", payload=params.to_json, {:content_type => :json, :accept => :json} end |
#power_off_service(id) ⇒ Object
42 43 44 |
# File 'lib/arukas/api.rb', line 42 def power_off_service(id) RestClient.delete @url + "services/#{id}/power" end |
#power_on_service(id) ⇒ Object
38 39 40 |
# File 'lib/arukas/api.rb', line 38 def power_on_service(id) RestClient.post @url + "services/#{id}/power", payload="", {:content_type => :json} end |