class Jira::Command::Log::List

Attributes

log[RW]
ticket[RW]

Public Class Methods

new(ticket=Jira::Core.ticket) click to toggle source
# File lib/jira/commands/log/list.rb, line 17
def initialize(ticket=Jira::Core.ticket)
  self.ticket = ticket
end

Public Instance Methods

run() click to toggle source
# File lib/jira/commands/log/list.rb, line 21
def run
  if logs.empty?
    puts "Ticket #{ticket} has no work logged."
    return
  end
  render_table(header, rows)
end

Private Instance Methods

author() click to toggle source
# File lib/jira/commands/log/list.rb, line 50
def author
  log['updateAuthor']['displayName']
end
header() click to toggle source
# File lib/jira/commands/log/list.rb, line 33
def header
  [ 'Author', 'Updated At', 'Time Spent' ]
end
logs() click to toggle source
# File lib/jira/commands/log/list.rb, line 62
def logs
  @logs ||= api.get("issue/#{ticket}/worklog")['worklogs']
end
row() click to toggle source
# File lib/jira/commands/log/list.rb, line 46
def row
  [ author, updated_at, time_spent ]
end
rows() click to toggle source
# File lib/jira/commands/log/list.rb, line 37
def rows
  rows = []
  logs.each do |log|
    self.log = log
    rows << row
  end
  rows
end
time_spent() click to toggle source
# File lib/jira/commands/log/list.rb, line 58
def time_spent
  log['timeSpent']
end
updated_at() click to toggle source
# File lib/jira/commands/log/list.rb, line 54
def updated_at
  Jira::Format.time(Time.parse(log['updated']))
end