Class: Whaler::API
- Inherits:
-
Object
- Object
- Whaler::API
- Includes:
- HTTParty
- Defined in:
- lib/whaler/api.rb,
lib/whaler/api/errors.rb,
lib/whaler/api/actions/run.rb,
lib/whaler/api/actions/login.rb
Defined Under Namespace
Modules: Errors
Constant Summary collapse
- DEFAULT_BASE_URI =
"http://api.scalewhale.io"
Class Method Summary collapse
Class Method Details
.login(username, password) ⇒ Object
2 3 4 5 6 7 |
# File 'lib/whaler/api/actions/login.rb', line 2 def self.login(username, password) post("/login", body: { username: username, password: password }) end |
.run(app, command) ⇒ Object
2 3 4 5 6 7 8 9 |
# File 'lib/whaler/api/actions/run.rb', line 2 def self.run(app, command) post("/run", body: { app: app, command: command }) rescue Errors::NotFound => e raise e.exception("No such app: #{app}") end |
.setup(api_key) ⇒ Object
17 18 19 20 |
# File 'lib/whaler/api.rb', line 17 def setup(api_key) basic_auth '', api_key self end |