class Lita::Handlers::AlertlogicCustomer

Alert Logic Customer Routes

Public Instance Methods

customer_info(response) click to toggle source

Customer Info Definition

# File lib/lita/handlers/alertlogic_customer.rb, line 30
def customer_info(response)
  customer = response.match_data[1]
  return response.reply(t('validation.customer_id')) if customer.nil?
  response.reply(t('warn.standby'))

  customers   = []
  customer_id = process_customer_id(customer.strip)

  if customer_id.is_a? Array
    customer_id.each do |cid|
      params = {
        customer_id: cid,
        type:        'customer'
      }
      customers << api_call(params)
    end
  else
    params = {
      customer_id: customer_id,
      type:        'customer'
    }
    customers = api_call(params)
  end

  reply_text = process_customers(customers)
  response.reply(reply_text.to_s)
end