lib/mistral_client/execution.rb in mistral_client-1.0.0 vs lib/mistral_client/execution.rb in mistral_client-1.1.0
- old
+ new
@@ -16,13 +16,14 @@
include MistralClient::Mixins::MistralObject
include MistralClient::Mixins::Definable
include MistralClient::Mixins::Deletable
+ # rubocop:disable Metrics/ParameterLists
def initialize(server, workflow_id: nil, env: nil, task_name: nil,
- id: nil)
- set_attributes(server, workflow_id, env, task_name, id)
+ id: nil, input: nil)
+ set_attributes(server, workflow_id, env, task_name, id, input)
if @id
reload
elsif @workflow_id
create_execution
end
@@ -40,23 +41,25 @@
ivars_from_response(resp)
end
private
- def set_attributes(server, workflow_id, env, task_name, id)
+ def set_attributes(server, workflow_id, env, task_name, id, input)
@server = server
@env = env
@task_name = task_name
@id = id
@workflow_id = workflow_id
+ @input = input
end
def create_execution
body = { workflow_id: @workflow_id }
params = {}
params[:env] = @env if @env
params[:task_name] = @task_name if @task_name
body[:params] = params unless params.empty?
+ body[:input] = input unless input.nil?
resp = @server.post(PATH, body.to_json, json: true)
ivars_from_response(resp)
end
end