Class: Qubell::Instance
Overview
Implement Qubell application interface
Instance Attribute Summary collapse
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#revision ⇒ Object
readonly
Returns the value of attribute revision.
Attributes inherited from Base
Instance Method Summary collapse
-
#destroy(force = false) ⇒ #void
Destroy an application.
-
#initialize(args) ⇒ Instance
constructor
A new instance of Instance.
- #instance_of_app?(app) ⇒ Boolean
-
#launch_workflow(workflow, _args) ⇒ Hashes{String => String}
Runs the specified application instance workflow.
-
#userdata(data) ⇒ #void
Associates user data with the instance.
Methods inherited from Base
#==, #to_hash, #to_json, #to_s
Constructor Details
#initialize(args) ⇒ Instance
Returns a new instance of Instance.
13 14 15 16 17 |
# File 'lib/qubell/instance.rb', line 13 def initialize(args) super @environment = args[:environment] @revision = args[:revision] end |
Instance Attribute Details
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
10 11 12 |
# File 'lib/qubell/instance.rb', line 10 def environment @environment end |
#revision ⇒ Object (readonly)
Returns the value of attribute revision.
11 12 13 |
# File 'lib/qubell/instance.rb', line 11 def revision @revision end |
Instance Method Details
#destroy(force = false) ⇒ #void
Destroy an application
39 40 41 42 43 44 45 46 |
# File 'lib/qubell/instance.rb', line 39 def destroy(force = false) status = force ? '1' : '0' begin Qubell::APICall.delete("/instances/#{@id}?#{status}") rescue Qubell::ExecutionError raise Qubell::DestroyError end end |
#instance_of_app?(app) ⇒ Boolean
48 49 50 |
# File 'lib/qubell/instance.rb', line 48 def instance_of_app?(app) global_info[:applicationId] == app.id end |
#launch_workflow(workflow, _args) ⇒ Hashes{String => String}
Runs the specified application instance workflow.
23 24 25 |
# File 'lib/qubell/instance.rb', line 23 def launch_workflow(workflow, _args) Qubell::APICall.get("/instances/#{@id}/#{workflow}") end |
#userdata(data) ⇒ #void
Associates user data with the instance.
30 31 32 33 34 |
# File 'lib/qubell/instance.rb', line 30 def userdata(data) Qubell::APICall.put("/instances/#{@id}/userData", data) rescue Qubell::ExecutionError raise Qubell::FormatError end |