meta_workflows 0.8.11 → 0.8.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 88e0b63f0ddb77f268afe958db75e5b12b557e0426fe51fbc4c3387d1f457cda
4
- data.tar.gz: 96dbf3330181b487494cc35b3cb7fa30fc9f41b95c4340acec101e7f02aa3913
3
+ metadata.gz: 4c3e3a281ec142b84464171c5827bcf2b9d0610fcfda6268588727b0c291233b
4
+ data.tar.gz: 641415e402adbc3fe28ebc786ab718cf3fd73245405d30e2c56935500fea37e8
5
5
  SHA512:
6
- metadata.gz: e3d8b0365283b1221d9a149a6d250f53a04dc4db46e9e72ca5400861c8ee81eeb6beb909a7abcef5ac301c900e0042d51ad60c9052c461456b732227e794f114
7
- data.tar.gz: e13c2fb2fe7d36b98c6d05f9acbbef7598ef03bbc1971ff7194bf2589b61b81890e69dd184629326ce376e829eb22e46d94708c1b9c81500824adf5cdfa208ca
6
+ metadata.gz: 7d0502a24725b61701f2e332bdd248dbb32735e239ebeb8667cbe3f751683c9f25e037dbafd269c7ea6ee298049ac39a9dcb29a61ecba4f138f3b93737c0d520
7
+ data.tar.gz: 324ffa7ee80f572a06166e44e210906027d745e5ddd825a8c5342794fd6c7230adbd41f2b0d602c398bde7878fd68bf0e91eefb822f3f483fe8fbd021aa30cbb
@@ -3,7 +3,7 @@
3
3
  module MetaWorkflows
4
4
  MAJOR = 0
5
5
  MINOR = 8
6
- PATCH = 11 # this is automatically incremented by the build process
6
+ PATCH = 12 # this is automatically incremented by the build process
7
7
 
8
8
  VERSION = "#{MetaWorkflows::MAJOR}.#{MetaWorkflows::MINOR}.#{MetaWorkflows::PATCH}".freeze
9
9
  end
@@ -181,17 +181,15 @@ module Services
181
181
 
182
182
  raise ArgumentError, "Invalid record updater class: #{service_class_name}" unless service_class
183
183
 
184
- target_record = find_parent_record(workflow_execution)
184
+ target_record = find_workflow_record(workflow_execution)
185
185
  attributes_to_update = execution_step['attributes_to_update']
186
186
 
187
- service_class.new(target_record, attributes_to_update, workflow_execution.workflow_params)
187
+ service_class.new(target_record, attributes_to_update, workflow_execution.workflow_params, inputs)
188
188
  end
189
189
 
190
- # TODO: We should refactor this along with the build_record_update_service method
191
- # to only use workflow_params and use better naming (instead of record_id and record_class)
192
- def find_parent_record(workflow_execution)
190
+ def find_workflow_record(workflow_execution)
193
191
  record_class = workflow_execution.record.class.name.constantize
194
- record_class.find(workflow_execution.workflow_params['record_id'])
192
+ record_class.find(workflow_execution.record_id)
195
193
  end
196
194
 
197
195
  def continue_workflow(workflow_execution, workflow)
@@ -4,13 +4,14 @@ module Services
4
4
  module MetaWorkflows
5
5
  module Updaters
6
6
  class MetaService < Services::MetaWorkflows::ApplicationService
7
- attr_reader :record, :attributes_to_update, :workflow_params
7
+ attr_reader :record, :attributes_to_update, :workflow_params, :inputs
8
8
 
9
- def initialize(record, attributes_to_update, workflow_params)
9
+ def initialize(record, attributes_to_update, workflow_params, inputs = {})
10
10
  super()
11
11
  @record = record
12
12
  @attributes_to_update = attributes_to_update
13
13
  @workflow_params = workflow_params
14
+ @inputs = inputs
14
15
  end
15
16
 
16
17
  def call
@@ -25,7 +26,9 @@ module Services
25
26
  attributes_hash = {}
26
27
 
27
28
  attributes_to_update.each do |attribute_name|
28
- param_value = workflow_params[attribute_name] || workflow_params[attribute_name.to_sym]
29
+ # Check inputs first, then workflow_params
30
+ param_value = inputs[attribute_name] || inputs[attribute_name.to_sym] ||
31
+ workflow_params[attribute_name] || workflow_params[attribute_name.to_sym]
29
32
  next if param_value.blank?
30
33
 
31
34
  attributes_hash[attribute_name.to_sym] = param_value
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meta_workflows
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.11
4
+ version: 0.8.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leonid Medovyy