Class: Dev::Jira::Issue
- Defined in:
- lib/firespring_dev_commands/jira/issue.rb
Overview
Contains information and methods representing a Jira issue
Constant Summary collapse
- NON_STORY_TYPES =
Issue subtypes which do not map to a story type
['epic', 'review', 'sub-task', 'code review sub-task', 'pre-deploy sub-task', 'deploy sub-task', 'devops sub-task'].freeze
Instance Attribute Summary collapse
-
#assignee ⇒ Object
Returns the value of attribute assignee.
-
#data ⇒ Object
Returns the value of attribute data.
-
#first_in_review_history ⇒ Object
writeonly
Sets the attribute first_in_review_history.
-
#histories ⇒ Object
Returns the value of attribute histories.
-
#id ⇒ Object
Returns the value of attribute id.
-
#last_closed_history ⇒ Object
writeonly
Sets the attribute last_closed_history.
-
#last_in_progress_history ⇒ Object
writeonly
Sets the attribute last_in_progress_history.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#points ⇒ Object
Returns the value of attribute points.
-
#project ⇒ Object
Returns the value of attribute project.
-
#resolved_date ⇒ Object
Returns the value of attribute resolved_date.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
-
#cycle_time ⇒ Object
Returns the cycle time of the issue (time between in progress and closed states).
-
#in_progress_cycle_time ⇒ Object
Returns the time the issue was in progress (time between in progress and in review states).
-
#in_review_cycle_time ⇒ Object
Returns the time the issue was in review (time between in review and closed states).
-
#initialize(data) ⇒ Issue
constructor
A new instance of Issue.
-
#to_s ⇒ Object
Converts the jira issue object to a string representation.
Constructor Details
#initialize(data) ⇒ Issue
Returns a new instance of Issue.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/firespring_dev_commands/jira/issue.rb', line 11 def initialize(data) @data = data @project = Jira::Project.new(data) @parent = Jira::Parent.new(data) if data.respond_to?(:parent) @id = data.key @title = data.summary @points = calculate_points(data) @assignee = Jira::User.lookup(data.assignee&.accountId) @resolved_date = data.resolutiondate @histories = Jira::Histories.populate(data) @last_in_progress_history = nil @first_in_review_history = nil @last_closed_history = nil end |
Instance Attribute Details
#assignee ⇒ Object
Returns the value of attribute assignee.
8 9 10 |
# File 'lib/firespring_dev_commands/jira/issue.rb', line 8 def assignee @assignee end |
#data ⇒ Object
Returns the value of attribute data.
8 9 10 |
# File 'lib/firespring_dev_commands/jira/issue.rb', line 8 def data @data end |
#first_in_review_history=(value) ⇒ Object
Sets the attribute first_in_review_history
8 9 10 |
# File 'lib/firespring_dev_commands/jira/issue.rb', line 8 def first_in_review_history=(value) @first_in_review_history = value end |
#histories ⇒ Object
Returns the value of attribute histories.
8 9 10 |
# File 'lib/firespring_dev_commands/jira/issue.rb', line 8 def histories @histories end |
#id ⇒ Object
Returns the value of attribute id.
8 9 10 |
# File 'lib/firespring_dev_commands/jira/issue.rb', line 8 def id @id end |
#last_closed_history=(value) ⇒ Object
Sets the attribute last_closed_history
8 9 10 |
# File 'lib/firespring_dev_commands/jira/issue.rb', line 8 def last_closed_history=(value) @last_closed_history = value end |
#last_in_progress_history=(value) ⇒ Object
Sets the attribute last_in_progress_history
8 9 10 |
# File 'lib/firespring_dev_commands/jira/issue.rb', line 8 def last_in_progress_history=(value) @last_in_progress_history = value end |
#parent ⇒ Object
Returns the value of attribute parent.
8 9 10 |
# File 'lib/firespring_dev_commands/jira/issue.rb', line 8 def parent @parent end |
#points ⇒ Object
Returns the value of attribute points.
8 9 10 |
# File 'lib/firespring_dev_commands/jira/issue.rb', line 8 def points @points end |
#project ⇒ Object
Returns the value of attribute project.
8 9 10 |
# File 'lib/firespring_dev_commands/jira/issue.rb', line 8 def project @project end |
#resolved_date ⇒ Object
Returns the value of attribute resolved_date.
8 9 10 |
# File 'lib/firespring_dev_commands/jira/issue.rb', line 8 def resolved_date @resolved_date end |
#title ⇒ Object
Returns the value of attribute title.
8 9 10 |
# File 'lib/firespring_dev_commands/jira/issue.rb', line 8 def title @title end |
Instance Method Details
#cycle_time ⇒ Object
Returns the cycle time of the issue (time between in progress and closed states)
27 28 29 30 |
# File 'lib/firespring_dev_commands/jira/issue.rb', line 27 def cycle_time # Calculate the difference and convert to days ((last_closed_history.created - last_in_progress_history.created) / 60 / 60 / 24).round(2) end |
#in_progress_cycle_time ⇒ Object
Returns the time the issue was in progress (time between in progress and in review states)
33 34 35 36 |
# File 'lib/firespring_dev_commands/jira/issue.rb', line 33 def in_progress_cycle_time # Calculate the difference and convert to days ((first_in_review_history.created - last_in_progress_history.created) / 60 / 60 / 24).round(2) end |
#in_review_cycle_time ⇒ Object
Returns the time the issue was in review (time between in review and closed states)
39 40 41 42 |
# File 'lib/firespring_dev_commands/jira/issue.rb', line 39 def in_review_cycle_time # Calculate the difference and convert to days ((last_closed_history.created - first_in_review_history.created) / 60 / 60 / 24).round(2) end |
#to_s ⇒ Object
Converts the jira issue object to a string representation
97 98 99 |
# File 'lib/firespring_dev_commands/jira/issue.rb', line 97 def to_s "[#{id}] #{title} (#{points} pts) (resolved #{resolved_date}" end |