class Fitting::Response::FullyValidates

Public Class Methods

craft(schemas, body, strict) click to toggle source
# File lib/fitting/response/fully_validates.rb, line 6
def self.craft(schemas, body, strict)
  if schemas
    new(schemas.inject([]) do |res, schema|
      res.push(fully_validate(schema, body, strict))
    end)
  else
    @valid = false
    new
  end
end
fully_validate(schema, body, strict) click to toggle source
# File lib/fitting/response/fully_validates.rb, line 26
def fully_validate(schema, body, strict)
  JSON::Validator.fully_validate(schema, body, strict: strict)
rescue JSON::Schema::UriError
  []
end

Public Instance Methods

to_s() click to toggle source
# File lib/fitting/response/fully_validates.rb, line 21
def to_s
  @to_s ||= join("\n\n")
end
valid?() click to toggle source
# File lib/fitting/response/fully_validates.rb, line 17
def valid?
  @valid ||= any? { |fully_validate| fully_validate == [] }
end