Class: Contentful::Management::Validation

Inherits:
Object
  • Object
show all
Includes:
Resource
Defined in:
lib/contentful/management/validation.rb

Overview

A ContentType’s validations schema

Constant Summary collapse

NON_TYPE_PROPERTIES =

Properties not specific to a field type validation

%i[validations message].freeze

Instance Attribute Summary

Attributes included from Resource

#client, #properties, #raw_object, #request

Instance Method Summary collapse

Methods included from Resource

#array?, #default_locale, #destroy, #environment_id, #fields, #nested_locale_fields?, #resource?, #save, #sys, #update

Instance Method Details

#typeSymbol

Returns type of validation

Returns:

  • (Symbol)


39
40
41
42
43
44
# File 'lib/contentful/management/validation.rb', line 39

def type
  properties.keys.reject { |key| NON_TYPE_PROPERTIES.include?(key) }.each do |type|
    value = send(Support.snakify(type))
    return type if !value.nil? && value
  end
end