class Eligible::EligibleError

Attributes

errors[R]
http_body[R]
http_status[R]
json_body[R]
message[R]

Public Class Methods

new(message = nil, http_status = nil, http_body = nil, json_body = nil) click to toggle source
# File lib/eligible/errors/eligible_error.rb, line 9
def initialize(message = nil, http_status = nil, http_body = nil, json_body = nil)
  @message = message
  @http_status = http_status
  @http_body = http_body
  @json_body = json_body
  @errors = (@json_body || {}).fetch(:errors, [])
end

Public Instance Methods

to_s() click to toggle source
# File lib/eligible/errors/eligible_error.rb, line 17
def to_s
  status_string = @http_status.nil? ? '' : "(Status #{@http_status}) "
  "#{status_string}#{@message}: #{@errors.to_json}"
end