Module: WolfCore::Integrations::ChangeDetection

Defined in:
lib/wolf_core/application/integrations/change_detection.rb

Instance Method Summary collapse

Instance Method Details

#get_changed_custom_requirement_ids(payload) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/wolf_core/application/integrations/change_detection.rb', line 4

def get_changed_custom_requirement_ids(payload)
  changed_custom_requirement_ids = []
  if payload['changes'].any?
    changed_custom_values = payload.dig('changes', 'custom_values')
    changed_custom_requirement_ids = if changed_custom_values.present?
      changed_custom_values.map do |changed_custom_value|
        changed_custom_value['custom_requirement_id'].to_s
      end
    else
      [payload.dig('attributes', 'custom_requirement_id').to_s]
    end
  end
end