class Commands::ResolveAll

Public Instance Methods

call() click to toggle source
# File lib/lita/commands/resolve_all.rb, line 5
def call
  ids = pagerduty.get_incidents(query_params).map { |i| i[:id] }
  pagerduty.manage_incidents(:resolve, ids)
  response message: 'all.resolved', params: { list: ids.join(', ') }
rescue Exceptions::IncidentsEmptyList
  response message: 'incident.none'
rescue Exceptions::IncidentManageUnsuccess
  nil
end

Private Instance Methods

query_params() click to toggle source
# File lib/lita/commands/resolve_all.rb, line 17
def query_params
  { statuses: %w[triggered acknowledged] }
end