class Lita::Handlers::Pagerduty

Constants

COMMANDS
COMMANDS_PATH

Public Instance Methods

handle_response(message, response) click to toggle source
# File lib/lita/handlers/pagerduty.rb, line 48
def handle_response(message, response)
  message.reply case response
                when String
                  response
                when Hash
                  t response[:message], response[:params]
                when Array
                  response.map { |item| t item[:message], item[:params] }
                          .join("\n")
                end
end
method_missing(method, message) click to toggle source
Calls superclass method
# File lib/lita/handlers/pagerduty.rb, line 23
def method_missing(method, message)
  super if COMMANDS.map { |i| i['method'] }.include? method
  response = Object.const_get(
    'Commands::' << method.to_s.split('_').map(&:capitalize).join
  ).send(:call, message, pagerduty, store)
  handle_response(message, response) if response
end
pagerduty() click to toggle source
# File lib/lita/handlers/pagerduty.rb, line 35
def pagerduty
  @pagerduty ||= ::Pagerduty.new(
    http,
    config.api_key,
    config.email,
    config.teams
  )
end
respond_to_missing?(method, include_private = false) click to toggle source
Calls superclass method
# File lib/lita/handlers/pagerduty.rb, line 31
def respond_to_missing?(method, include_private = false)
  COMMANDS.map { |i| i['method'] }.include?(method) || super
end
store() click to toggle source
# File lib/lita/handlers/pagerduty.rb, line 44
def store
  @store ||= Store.new(redis)
end