lib/telegram/bot/client.rb in telegram-bot-0.16.1 vs lib/telegram/bot/client.rb in telegram-bot-0.16.3

- old
+ new

@@ -1,13 +1,15 @@ +# frozen_string_literal: true + require 'active_support/core_ext/hash/keys' require 'httpclient' module Telegram module Bot class Client - SERVER = 'https://api.telegram.org'.freeze - URL_TEMPLATE = '%<server>s/bot%<token>s/'.freeze + SERVER = 'https://api.telegram.org' + URL_TEMPLATE = '%<server>s/bot%<token>s/' autoload :RequestBodyFormatter, 'telegram/bot/client/request_body_formatter' autoload :TypedResponse, 'telegram/bot/client/typed_response' prepend Async @@ -39,10 +41,10 @@ def prepare_async_args(action, body = {}) [action.to_s, Async.prepare_hash(RequestBodyFormatter.format(body, action))] end def error_for_response(response) - result = JSON.parse(response.body) rescue nil # rubocop:disable RescueModifier + result = JSON.parse(response.body) rescue nil # rubocop:disable Style/RescueModifier return Error.new(response.reason) unless result message = result['description'] || '-' # This errors are raised only for valid responses from Telegram case response.status when 403 then Forbidden.new(message)