Class: Abt::Providers::Harvest::Services::TaskPicker
- Inherits:
-
Object
- Object
- Abt::Providers::Harvest::Services::TaskPicker
- Defined in:
- lib/abt/providers/harvest/services/task_picker.rb
Defined Under Namespace
Classes: Result
Instance Attribute Summary collapse
-
#cli ⇒ Object
readonly
Returns the value of attribute cli.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#project_assignment ⇒ Object
readonly
Returns the value of attribute project_assignment.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(cli:, path:, project_assignment:) ⇒ TaskPicker
constructor
A new instance of TaskPicker.
Constructor Details
#initialize(cli:, path:, project_assignment:) ⇒ TaskPicker
Returns a new instance of TaskPicker.
23 24 25 26 27 |
# File 'lib/abt/providers/harvest/services/task_picker.rb', line 23 def initialize(cli:, path:, project_assignment:) @cli = cli @path = path @project_assignment = project_assignment end |
Instance Attribute Details
#cli ⇒ Object (readonly)
Returns the value of attribute cli.
21 22 23 |
# File 'lib/abt/providers/harvest/services/task_picker.rb', line 21 def cli @cli end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
21 22 23 |
# File 'lib/abt/providers/harvest/services/task_picker.rb', line 21 def path @path end |
#project_assignment ⇒ Object (readonly)
Returns the value of attribute project_assignment.
21 22 23 |
# File 'lib/abt/providers/harvest/services/task_picker.rb', line 21 def project_assignment @project_assignment end |
Class Method Details
.call(**args) ⇒ Object
17 18 19 |
# File 'lib/abt/providers/harvest/services/task_picker.rb', line 17 def self.call(**args) new(**args).call end |
Instance Method Details
#call ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/abt/providers/harvest/services/task_picker.rb', line 29 def call task = cli.prompt.choice("Select a task from #{project['name']}", tasks) path_with_task = Path.from_ids(project_id: path.project_id, task_id: task["id"]) Result.new(task: task, path: path_with_task) end |