Class: Pechkin::Connector::Telegram
- Defined in:
- lib/pechkin/connector/telegram.rb
Overview
:nodoc:
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(bot_token, name) ⇒ Telegram
constructor
A new instance of Telegram.
- #send_message(chat_id, message, message_desc) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(bot_token, name) ⇒ Telegram
Returns a new instance of Telegram.
6 7 8 9 10 11 |
# File 'lib/pechkin/connector/telegram.rb', line 6 def initialize(bot_token, name) super() @bot_token = bot_token @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/pechkin/connector/telegram.rb', line 4 def name @name end |
Instance Method Details
#send_message(chat_id, message, message_desc) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/pechkin/connector/telegram.rb', line 13 def (chat_id, , ) = { parse_mode: ['telegram_parse_mode'] || 'HTML' } params = .update(chat_id: chat_id, text: ) response = post_data(method_url('sendMessage'), params) { chat_id: chat_id, code: response.code.to_i, response: response.body } end |