Class: Pivotalprinter::Story
- Inherits:
-
Object
- Object
- Pivotalprinter::Story
- Defined in:
- lib/pivotalprinter/story.rb
Constant Summary collapse
- FIELDS =
[ :name, :id, :story_type, :estimate, :current_state, :description, :requested_by, :labels, :created_at, :updated_at ]
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(xml) ⇒ Story
constructor
A new instance of Story.
- #points ⇒ Object
- #points_background ⇒ Object
Constructor Details
#initialize(xml) ⇒ Story
Returns a new instance of Story.
8 9 10 11 12 13 14 15 |
# File 'lib/pivotalprinter/story.rb', line 8 def initialize(xml) FIELDS.each do |field| value = xml.css("#{field}") send "#{field}=", value.first.full? { |v| v.send(:text) } || value.send(:text) end created_at and self.created_at = Time.parse(created_at) updated_at and self.updated_at = Time.parse(updated_at) end |
Class Method Details
Instance Method Details
#points ⇒ Object
24 25 26 |
# File 'lib/pivotalprinter/story.rb', line 24 def points estimate.to_i >= 0 ? estimate.to_i : '?' end |
#points_background ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/pivotalprinter/story.rb', line 28 def points_background case points when '?' then 'cccccc' when 0 then 'ccff66' when 1 then '408000' when 2 then '808000' when 3 then 'ffcc66' when 5 then 'ff8000' when 8 then 'ff0000' else 'aa0000' end end |