class Lita::Handlers::Standup
Public Instance Methods
begin_standup(request)
click to toggle source
# File lib/lita/handlers/standup.rb, line 23 def begin_standup(request) redis.set('last_standup_started_at', Time.now) find_and_create_users message_all_users SummaryEmailJob.perform_in(config.time_to_respond * 60, {redis: redis, config: config}) end
process_standup(request)
click to toggle source
# File lib/lita/handlers/standup.rb, line 30 def process_standup(request) return unless timing_is_right? request.reply('Response recorded. Thanks for partipating') date_string = Time.now.strftime('%Y%m%d') user_name = request.user.name.split(' ').join('_') #lol redis.set(date_string + '-' + user_name, request.matches.first) end
Private Instance Methods
find_and_create_users()
click to toggle source
# File lib/lita/handlers/standup.rb, line 52 def find_and_create_users @users ||= robot.auth.groups_with_users[config.name_of_auth_group] end
message_all_users()
click to toggle source
# File lib/lita/handlers/standup.rb, line 40 def message_all_users @users.each do |user| source = Lita::Source.new(user: user) robot.send_message(source, "Time for standup!") robot.send_message(source, "Please tell me (in the following format) Lita standup response 1. things you worked on yesterday, 2. things you'll be doing today, 3. anything that's blocking you.") end end
timing_is_right?()
click to toggle source
# File lib/lita/handlers/standup.rb, line 56 def timing_is_right? return false if redis.get('last_standup_started_at').nil? intitiated_at = Time.parse(redis.get('last_standup_started_at')) Time.now > intitiated_at && intitiated_at + (60*config.time_to_respond) > Time.now end