Class: TimeLogRobot::Reporter

Inherits:
Object
  • Object
show all
Defined in:
lib/time_log_robot/reporter.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.errorsObject

Returns the value of attribute errors.



4
5
6
# File 'lib/time_log_robot/reporter.rb', line 4

def errors
  @errors
end

Class Method Details



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/time_log_robot/reporter.rb', line 12

def print_errors
  puts "\n\t\e[1;31m Failed to log the following entries:\e[0m"
  errors.each_with_index do |(entry, issue_key, response), index|
    puts "\e[31m"
    puts "\t#{index + 1})\tDescription: #{entry.description}"
    if issue_key
      puts "\t\tIssue Key: #{issue_key}"
    else
      puts "\t\tIssue Key: Missing"
    end
    if entry.comment
      puts "\t\tComment: #{entry.comment}"
    end
    puts "\t\t#{entry.human_readable_duration} starting on #{entry.start}"
    puts "\t\tResponse Code: #{response.code}"
    puts "\e[0m"
  end
end

.report(errors, successes) ⇒ Object



6
7
8
9
10
# File 'lib/time_log_robot/reporter.rb', line 6

def report(errors, successes)
  @errors = errors
  print_errors if errors.any?
  puts "\n\t#{successes.size} entries logged, #{errors.size} failed.\n\n"
end