Class: ScheduledIssuesManager
- Inherits:
-
Object
- Object
- ScheduledIssuesManager
- Defined in:
- lib/scheduled/scheduled_issues_manager.rb
Overview
Configuration for repeatables.
Instance Method Summary collapse
-
#add_scheduled(issue_id, repeat, date, start_time, duration) ⇒ Object
Adds a scheduled issue to database.
-
#all_issues ⇒ Array<WorklogIssue>
Return all scheduled issues.
-
#remove_scheduled(issue_id, date, repeat) ⇒ Object
Remove a scheduled issue from database.
-
#update_issue_attributes(issue, repeat, date, start_time, duration) ⇒ Object
Updates issue's attributes with command line arguments.
Instance Method Details
#add_scheduled(issue_id, repeat, date, start_time, duration) ⇒ Object
Adds a scheduled issue to database.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/scheduled/scheduled_issues_manager.rb', line 40 def add_scheduled(issue_id, repeat, date, start_time, duration) validate_input(repeat, date, start_time, duration) Communication::API.get_issue(issue_id) do |issue| update_issue_attributes(issue, repeat, date, start_time, duration).save Utilities.log "Added issue #{issue.jira_id}: #{issue.description}.", { type: :info } end rescue LogworkException::APIResourceNotFound Utilities.log("JIRA issue '#{issue_id}' not found.", { type: :error }) rescue LogworkException::RepeatedOrScheduledRequired, LogworkException::ScheduledCannotBeCombinedWithRepeated, LogworkException::InvalidRepeatValue, LogworkException::InvalidDateFormat, LogworkException::DuplicateIssueFound, LogworkException::InputValueRequired, LogworkException::InvalidTimeException => e Utilities.log(e, { type: :error }) end |
#all_issues ⇒ Array<WorklogIssue>
Return all scheduled issues.
85 86 87 |
# File 'lib/scheduled/scheduled_issues_manager.rb', line 85 def all_issues WorklogIssue.all end |
#remove_scheduled(issue_id, date, repeat) ⇒ Object
Remove a scheduled issue from database.
75 76 77 78 79 80 |
# File 'lib/scheduled/scheduled_issues_manager.rb', line 75 def remove_scheduled(issue_id, date, repeat) filters = { jira_id: issue_id } filters[:date] = date unless date.nil? filters[:repeat] = date unless repeat.nil? WorklogIssue.where(filters).delete_all end |
#update_issue_attributes(issue, repeat, date, start_time, duration) ⇒ Object
Updates issue's attributes with command line arguments
62 63 64 65 66 67 68 |
# File 'lib/scheduled/scheduled_issues_manager.rb', line 62 def update_issue_attributes(issue, repeat, date, start_time, duration) issue.date = date issue.start_time = start_time issue.repeat = repeat issue.duration = duration issue end |