class Telegram::Bot::Exceptions::ResponseError
Attributes
response[R]
Public Class Methods
new(response)
click to toggle source
# File lib/telegram/bot/exceptions/response_error.rb, line 7 def initialize(response) @response = response end
Public Instance Methods
error_code()
click to toggle source
# File lib/telegram/bot/exceptions/response_error.rb, line 16 def error_code data[:error_code] || data['error_code'] end
to_s()
click to toggle source
Calls superclass method
# File lib/telegram/bot/exceptions/response_error.rb, line 11 def to_s super + format(' (%s)', data.map { |k, v| %(#{k}: "#{v}") }.join(', ')) end
Private Instance Methods
data()
click to toggle source
# File lib/telegram/bot/exceptions/response_error.rb, line 22 def data @data ||= begin JSON.parse(response.body) rescue JSON::ParserError { error_code: response.status, uri: response.env.url.to_s } end end