class Insights::API::Common::ErrorDocument

Public Instance Methods

add(status = 400, message) click to toggle source
# File lib/insights/api/common/error_document.rb, line 5
def add(status = 400, message)
  @status = status
  safe_message = message.to_s.encode('UTF-8', :invalid => :replace, :undef => :replace)
  errors << {"status" => status, "detail" => safe_message}
  self
end
blank?() click to toggle source
# File lib/insights/api/common/error_document.rb, line 20
def blank?
  errors.blank?
end
errors() click to toggle source
# File lib/insights/api/common/error_document.rb, line 12
def errors
  @errors ||= []
end
status() click to toggle source
# File lib/insights/api/common/error_document.rb, line 16
def status
  @status
end
to_h() click to toggle source
# File lib/insights/api/common/error_document.rb, line 24
def to_h
  {"errors" => errors}
end