Sha256: e9abe2ebd0dfb46247d109d8d3a173886aad8c2ad07894650ff8e944f5e5be88

Contents?: true

Size: 839 Bytes

Versions: 1

Compression:

Stored size: 839 Bytes

Contents

module Pivotal
  class Story < Base
    
    has_attributes :id, :story_type, :url, :estimate, :current_state,
                   :description, :name, :requested_by, :owned_by,
                   :created_at, :accepted_at, :labels
    
    def start!(options = {})
      return false if feature? && unestimated?
      
      update_attributes(options.merge(:current_state => :started))
    end
    
    def feature?
      story_type == "feature"
    end
    
    def bug?
      story_type == "bug"
    end
    
    def chore?
      story_type == "chore"
    end
    
    def release?
      story_type == "release"
    end
    
    def unestimated?
      estimate == "unestimated"
    end

    def finished_state
      case story_type
        when "chore"
          :accepted
        else
          :finished
      end
    end
  
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
git-pivotal-0.2.3 lib/pivotal/story.rb