Class: SpreeCmCommissioner::ProductCompletionStep
- Inherits:
-
Base
- Object
- Spree::Base
- Base
- SpreeCmCommissioner::ProductCompletionStep
show all
- Defined in:
- app/models/spree_cm_commissioner/product_completion_step.rb
Instance Method Summary
collapse
Instance Method Details
#action_url_for(_line_item) ⇒ Object
12
13
14
|
# File 'app/models/spree_cm_commissioner/product_completion_step.rb', line 12
def action_url_for(_line_item)
nil
end
|
#completed?(_line_item) ⇒ Boolean
16
17
18
|
# File 'app/models/spree_cm_commissioner/product_completion_step.rb', line 16
def completed?(_line_item)
raise 'completed? should be implemented in a sub-class of ProductCompletionStep'
end
|
#construct_hash(line_item:) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'app/models/spree_cm_commissioner/product_completion_step.rb', line 20
def construct_hash(line_item:)
existing_data = line_item.completion_steps&.find { |step| step['position'].to_i == position }
{
title: title,
type: type&.underscore,
position: position,
description: description,
action_label: action_label,
action_url: action_url_for(line_item),
completed_at: existing_data&.dig('completed_at'),
completed: completed?(line_item)
}
end
|