class Messenger::Bot::Exceptions::ResponseError
Attributes
response[R]
Public Class Methods
new(response)
click to toggle source
# File lib/messenger/bot/exceptions/response_error.rb, line 7 def initialize(response) @response = response end
Public Instance Methods
error_code()
click to toggle source
# File lib/messenger/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/messenger/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/messenger/bot/exceptions/response_error.rb, line 22 def data @data ||= begin JSON.parse(response.body) rescue JSON::ParserError { error_code: response.code, uri: response.request.last_uri.to_s } end end