Method: Scimitar::Schema::Base.valid?

Defined in:
app/models/scimitar/schema/base.rb

.valid?(resource) ⇒ Boolean

Validates the resource against specific validations of each attribute, for example if the type of the attribute matches the one defined in the schema.

resource

A resource object that uses this schema.

Returns:

  • (Boolean)


27
28
29
30
31
32
33
# File 'app/models/scimitar/schema/base.rb', line 27

def self.valid?(resource)
  cloned_scim_attributes.each do |scim_attribute|
    unless scim_attribute.valid?(resource.send(scim_attribute.name))
      resource.add_errors_from_hash(errors_hash: scim_attribute.errors.to_hash)
    end
  end
end