Class: Camunda::ProcessDefinition
- Includes:
- VariableSerialization
- Defined in:
- lib/camunda/process_definition.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from VariableSerialization
Methods inherited from Model
Class Method Details
.start_by_key(key, hash = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/camunda/process_definition.rb', line 5 def self.start_by_key(key, hash={}) hash[:variables] = serialize_variables(hash[:variables]) if hash[:variables] tenant_id = hash.delete(:tenant_id) tenant_id ||= Camunda::Workflow.configuration.tenant_id response = post_raw start_path_for_key(key, tenant_id), hash raise Camunda::ProcessEngineException, response[:parsed_data][:data][:message] unless response[:response].status == 200 Camunda::ProcessInstance.new response[:parsed_data][:data] end |
.start_path_for_key(key, tenant_id) ⇒ Object
24 25 26 27 28 |
# File 'lib/camunda/process_definition.rb', line 24 def self.start_path_for_key(key, tenant_id) path = "process-definition/key/#{key}" path << "/tenant-id/#{tenant_id}" if tenant_id "#{path}/start" end |
Instance Method Details
#start(hash = {}) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/camunda/process_definition.rb', line 16 def start(hash={}) hash[:variables] = serialize_variables(hash[:variables]) if hash[:variables] response = self.class.post_raw "process-definition/#{id}/start", hash raise Camunda::ProcessEngineException, response[:parsed_data][:data][:message] unless response[:response].status == 200 Camunda::ProcessInstance.new response[:parsed_data][:data] end |