Class: Konsierge::Notifier::Adapters::Telegram
- Inherits:
-
BaseAdapter
- Object
- BaseAdapter
- Konsierge::Notifier::Adapters::Telegram
- Defined in:
- lib/konsierge/notifier/adapters/telegram.rb
Constant Summary collapse
- TELEGRAM_CHAT_ID_NOT_SET =
'Telegram Chat ID is not set'- TELEGRAM_BOT_ERROR =
'TelegramBot Error: %s'- TELEGRAM_BOT_DISABLED =
'TelegramBot is disabled! Message not sent.'- PATH_OR_CHAT_ID_NOT_PROVIDED =
'Please, provide path and chat_id'
Instance Method Summary collapse
- #send_error(error, context: {}, source: nil, **options) ⇒ Object
- #send_message(message, context: {}, **options) ⇒ Object
Instance Method Details
#send_error(error, context: {}, source: nil, **options) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/konsierge/notifier/adapters/telegram.rb', line 33 def send_error(error, context: {}, source: nil, **) chat_id = .delete(:chat_id) template_params = { app_name: Notifier.config.app_name, error: error, source: source, context: context } ( path: Notifier.config.error_template_path, chat_id: chat_id, template_params: template_params ) end |
#send_message(message, context: {}, **options) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/konsierge/notifier/adapters/telegram.rb', line 17 def (, context: {}, **) chat_id = .delete(:chat_id) template_params = { app_name: Notifier.config.app_name, message: , context: context } ( path: Notifier.config., chat_id: chat_id, template_params: template_params ) end |