Class: Camunda::Task
- Includes:
- VariableSerialization
- Defined in:
- lib/camunda/task.rb
Overview
Finds tasks by business key and task definition and allows you to report a task complete and update process variables. If a business key isn’t supplied when creating a process definition, you can still retrieve UserTasks by using the ‘.find_by` helper.
Defined Under Namespace
Classes: SubmissionError
Class Method Summary collapse
Instance Method Summary collapse
- #bpmn_error!(error_code, error_message, vars = {}) ⇒ Object
- #bpmn_escalation!(escalation_code, vars = {}) ⇒ Object
-
#complete!(vars = {}) ⇒ Object
Complete a task and updates process variables.
Methods included from VariableSerialization
Methods inherited from Model
base_path, find_by!, worker_id
Class Method Details
.find_by_business_key_and_task_definition_key!(instance_business_key, task_key) ⇒ Camunda::Task
22 23 24 |
# File 'lib/camunda/task.rb', line 22 def self.find_by_business_key_and_task_definition_key!(instance_business_key, task_key) find_by!(processInstanceBusinessKey: instance_business_key, taskDefinitionKey: task_key) end |
Instance Method Details
#bpmn_error!(error_code, error_message, vars = {}) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/camunda/task.rb', line 38 def bpmn_error!(error_code, , vars={}) self.class.request(:post, "task/#{id}/bpmnError", errorCode: error_code, errorMessage: , variables: serialize_variables(vars)) .tap do |response| raise SubmissionError, response.errors["message"] unless response.errors.blank? end end |
#bpmn_escalation!(escalation_code, vars = {}) ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/camunda/task.rb', line 46 def bpmn_escalation!(escalation_code, vars={}) self.class.request(:post, "task/#{id}/bpmnEscalation", escalationCode: escalation_code, variables: serialize_variables(vars)) .tap do |response| raise SubmissionError, response.errors["message"] unless response.errors.blank? end end |
#complete!(vars = {}) ⇒ Object
Complete a task and updates process variables.
31 32 33 34 35 36 |
# File 'lib/camunda/task.rb', line 31 def complete!(vars={}) self.class.request(:post, "task/#{id}/complete", variables: serialize_variables(vars)) .tap do |response| raise SubmissionError, response.errors["message"] unless response.errors.blank? end end |