Class: Lazylead::Task::Due
- Inherits:
-
Object
- Object
- Lazylead::Task::Due
- Defined in:
- lib/lazylead/task/micromanager.rb
Overview
Instance of “Due” history item for the particular ticket.
Instance Attribute Summary collapse
-
#issue ⇒ Object
readonly
Returns the value of attribute issue.
-
#when ⇒ Object
readonly
Returns the value of attribute when.
Instance Method Summary collapse
-
#illegal? ⇒ Boolean
Gives true when last change of “Due Date” field was done by not authorized person.
-
#initialize(issue, allowed) ⇒ Due
constructor
A new instance of Due.
-
#last ⇒ Object
Detect details about last change of “Due Date” to non-null value.
Constructor Details
#initialize(issue, allowed) ⇒ Due
Returns a new instance of Due.
57 58 59 60 |
# File 'lib/lazylead/task/micromanager.rb', line 57 def initialize(issue, allowed) @issue = issue @allowed = allowed end |
Instance Attribute Details
#issue ⇒ Object (readonly)
Returns the value of attribute issue.
55 56 57 |
# File 'lib/lazylead/task/micromanager.rb', line 55 def issue @issue end |
#when ⇒ Object (readonly)
Returns the value of attribute when.
55 56 57 |
# File 'lib/lazylead/task/micromanager.rb', line 55 def when @when end |
Instance Method Details
#illegal? ⇒ Boolean
Gives true when last change of “Due Date” field was done
by not authorized person.
64 65 66 67 |
# File 'lib/lazylead/task/micromanager.rb', line 64 def illegal? return false if @issue.assignee.id.eql?(last.id) @allowed.none? { |a| a.eql? last.id } end |
#last ⇒ Object
Detect details about last change of “Due Date” to non-null value
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/lazylead/task/micromanager.rb', line 70 def last @last ||= begin dd = @issue.history .reverse .find { |h| h["items"].any? { |i| i["field"] == "duedate" } } if dd.nil? && !@issue.duedate.nil? @when = @issue["created"] dd = @issue.reporter else @when = dd["created"].to_date dd = Lazylead::User.new(dd["author"]) end dd end end |