class ExperianAddressValidation::Errors::ResponseError

Attributes

body[R]
status[R]

Public Class Methods

new(status:, body:) click to toggle source
Calls superclass method
# File lib/errors/response_error.rb, line 8
def initialize(status:, body:)
  @status = status
  @body = body

  super(build_message)
end

Private Instance Methods

build_message() click to toggle source
# File lib/errors/response_error.rb, line 17
def build_message
  return status unless body.is_a?(String)

  parsed_body = JSON.parse(body)
  parsed_body["error"] || body
end