module Telegram::Bot::Client::ApiHelper

Constants

METHODS_LIST_FILE

Public Class Methods

define_helpers(*list) click to toggle source

Defines method with underscored name to post to specific endpoint:

define_method :getMe
# defines #get_me
# File lib/telegram/bot/client/api_helper.rb, line 20
def define_helpers(*list)
  list.map(&:to_s).each do |method|
    define_method(method.underscore) { |*args| request(method, *args) }
  end
end
methods_list(file = METHODS_LIST_FILE) click to toggle source
# File lib/telegram/bot/client/api_helper.rb, line 10
def methods_list(file = METHODS_LIST_FILE)
  File.read(file).lines.
    map(&:strip).
    reject { |x| x.empty? || x.start_with?('#') }
end