lib/telegram/bot/api.rb in telegram-bot-ruby-0.4.1 vs lib/telegram/bot/api.rb in telegram-bot-ruby-0.4.2
- old
+ new
@@ -38,9 +38,16 @@
endpoint = camelize(endpoint) if endpoint.include?('_')
ENDPOINTS.include?(endpoint) ? call(endpoint, *args) : super
end
+ def respond_to_missing?(*args)
+ method_name = args[0].to_s
+ method_name = camelize(method_name) if method_name.include?('_')
+
+ ENDPOINTS.include?(method_name) || super
+ end
+
def call(endpoint, raw_params = {})
params = build_params(raw_params)
response = self.class.post("/bot#{token}/#{endpoint}", query: params)
if response.code == 200
response.to_hash