Sha256: e7522d35de8a52b77b3f9604eb3c8ebc6be9d190e99df1ad3587fdc6c94e2b79
Contents?: true
Size: 736 Bytes
Versions: 2
Compression:
Stored size: 736 Bytes
Contents
module Telegram module Bot class Api include HTTParty ENDPOINTS = %w( getMe sendMessage forwardMessage sendPhoto sendAudio sendDocument sendSticker sendVideo sendLocation sendChatAction getUserProfilePhotos getUpdates setWebhook ).freeze attr_reader :token base_uri 'https://api.telegram.org' persistent_connection_adapter def initialize(token) @token = token end def method_missing(method_name, *args, &block) ENDPOINTS.include?(method_name.to_s) ? call(method_name, *args) : super end def call(endpoint, params = {}) self.class.get("/bot#{token}/#{endpoint}", query: params).to_h end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
telegram-bot-ruby-0.2.0 | lib/telegram/bot/api.rb |
telegram-bot-ruby-0.1.0 | lib/telegram/bot/api.rb |