class MistralClient::Task

Constants

BOOL_FIELDS
JSON_FIELDS
PATH
UNICODE_FIELDS

Public Class Methods

new(server, id: nil) click to toggle source
Calls superclass method
# File lib/mistral_client/task.rb, line 22
def initialize(server, id: nil)
  super()
  @server = server
  @path = 'tasks'
  @id = id
  reload if id
end

Public Instance Methods

patch(state: nil, reset: nil, env: nil) click to toggle source
# File lib/mistral_client/task.rb, line 30
def patch(state: nil, reset: nil, env: nil)
  body = {}
  body[:state] = state if state
  body[:reset] = reset if reset
  body[:env] = env if env

  return if body.empty?

  resp = @server.put("#{PATH}/#{@id}", body.to_json, json: true)
  ivars_from_response(resp)
end