class Jira::Command::Describe

Attributes

ticket[RW]

Public Class Methods

new(ticket) click to toggle source
# File lib/jira/commands/describe.rb, line 16
def initialize(ticket)
  self.ticket = ticket
end

Public Instance Methods

assignee() click to toggle source
# File lib/jira/commands/describe.rb, line 38
def assignee
  (fields['assignee'] || {})['name'] || 'Unassigned'
end
errors() click to toggle source
# File lib/jira/commands/describe.rb, line 34
def errors
  @errors ||= (json['errorMessages'] || []).join('. ')
end
fields() click to toggle source
# File lib/jira/commands/describe.rb, line 50
def fields
  json['fields'] || {}
end
header() click to toggle source
# File lib/jira/commands/describe.rb, line 26
def header
  [ 'Ticket', 'Assignee', 'Status', 'Summary' ]
end
json() click to toggle source
# File lib/jira/commands/describe.rb, line 54
def json
  @json ||= api.get "issue/#{ticket}"
end
row() click to toggle source
# File lib/jira/commands/describe.rb, line 30
def row
  [ ticket, assignee, status, summary ]
end
run() click to toggle source
# File lib/jira/commands/describe.rb, line 20
def run
  return if json.empty?
  return unless errors.empty?
  render_table(header, [row])
end
status() click to toggle source
# File lib/jira/commands/describe.rb, line 42
def status
  (fields['status'] || {})['name'] || 'Unknown'
end
summary() click to toggle source
# File lib/jira/commands/describe.rb, line 46
def summary
  truncate(json['fields']['summary'], 45)
end