Sha256: f3cc349c1f25479f84ba2f3a03cd258e8a15a1afbd64b2175e34c3427b6a730f
Contents?: true
Size: 845 Bytes
Versions: 18
Compression:
Stored size: 845 Bytes
Contents
require 'active_support/core_ext/string/inflections' module Telegram module Bot class Client module ApiHelper METHODS_LIST_FILE = File.expand_path('../api_methods.txt', __FILE__) class << self def methods_list(file = METHODS_LIST_FILE) File.read(file).lines. map(&:strip). reject { |x| x.empty? || x.start_with?('#') } end # Defines method with underscored name to post to specific endpoint: # # define_method :getMe # # defines #get_me def define_helpers(*list) list.map(&:to_s).each do |method| define_method(method.underscore) { |*args| request(method, *args) } end end end define_helpers(*methods_list) end end end end
Version data entries
18 entries across 18 versions & 1 rubygems