Sha256: baf2b4bce8752a7c0e6d01c8a380417de17d35f89f8d802a5f049699b2c993c0

Contents?: true

Size: 591 Bytes

Versions: 3

Compression:

Stored size: 591 Bytes

Contents

module Redpomo
  class Issue

    attr_reader :title, :issue_id, :project, :tracker, :due_date

    def initialize(tracker, data)
      @title = data["subject"]
      @issue_id = data["id"]
      @project = data["project"]
      @due_date = Date.parse(data["due_date"]) if data["due_date"].present?
      @tracker = tracker
    end

    def to_task
      label = [ title ]
      label << @due_date.strftime("%Y-%m-%d") if @due_date.present?
      label << "##{issue_id}"
      label << "+#{project}"
      label << "@#{tracker.name}"
      Todo::Task.new(label.join(" "))
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
redpomo-0.0.3 lib/redpomo/issue.rb
redpomo-0.0.2 lib/redpomo/issue.rb
redpomo-0.0.1 lib/redpomo/issue.rb