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 provided by Her.
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
find_by!, log_details?, 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 45 |
# File 'lib/camunda/task.rb', line 38 def bpmn_error!(error_code, , vars={}) self.class .post_raw("#{self.class.collection_path}/#{id}/bpmnError", errorCode: error_code, errorMessage: , variables: serialize_variables(vars))[:response] .tap do |response| raise SubmissionError, response.body[:data][:message] unless response.success? end end |
#bpmn_escalation!(escalation_code, vars = {}) ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'lib/camunda/task.rb', line 47 def bpmn_escalation!(escalation_code, vars={}) self.class .post_raw("#{self.class.collection_path}/#{id}/bpmnEscalation", escalationCode: escalation_code, variables: serialize_variables(vars))[:response] .tap do |response| raise SubmissionError, response.body[:data][:message] unless response.success? 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.post_raw("#{self.class.collection_path}/#{id}/complete", variables: serialize_variables(vars))[:response] .tap do |response| raise SubmissionError, response.body[:data][:message] unless response.success? end end |