Class: Dri::Commands::Fetch::Triaged
- Inherits:
-
Dri::Command
- Object
- Dri::Command
- Dri::Commands::Fetch::Triaged
- Includes:
- Utils::Constants::Triage::Labels, Utils::Table
- Defined in:
- lib/dri/commands/fetch/triaged.rb
Constant Summary
Constants included from Utils::Constants::Triage::Labels
Utils::Constants::Triage::Labels::FAILURE, Utils::Constants::Triage::Labels::FAILURE_NEW, Utils::Constants::Triage::Labels::FOUND, Utils::Constants::Triage::Labels::INCIDENT, Utils::Constants::Triage::Labels::QA, Utils::Constants::Triage::Labels::QUALITY, Utils::Constants::Triage::Labels::QUARANTINE, Utils::Constants::Triage::Labels::SERVICE
Instance Method Summary collapse
-
#execute ⇒ Object
rubocop:disable Metrics/AbcSize.
-
#initialize(options) ⇒ Triaged
constructor
A new instance of Triaged.
Methods included from Utils::Table
Methods inherited from Dri::Command
#add_color, #api_client, #bold, #command, #config, #cursor, #editor, #emoji, #handover_report_path, #logger, #ops_token, #pastel, #profile, #prompt, #spinner, #timezone, #token, #username, #verify_config_exists
Constructor Details
#initialize(options) ⇒ Triaged
Returns a new instance of Triaged.
15 16 17 |
# File 'lib/dri/commands/fetch/triaged.rb', line 15 def initialize() @options = end |
Instance Method Details
#execute ⇒ Object
rubocop:disable Metrics/AbcSize
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/dri/commands/fetch/triaged.rb', line 19 def execute(*) # rubocop:disable Metrics/AbcSize verify_config_exists title = add_color('Title', :magenta) url = add_color('URL', :magenta) type_label = add_color('Type', :magenta) table_labels = [title, url, type_label] failures_triaged = [] logger.info "Fetching your triaged failures..." spinner.start failures = api_client.fetch_all_triaged_failures(emoji: emoji, state: 'opened') if failures.empty? logger.info "There are no failures triaged yet with #{add_color(emoji, :black, :on_white)}." exit 0 end failures.each do |triaged| title = triaged["title"].truncate(70) url = triaged["web_url"] labels = triaged["labels"] type = "" labels.each do |label| type = label.gsub!(FAILURE, ' ').to_s if label.include? FAILURE end failures_triaged << [title, url, type] end spinner.stop print_table(table_labels, failures_triaged) end |