Module: Telegram::Bot::Types::Response
- Defined in:
- lib/telegram/bot/types/response.rb
Constant Summary collapse
- WRAPPED_METHODS =
{ # Generated with bin/fetch-telegram-methods # Bot API 3.5. getUpdates: [Update], # setWebhook # deleteWebhook getWebhookInfo: WebhookInfo, getMe: User, sendMessage: Message, forwardMessage: Message, sendPhoto: Message, sendAudio: Message, sendDocument: Message, sendVideo: Message, sendVoice: Message, sendVideoNote: Message, sendMediaGroup: Message, sendLocation: Message, editMessageLiveLocation: Message, # or true stopMessageLiveLocation: Message, # or true sendVenue: Message, sendContact: Message, # sendChatAction getUserProfilePhotos: UserProfilePhotos, getFile: File, # kickChatMember # unbanChatMember # restrictChatMember # promoteChatMember # exportChatInviteLink # setChatPhoto # deleteChatPhoto # setChatTitle # setChatDescription # pinChatMessage # unpinChatMessage # leaveChat getChat: Chat, getChatAdministrators: [ChatMember], # getChatMembersCount getChatMember: ChatMember, # setChatStickerSet # deleteChatStickerSet # answerCallbackQuery editMessageText: Message, # or true editMessageCaption: Message, # or true editMessageReplyMarkup: Message, # or true # deleteMessage sendSticker: Message, getStickerSet: StickerSet, uploadStickerFile: File, # createNewStickerSet # addStickerToSet # setStickerPositionInSet # deleteStickerFromSet # answerInlineQuery sendInvoice: Message, # answerShippingQuery # answerPreCheckoutQuery sendGame: Message, setGameScore: Message, # or true getGameHighScores: [GameHighScore], }.freeze
Class Method Summary collapse
-
.wrap(object, type) ⇒ Object
Wraps response with a given type.
Class Method Details
.wrap(object, type) ⇒ Object
Wraps response with a given type. There are some methods that can return either object ot true, so it bypasses true value as is.
82 83 84 85 86 87 88 89 90 |
# File 'lib/telegram/bot/types/response.rb', line 82 def wrap(object, type) return object if object == true if type.is_a?(::Array) type = type.first object.map { |x| type.new(x) } else type.new(object) end end |