Sha256: 423adc9aada4b572aa76838e602ef49e797ba178cf1ce0b9c3f5052f832408ec

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

require 'lita'
# Lita Module
module Lita
  # Plugin type Handler
  module Handlers
    # Alert Logic Incident routes
    class AlertlogicIncidents < Handler
      config :api_auth
      config :lm_api_url
      config :tm_api_url
      config :customer_api_url
      config :incident_api_url
      config :customer_id
      config :http_options, required: false, type: Hash, default: {}

      namespace 'Alertlogic'

      include ::AlertlogicHelper::Api
      include ::AlertlogicHelper::Common
      include ::AlertlogicHelper::Customer
      include ::AlertlogicHelper::Incidents

      # Route definitions
      # Incidents list route
      route(
        /a(?:lertlogic)? incidents( (.+))?/i,
        :incidents_list,
        help: {
          t('help.incidents.syntax') => t('help.incidents.desc')
        }
      )

      # Customer Info Definition
      def incidents_list(response)
        customer = response.match_data[1]
        return response.reply(t('validation.customer_id')) if customer.nil?
        customer_id = process_customer_id(customer.strip)
        response.reply get_incidents(customer_id)
      end
    end
    Lita.register_handler(AlertlogicIncidents)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lita-alertlogic-0.0.1 lib/lita/handlers/alertlogic_incidents.rb