class Qubell::Instance

Implement Qubell application interface

Attributes

environment[R]
revision[R]

Public Class Methods

new(args) click to toggle source
Calls superclass method Qubell::Base::new
# File lib/qubell/instance.rb, line 13
def initialize(args)
  super
  @environment = args[:environment]
  @revision = args[:revision]
end

Public Instance Methods

destroy(force = false) click to toggle source

Destroy an application @param [String] force specifies whether the instance should be deleted @return [#void]

# 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) click to toggle source
# File lib/qubell/instance.rb, line 48
def instance_of_app?(app)
  global_info[:applicationId] == app.id
end
launch_workflow(workflow, _args) click to toggle source

Runs the specified application instance workflow. @param [String] workflow instance workflow name @param [Hash{String => String}] workflow instance workflow name @return [Hashes{String => String}] instance id

# File lib/qubell/instance.rb, line 23
def launch_workflow(workflow, _args)
  Qubell::APICall.get("/instances/#{@id}/#{workflow}")
end
userdata(data) click to toggle source

Associates user data with the instance. @param [String] data JSON-encoded user data @return [#void]

# File lib/qubell/instance.rb, line 30
def userdata(data)
  Qubell::APICall.put("/instances/#{@id}/userData", data)
rescue Qubell::ExecutionError
  raise Qubell::FormatError
end

Private Instance Methods

global_info() click to toggle source
# File lib/qubell/instance.rb, line 60
def global_info
  Qubell::APICall.get("/instances/#{@id}")
end