Class: Pepito::Handlers::Info
- Inherits:
-
Pepito::Handler
- Object
- Pepito::Handler
- Pepito::Handlers::Info
- Defined in:
- lib/pepito/handlers/info.rb
Overview
Handler to give the bot’s info.
Instance Attribute Summary
Attributes inherited from Pepito::Handler
Instance Method Summary collapse
-
#chat(_source, _match_data) ⇒ Array<String>
Info for the chat.
-
#run ⇒ void
Run the handler.
-
#web(_request, response) ⇒ void
Info for the http api.
Methods inherited from Pepito::Handler
Methods included from Pepito::Handler::ChatRouter
Methods included from Pepito::Handler::HTTPRouter
Constructor Details
This class inherits a constructor from Pepito::Handler
Instance Method Details
#chat(_source, _match_data) ⇒ Array<String>
Info for the chat
33 34 35 36 37 |
# File 'lib/pepito/handlers/info.rb', line 33 def chat(_source, _match_data) strings = [] strings << 'Pepito Version: ' + Pepito::VERSION strings end |
#run ⇒ void
This method returns an undefined value.
Run the handler.
12 13 14 15 |
# File 'lib/pepito/handlers/info.rb', line 12 def run http_route('GET', '/info', :web) chat_route(/^info$/i, :chat, command: true, help: "info -> show bot's info") end |
#web(_request, response) ⇒ void
This method returns an undefined value.
Info for the http api.
21 22 23 24 25 26 27 |
# File 'lib/pepito/handlers/info.rb', line 21 def web(_request, response) response.headers['Content-Type'] = 'application/json' json = MultiJson.dump( pepito_version: Pepito::VERSION ) response.write(json) end |