Class: Jira::Command::Describe
- Defined in:
- lib/jira/commands/describe.rb
Instance Attribute Summary collapse
-
#ticket ⇒ Object
Returns the value of attribute ticket.
Instance Method Summary collapse
- #assignee ⇒ Object
- #errors ⇒ Object
- #fields ⇒ Object
- #header ⇒ Object
-
#initialize(ticket) ⇒ Describe
constructor
A new instance of Describe.
- #json ⇒ Object
- #row ⇒ Object
- #run ⇒ Object
- #status ⇒ Object
- #summary ⇒ Object
Constructor Details
#initialize(ticket) ⇒ Describe
Returns a new instance of Describe.
16 17 18 |
# File 'lib/jira/commands/describe.rb', line 16 def initialize(ticket) self.ticket = ticket end |
Instance Attribute Details
#ticket ⇒ Object
Returns the value of attribute ticket.
14 15 16 |
# File 'lib/jira/commands/describe.rb', line 14 def ticket @ticket end |
Instance Method Details
#assignee ⇒ Object
38 39 40 |
# File 'lib/jira/commands/describe.rb', line 38 def assignee (fields['assignee'] || {})['name'] || 'Unassigned' end |
#errors ⇒ Object
34 35 36 |
# File 'lib/jira/commands/describe.rb', line 34 def errors @errors ||= (json['errorMessages'] || []).join('. ') end |
#fields ⇒ Object
50 51 52 |
# File 'lib/jira/commands/describe.rb', line 50 def fields json['fields'] || {} end |
#header ⇒ Object
26 27 28 |
# File 'lib/jira/commands/describe.rb', line 26 def header [ 'Ticket', 'Assignee', 'Status', 'Summary' ] end |
#json ⇒ Object
54 55 56 |
# File 'lib/jira/commands/describe.rb', line 54 def json @json ||= api.get "issue/#{ticket}" end |
#row ⇒ Object
30 31 32 |
# File 'lib/jira/commands/describe.rb', line 30 def row [ ticket, assignee, status, summary ] end |
#run ⇒ Object
20 21 22 23 24 |
# File 'lib/jira/commands/describe.rb', line 20 def run return if json.empty? return unless errors.empty? render_table(header, [row]) end |
#status ⇒ Object
42 43 44 |
# File 'lib/jira/commands/describe.rb', line 42 def status (fields['status'] || {})['name'] || 'Unknown' end |
#summary ⇒ Object
46 47 48 |
# File 'lib/jira/commands/describe.rb', line 46 def summary truncate(json['fields']['summary'], 45) end |