Class: Pechkin::TelegramConnector
- Defined in:
- lib/pechkin/connector_telegram.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(bot_token, name) ⇒ TelegramConnector
constructor
A new instance of TelegramConnector.
- #send_message(chat_id, message, message_desc) ⇒ Object
Methods inherited from Connector
Constructor Details
#initialize(bot_token, name) ⇒ TelegramConnector
Returns a new instance of TelegramConnector.
5 6 7 8 |
# File 'lib/pechkin/connector_telegram.rb', line 5 def initialize(bot_token, name) @bot_token = bot_token @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/pechkin/connector_telegram.rb', line 3 def name @name end |
Instance Method Details
#send_message(chat_id, message, message_desc) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/pechkin/connector_telegram.rb', line 10 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, response.code.to_i, response.body] end |