Sha256: 0cc5ac2b7902807caecd1193fc0c2a392c7d7f56e03201133197876f9f1fe586

Contents?: true

Size: 833 Bytes

Versions: 2

Compression:

Stored size: 833 Bytes

Contents

module MistralClient
  class ActionExecution < Base
    UNICODE_FIELDS = %w[
      description
      name
      state
      state_info
      task_execution_id
      task_name
      workflow_name
    ].freeze

    JSON_FIELDS = %w[input output params].freeze
    BOOL_FIELDS = %w[accepted].freeze

    PATH = 'action_executions'.freeze

    include MistralClient::Mixins::MistralObject

    def initialize(server, id: nil)
      super()
      @server = server
      @path = 'action_executions'
      @id = id
      reload if @id
    end

    def patch(state: nil, output: nil)
      body = {}
      body[:state] = state unless state.nil?
      body[:output] = output unless output.nil?
      return if body.empty?

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mistral_client-3.0.0 lib/mistral_client/action_execution.rb
mistral_client-2.0.0 lib/mistral_client/action_execution.rb