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