Class: Sprint
- Inherits:
-
Object
- Object
- Sprint
- Defined in:
- lib/jirametrics/sprint.rb
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #active? ⇒ Boolean
- #closed? ⇒ Boolean
- #completed_at?(time) ⇒ Boolean
-
#completed_time ⇒ Object
The time that the sprint was actually closed.
- #day_count ⇒ Object
-
#end_time ⇒ Object
The time that was anticipated that the sprint would close.
- #future? ⇒ Boolean
- #goal ⇒ Object
- #id ⇒ Object
-
#initialize(raw:, timezone_offset:) ⇒ Sprint
constructor
A new instance of Sprint.
- #name ⇒ Object
- #start_time ⇒ Object
Constructor Details
#initialize(raw:, timezone_offset:) ⇒ Sprint
Returns a new instance of Sprint.
8 9 10 11 |
# File 'lib/jirametrics/sprint.rb', line 8 def initialize raw:, timezone_offset: @raw = raw @timezone_offset = timezone_offset end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
6 7 8 |
# File 'lib/jirametrics/sprint.rb', line 6 def raw @raw end |
Instance Method Details
#active? ⇒ Boolean
14 |
# File 'lib/jirametrics/sprint.rb', line 14 def active? = (@raw['state'] == 'active') |
#closed? ⇒ Boolean
15 |
# File 'lib/jirametrics/sprint.rb', line 15 def closed? = (@raw['state'] == 'closed') |
#completed_at?(time) ⇒ Boolean
18 19 20 21 |
# File 'lib/jirametrics/sprint.rb', line 18 def completed_at? time completed_at = completed_time completed_at && completed_at <= time end |
#completed_time ⇒ Object
The time that the sprint was actually closed
33 34 35 |
# File 'lib/jirametrics/sprint.rb', line 33 def completed_time parse_time(@raw['completeDate']) end |
#day_count ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/jirametrics/sprint.rb', line 40 def day_count return '' if future? if closed? days = (completed_time.to_date - start_time.to_date).to_i + 1 else days = (end_time.to_date - start_time.to_date).to_i + 1 end "#{days} days" end |
#end_time ⇒ Object
The time that was anticipated that the sprint would close
28 29 30 |
# File 'lib/jirametrics/sprint.rb', line 28 def end_time parse_time(@raw['endDate']) end |
#future? ⇒ Boolean
16 |
# File 'lib/jirametrics/sprint.rb', line 16 def future? = (@raw['state'] == 'future') |
#goal ⇒ Object
37 |
# File 'lib/jirametrics/sprint.rb', line 37 def goal = @raw['goal'] |
#id ⇒ Object
13 |
# File 'lib/jirametrics/sprint.rb', line 13 def id = @raw['id'] |
#name ⇒ Object
38 |
# File 'lib/jirametrics/sprint.rb', line 38 def name = @raw['name'] |
#start_time ⇒ Object
23 24 25 |
# File 'lib/jirametrics/sprint.rb', line 23 def start_time parse_time(@raw['activatedDate'] || @raw['startDate']) end |