Sha256: 8bb6c12fd7b1e01a8b95696c8ccd10150f48d1b3a54aad016cd2a4e7caaa96fc

Contents?: true

Size: 783 Bytes

Versions: 2

Compression:

Stored size: 783 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"]
      @priority = data["priority"]["name"]
      @due_date = Date.parse(data["due_date"]) if data["due_date"].present?
      @tracker = tracker
    end

    def to_task
      label = []
      if @priority.present?
        if priority = @tracker.todo_priority(@priority)
          label << priority
        end
      end
      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

2 entries across 2 versions & 1 rubygems

Version Path
redpomo-0.0.5 lib/redpomo/issue.rb
redpomo-0.0.4 lib/redpomo/issue.rb