Class: Gitgut::Jira::Ticket
- Inherits:
-
Object
- Object
- Gitgut::Jira::Ticket
- Defined in:
- lib/gitgut/jira.rb
Overview
A JIRA ticket
Instance Attribute Summary collapse
-
#assignee ⇒ Object
readonly
Returns the value of attribute assignee.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #assigned_to_me? ⇒ Boolean
- #assignee_initials ⇒ Object
- #closed? ⇒ Boolean
- #color ⇒ Object
- #done? ⇒ Boolean
- #in_review? ⇒ Boolean
-
#initialize(payload) ⇒ Ticket
constructor
A new instance of Ticket.
- #ready_for_release? ⇒ Boolean
- #released? ⇒ Boolean
Constructor Details
#initialize(payload) ⇒ Ticket
Returns a new instance of Ticket.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/gitgut/jira.rb', line 10 def initialize(payload) @key = payload['key'] # TODO: use Mash? if payload['fields']['assignee'] @assignee = payload['fields']['assignee']['name'] @assignee_display_name = payload['fields']['assignee']['displayName'] end if payload['fields']['status'] @status = payload['fields']['status']['name'] end end |
Instance Attribute Details
#assignee ⇒ Object (readonly)
Returns the value of attribute assignee.
8 9 10 |
# File 'lib/gitgut/jira.rb', line 8 def assignee @assignee end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
8 9 10 |
# File 'lib/gitgut/jira.rb', line 8 def key @key end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
8 9 10 |
# File 'lib/gitgut/jira.rb', line 8 def status @status end |
Instance Method Details
#assigned_to_me? ⇒ Boolean
23 24 25 |
# File 'lib/gitgut/jira.rb', line 23 def assigned_to_me? assignee == Settings.jira.username end |
#assignee_initials ⇒ Object
27 28 29 30 31 |
# File 'lib/gitgut/jira.rb', line 27 def assignee_initials return '' unless assignee words = @assignee_display_name.split(/ +/) "#{words.first} #{words.last[0]}." end |
#closed? ⇒ Boolean
45 46 47 |
# File 'lib/gitgut/jira.rb', line 45 def closed? status == 'Closed' end |
#color ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/gitgut/jira.rb', line 53 def color return :light_blue if assigned_to_me? case status when 'In Functional Review', 'In Review' :white when 'In Development', 'Open' :light_blue when 'Ready for Release', 'Released' :green when 'Closed' :light_black else :white end end |
#done? ⇒ Boolean
41 42 43 |
# File 'lib/gitgut/jira.rb', line 41 def done? ready_for_release? || released? || closed? end |
#in_review? ⇒ Boolean
37 38 39 |
# File 'lib/gitgut/jira.rb', line 37 def in_review? status == 'In Review' end |
#ready_for_release? ⇒ Boolean
33 34 35 |
# File 'lib/gitgut/jira.rb', line 33 def ready_for_release? status == 'Ready for Release' end |
#released? ⇒ Boolean
49 50 51 |
# File 'lib/gitgut/jira.rb', line 49 def released? status == 'Released' end |