Class: Lita::Handlers::Standups
- Inherits:
-
Handler
- Object
- Handler
- Lita::Handlers::Standups
- Defined in:
- lib/lita/handlers/standups.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create_standup(request) ⇒ Object
- #create_standups_schedule(request) ⇒ Object
-
#debug_standups(request) ⇒ Object
:nocov:.
- #delete_standup(request) ⇒ Object
- #delete_standups_schedule(request) ⇒ Object
- #list_standup_sessions(request) ⇒ Object
- #list_standups(request) ⇒ Object
- #run_standup(request) ⇒ Object
- #show_standup(request) ⇒ Object
- #show_standup_schedule(request) ⇒ Object
- #show_standup_session(request) ⇒ Object
- #show_standups_schedule(request) ⇒ Object
Class Method Details
Instance Method Details
#create_standup(request) ⇒ Object
60 61 62 |
# File 'lib/lita/handlers/standups.rb', line 60 def create_standup(request) start_wizard Wizards::CreateStandup, request. end |
#create_standups_schedule(request) ⇒ Object
83 84 85 86 87 88 89 90 |
# File 'lib/lita/handlers/standups.rb', line 83 def create_standups_schedule(request) standup = Models::Standup[request.matches[0][0]] if standup start_wizard Wizards::ScheduleStandup, request., 'standup_id' => standup.id else request.reply "I couldn't find a standup with ID=#{request.matches[0][0]}" end end |
#debug_standups(request) ⇒ Object
:nocov:
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/lita/handlers/standups.rb', line 156 def debug_standups(request) request.reply "*Standups*" Models::Standup.all.each do |standup| request.reply ">>> \n" + standup.description request.reply "```\n#{standup.inspect}\n```" end request.reply "*Scheduled Standups*" Models::StandupSchedule.all.each do |schedule| request.reply ">>> \n" + schedule.description request.reply "```\n#{schedule.inspect}\n```" end request.reply "*Rufus Schedule*" request.reply robot.jobs_info.map{|j| "```\n" + j.join("\n") + "\n```" }.join("\n\n") request.reply "*Server time*: #{Time.now}" end |
#delete_standup(request) ⇒ Object
73 74 75 76 77 78 79 80 81 |
# File 'lib/lita/handlers/standups.rb', line 73 def delete_standup(request) standup = Models::Standup[request.matches[0][0]] if standup standup.delete request.reply "Standup with ID #{standup.id} has been deleted" else request.reply "I couldn't find a standup with ID=#{request.matches[0][0]}" end end |
#delete_standups_schedule(request) ⇒ Object
100 101 102 103 104 105 106 107 108 109 |
# File 'lib/lita/handlers/standups.rb', line 100 def delete_standups_schedule(request) schedule = Models::StandupSchedule[request.matches[0][0]] if schedule robot.unschedule_standup(schedule) schedule.delete request.reply "Schedule with ID #{schedule.id} has been deleted" else request.reply "I couldn't find a scheduled standup with ID=#{request.matches[0][0]}" end end |
#list_standup_sessions(request) ⇒ Object
131 132 133 134 135 136 137 |
# File 'lib/lita/handlers/standups.rb', line 131 def list_standup_sessions(request) sessions = Models::StandupSession.all.to_a = "Sessions found: #{sessions.size}." << " Here they are: \n" if sessions.size>0 << sessions.map(&:summary).join("\n") request.reply end |
#list_standups(request) ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/lita/handlers/standups.rb', line 52 def list_standups(request) standups = Models::Standup.all.to_a = "Standups found: #{standups.size}." << " Here they are: \n" if standups.size>0 << standups.map(&:summary).join("\n") request.reply end |
#run_standup(request) ⇒ Object
120 121 122 123 124 125 126 127 128 129 |
# File 'lib/lita/handlers/standups.rb', line 120 def run_standup(request) standup = Models::Standup[request.matches[0][0]] recipients = request.matches[0][1].to_s.gsub("@", "").split(/[\s,\n]/m).map(&:strip).map(&:presence).compact if standup request.reply "I'll run the standup shortly and post the results here. Thanks" robot.run_standup standup.id, recipients, request..source.room else request.reply "I couldn't find a standup with ID=#{request.matches[0][0]}" end end |
#show_standup(request) ⇒ Object
64 65 66 67 68 69 70 71 |
# File 'lib/lita/handlers/standups.rb', line 64 def show_standup(request) standup = Models::Standup[request.matches[0][0]] if standup request.reply "Here are the details of your standup: \n>>>\n#{standup.description}" else request.reply "I couldn't find a standup with ID=#{request.matches[0][0]}" end end |
#show_standup_schedule(request) ⇒ Object
111 112 113 114 115 116 117 118 |
# File 'lib/lita/handlers/standups.rb', line 111 def show_standup_schedule(request) schedule = Models::StandupSchedule[request.matches[0][0]] if schedule request.reply "Here are the details: \n>>>\n#{schedule.description}" else request.reply "I couldn't find a scheduled standup with ID=#{request.matches[0][0]}" end end |
#show_standup_session(request) ⇒ Object
139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/lita/handlers/standups.rb', line 139 def show_standup_session(request) session = Models::StandupSession[request.matches[0][0]] if session = "Here are the standup session details: \n #{session.description}\n" << "\n*Responses:*\n" << session. request.reply else request.reply "I couldn't find a standup session with ID=#{request.matches[0][0]}" end end |
#show_standups_schedule(request) ⇒ Object
92 93 94 95 96 97 98 |
# File 'lib/lita/handlers/standups.rb', line 92 def show_standups_schedule(request) schedules = Models::StandupSchedule.all.to_a = "Scheduled standups found: #{schedules.size}." << " Here they are: \n" if schedules.size>0 << schedules.map(&:summary).join("\n") request.reply end |