Class: Ryespy::Listener::GoogDrv
- Defined in:
- lib/ryespy/listener/goog_drv.rb
Constant Summary collapse
- REDIS_KEY_PREFIX =
'goog_drv'.freeze
- SIDEKIQ_JOB_CLASS =
'RyespyGoogDrvJob'.freeze
Instance Method Summary collapse
- #check(filter) ⇒ Object
-
#initialize(opts = {}) ⇒ GoogDrv
constructor
A new instance of GoogDrv.
Methods inherited from Base
Constructor Details
#initialize(opts = {}) ⇒ GoogDrv
Returns a new instance of GoogDrv.
13 14 15 16 17 18 19 20 |
# File 'lib/ryespy/listener/goog_drv.rb', line 13 def initialize(opts = {}) @config = { :username => opts[:username], :password => opts[:password], } super(opts) end |
Instance Method Details
#check(filter) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ryespy/listener/goog_drv.rb', line 22 def check(filter) @logger.debug { "filter: #{filter}" } @logger.debug { "redis_key: #{redis_key}" } seen_files = @redis.hgetall(redis_key) unseen_files = get_unseen_files(filter, seen_files) @logger.debug { "unseen_files: #{unseen_files}" } unseen_files.each do |key, val| @redis.hset(redis_key, key, val) @notifiers.each { |n| n.notify(SIDEKIQ_JOB_CLASS, [key]) } end @logger.info { "#{filter} has #{unseen_files.count} new files" } end |