Class: Lazylead::Task::Micromanager
- Inherits:
-
Object
- Object
- Lazylead::Task::Micromanager
- Defined in:
- lib/lazylead/task/micromanager.rb
Overview
Email alerts about due date modification by not-authorized persons.
- Author
-
Yurii Dubinka ([email protected])
- Copyright
-
Copyright © 2019-2020 Yurii Dubinka
- License
-
MIT
Instance Method Summary collapse
-
#initialize(log = Log.new) ⇒ Micromanager
constructor
A new instance of Micromanager.
- #run(sys, postman, opts) ⇒ Object
-
#since(opts) ⇒ Object
Detect history period where search should start.
Constructor Details
#initialize(log = Log.new) ⇒ Micromanager
Returns a new instance of Micromanager.
39 40 41 |
# File 'lib/lazylead/task/micromanager.rb', line 39 def initialize(log = Log.new) @log = log end |
Instance Method Details
#run(sys, postman, opts) ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/lazylead/task/micromanager.rb', line 43 def run(sys, postman, opts) allowed = opts.slice "allowed", "," dues = sys.issues(opts["jql"], opts.jira_defaults.merge(expand: "changelog")) .map { |i| Due.new(i, allowed, since(opts)) } .select(&:illegal?) .reject(&:obsolete?) return if dues.empty? postman.send opts.merge(dues: dues) end |
#since(opts) ⇒ Object
62 63 64 65 66 67 68 |
# File 'lib/lazylead/task/micromanager.rb', line 62 def since(opts) @since ||= if opts.key? "now" Time.parse(opts["now"]) else Time.now - opts.fetch("period", "86400").to_i end end |