class Freefeed::Exceptions::ResponseError

Attributes

response[R]

Public Class Methods

new(response) click to toggle source
# File lib/freefeed/exceptions.rb, line 6
def initialize(response)
  @response = response
end

Public Instance Methods

to_s() click to toggle source
Calls superclass method
# File lib/freefeed/exceptions.rb, line 10
def to_s
  super + format(' (%s)', data.map { |k, v| %(#{k}: "#{v}") }.join(', '))
end

Private Instance Methods

data() click to toggle source
# File lib/freefeed/exceptions.rb, line 16
def data
  @data ||= begin
    MultiJson.load(response.body)
  rescue MultiJson::DecodeError
    { uri: response.env.url.to_s, errors: response.body.to_s }
  end.merge(code: response.status)
end