Class: ChatbotHelper::Telegram::Message
- Inherits:
-
BaseResource
- Object
- BaseResource
- ChatbotHelper::Telegram::Message
- Defined in:
- lib/chatbot_helper/telegram/message.rb
Overview
The message resource which represents a Telegram bot API message
Instance Attribute Summary
Attributes inherited from BaseResource
Class Method Summary collapse
- .optional_arrays ⇒ Object
- .optional_fields ⇒ Object
- .optional_objects ⇒ Object
- .required_fields ⇒ Object
- .required_objects ⇒ Object
Methods inherited from BaseResource
#==, #initialize, required_arrays, #to_s, valid_resource!, valid_resource?
Constructor Details
This class inherits a constructor from ChatbotHelper::Telegram::BaseResource
Class Method Details
.optional_arrays ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/chatbot_helper/telegram/message.rb', line 45 def optional_arrays [ { name: 'entities', type: ChatbotHelper::Telegram::MessageEntity }, { name: 'photo', type: ChatbotHelper::Telegram::PhotoSize }, { name: 'new_chat_photo', type: ChatbotHelper::Telegram::PhotoSize } ] end |
.optional_fields ⇒ Object
10 11 12 13 14 15 |
# File 'lib/chatbot_helper/telegram/message.rb', line 10 def optional_fields %w[forward_from_message_id forward_date edit_date text caption new_chat_title delete_chat_photo group_chat_created supergroup_chat_created channel_chat_created migrate_to_chat_id migrate_from_chat_id] end |
.optional_objects ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/chatbot_helper/telegram/message.rb', line 23 def optional_objects [ { name: 'from', type: ChatbotHelper::Telegram::User }, { name: 'forward_from', type: ChatbotHelper::Telegram::User }, { name: 'forward_from_chat', type: ChatbotHelper::Telegram::Chat }, { name: 'reply_to_message', type: ChatbotHelper::Telegram::Message }, { name: 'audio', type: ChatbotHelper::Telegram::Audio }, { name: 'document', type: ChatbotHelper::Telegram::Document }, { name: 'game', type: ChatbotHelper::Telegram::Game }, { name: 'sticker', type: ChatbotHelper::Telegram::Sticker }, { name: 'video', type: ChatbotHelper::Telegram::Video }, { name: 'voice', type: ChatbotHelper::Telegram::Voice }, { name: 'contact', type: ChatbotHelper::Telegram::Contact }, { name: 'location', type: ChatbotHelper::Telegram::Location }, { name: 'venue', type: ChatbotHelper::Telegram::Venue }, { name: 'new_chat_member', type: ChatbotHelper::Telegram::User }, { name: 'left_chat_member', type: ChatbotHelper::Telegram::User }, { name: 'pinned_message', type: ChatbotHelper::Telegram::Message } ] end |
.required_fields ⇒ Object
6 7 8 |
# File 'lib/chatbot_helper/telegram/message.rb', line 6 def required_fields %w[message_id date] end |
.required_objects ⇒ Object
17 18 19 20 21 |
# File 'lib/chatbot_helper/telegram/message.rb', line 17 def required_objects [ { name: 'chat', type: ChatbotHelper::Telegram::Chat } ] end |