class Lita::Handlers::Service

Handles all commands relative to the service

Public Instance Methods

create(response) click to toggle source
# File lib/lita/handlers/service.rb, line 46
def create(response)
  interactor = Interactors::CreateService.new(self, response.match_data).perform
  template = :service_created
  message = { service: interactor.message }
  reply(template, message, response, interactor)
end
delete(response) click to toggle source
# File lib/lita/handlers/service.rb, line 60
def delete(response)
  interactor = Interactors::DeleteService.new(self, response.match_data).perform
  template = :message
  message = { message: interactor.message }
  reply(template, message, response, interactor)
end
list(response) click to toggle source
# File lib/lita/handlers/service.rb, line 39
def list(response)
  interactor = Interactors::ListServices.new(self, response.match_data).perform
  template = :list_services
  message = { services: interactor.message }
  reply(template, message, response, interactor)
end
pong(response) click to toggle source

Callbacks

# File lib/lita/handlers/service.rb, line 35
def pong(response)
  response.reply 'pong!'
end
reply(template, message, response, interactor) click to toggle source
# File lib/lita/handlers/service.rb, line 67
def reply(template, message, response, interactor)
  unless interactor.success?
    template = :error
    message = { error: interactor.error }
  end
  response.reply(render_template(template, message))
end
show(response) click to toggle source
# File lib/lita/handlers/service.rb, line 53
def show(response)
  interactor = Interactors::ShowService.new(self, response.match_data).perform
  template = :service_show
  message = { service: interactor.message }
  reply(template, message, response, interactor)
end