Class: Redpomo::Issue
- Inherits:
-
Object
- Object
- Redpomo::Issue
- Defined in:
- lib/redpomo/issue.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#due_date ⇒ Object
Returns the value of attribute due_date.
-
#issue_id ⇒ Object
Returns the value of attribute issue_id.
-
#priority_id ⇒ Object
Returns the value of attribute priority_id.
-
#project_id ⇒ Object
Returns the value of attribute project_id.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#tracker ⇒ Object
Returns the value of attribute tracker.
Instance Method Summary collapse
- #create! ⇒ Object
-
#initialize(tracker, data = {}) ⇒ Issue
constructor
A new instance of Issue.
- #to_task ⇒ Object
Constructor Details
#initialize(tracker, data = {}) ⇒ Issue
Returns a new instance of Issue.
8 9 10 11 12 13 14 15 |
# File 'lib/redpomo/issue.rb', line 8 def initialize(tracker, data = {}) @subject = data["subject"] @issue_id = data["id"] @project_id = data["project_id"] @priority_id = data["priority"]["id"] if data["priority"].present? @due_date = Date.parse(data["due_date"]) if data["due_date"].present? @tracker = tracker end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
4 5 6 |
# File 'lib/redpomo/issue.rb', line 4 def description @description end |
#due_date ⇒ Object
Returns the value of attribute due_date.
6 7 8 |
# File 'lib/redpomo/issue.rb', line 6 def due_date @due_date end |
#issue_id ⇒ Object
Returns the value of attribute issue_id.
5 6 7 |
# File 'lib/redpomo/issue.rb', line 5 def issue_id @issue_id end |
#priority_id ⇒ Object
Returns the value of attribute priority_id.
6 7 8 |
# File 'lib/redpomo/issue.rb', line 6 def priority_id @priority_id end |
#project_id ⇒ Object
Returns the value of attribute project_id.
5 6 7 |
# File 'lib/redpomo/issue.rb', line 5 def project_id @project_id end |
#subject ⇒ Object
Returns the value of attribute subject.
4 5 6 |
# File 'lib/redpomo/issue.rb', line 4 def subject @subject end |
#tracker ⇒ Object
Returns the value of attribute tracker.
5 6 7 |
# File 'lib/redpomo/issue.rb', line 5 def tracker @tracker end |
Instance Method Details
#create! ⇒ Object
32 33 34 35 |
# File 'lib/redpomo/issue.rb', line 32 def create! data = tracker.create_issue!(self) @issue_id = data["issue"]["id"] end |
#to_task ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/redpomo/issue.rb', line 17 def to_task label = [] if @priority_id.present? if priority = @tracker.todo_priority(@priority_id) label << priority end end label << @due_date.strftime("%Y-%m-%d") if @due_date.present? label << @subject label << "##{issue_id}" label << "+#{project_id}" label << "@#{tracker.name}" Task.new(nil, label.join(" ")) end |