lib/telegram/bot/api.rb in telegram-bot-ruby-0.2.1 vs lib/telegram/bot/api.rb in telegram-bot-ruby-0.2.2
- old
+ new
@@ -28,10 +28,15 @@
end
def call(endpoint, raw_params = {})
params = build_params(raw_params)
response = self.class.get("/bot#{token}/#{endpoint}", query: params)
- response.code == 200 ? response.to_h : {}
+ if response.code == 200
+ response.to_h
+ else
+ fail Exceptions::ResponseError.new(response),
+ 'Telegram API has returned the error.'
+ end
end
private
def build_params(h)