Class: Appydave::Tools::Configuration::Models::YoutubeAutomationConfig
- Inherits:
-
ConfigBase
- Object
- ConfigBase
- Appydave::Tools::Configuration::Models::YoutubeAutomationConfig
show all
- Defined in:
- lib/appydave/tools/configuration/models/youtube_automation_config.rb
Overview
Configuration model for Youtube automation
Defined Under Namespace
Classes: WorkflowGroup, WorkflowStep
Instance Attribute Summary
Attributes inherited from ConfigBase
#config_path, #data
Instance Method Summary
collapse
Methods inherited from ConfigBase
#config_name, #debug, #initialize, #load, #name, #save
Instance Method Details
#get_sequence(sequence) ⇒ Object
32
33
34
35
|
# File 'lib/appydave/tools/configuration/models/youtube_automation_config.rb', line 32
def get_sequence(sequence)
group, seq = sequence.split('-')
workflow_steps.find { |step| step.group == group && step.sequence == seq }
end
|
#get_workflow_group(group_id) ⇒ Object
21
22
23
24
|
# File 'lib/appydave/tools/configuration/models/youtube_automation_config.rb', line 21
def get_workflow_group(group_id)
group_data = data['workflow_groups'].find { |group| group['group'] == group_id }
WorkflowGroup.new(group_data) if group_data
end
|
#get_workflow_steps(group_id) ⇒ Object
26
27
28
29
30
|
# File 'lib/appydave/tools/configuration/models/youtube_automation_config.rb', line 26
def get_workflow_steps(group_id)
data['workflow_steps'].select { |step| step['group'] == group_id }.map do |step|
WorkflowStep.new(step)
end
end
|
#next_sequence(sequence) ⇒ Object
37
38
39
40
41
|
# File 'lib/appydave/tools/configuration/models/youtube_automation_config.rb', line 37
def next_sequence(sequence)
group, seq = sequence.split('-')
current_index = workflow_steps.find_index { |step| step.group == group && step.sequence == seq }
workflow_steps[current_index + 1] if current_index && current_index < workflow_steps.size - 1
end
|
#previous_sequence(sequence) ⇒ Object
43
44
45
46
47
|
# File 'lib/appydave/tools/configuration/models/youtube_automation_config.rb', line 43
def previous_sequence(sequence)
group, seq = sequence.split('-')
current_index = workflow_steps.find_index { |step| step.group == group && step.sequence == seq }
workflow_steps[current_index - 1] if current_index&.positive?
end
|
#workflow_groups ⇒ Object
9
10
11
12
13
|
# File 'lib/appydave/tools/configuration/models/youtube_automation_config.rb', line 9
def workflow_groups
data['workflow_groups'].map do |group|
WorkflowGroup.new(group)
end
end
|
#workflow_steps ⇒ Object
15
16
17
18
19
|
# File 'lib/appydave/tools/configuration/models/youtube_automation_config.rb', line 15
def workflow_steps
data['workflow_steps'].map do |step|
WorkflowStep.new(step)
end
end
|