Class: Shared::StateResource

Inherits:
Resource show all
Defined in:
lib/vas/shared/state_resource.rb

Instance Attribute Summary

Attributes inherited from Resource

#location, #security

Instance Method Summary collapse

Constructor Details

#initialize(location, client) ⇒ StateResource

:nodoc:



22
23
24
25
# File 'lib/vas/shared/state_resource.rb', line 22

def initialize(location, client)  #:nodoc:
  super(location, client)
  @state_location = Util::LinkUtils.get_link_href(details, 'state')
end

Instance Method Details

#startObject

Starts the resource



28
29
30
# File 'lib/vas/shared/state_resource.rb', line 28

def start
  client.post(@state_location, { :status => 'STARTED' })
end

#stateObject

The state of the resource



38
39
40
# File 'lib/vas/shared/state_resource.rb', line 38

def state
  client.get(@state_location)['status']
end

#stopObject

Stops the resource



33
34
35
# File 'lib/vas/shared/state_resource.rb', line 33

def stop
  client.post(@state_location, { :status => 'STOPPED' })
end