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

Constants included from Resource

Resource::COERCIONS

Instance Attribute Summary

Attributes included from Resource

#client, #default_locale, #properties, #raw_object, #request

Instance Method Summary collapse

Methods included from Resource

#array?, #fields, #initialize, #inspect, #nested_locale_fields?, #sys

Instance Method Details

#properties_to_hashObject



19
20
21
22
23
# File 'lib/contentful/management/validation.rb', line 19

def properties_to_hash
  properties.each_with_object({}) do |(key, value), results|
    results[key] = value if Field.value_exists?(value)
  end
end

#typeObject

Returns type of validation



26
27
28
29
30
# File 'lib/contentful/management/validation.rb', line 26

def type
  properties.keys.each do |type|
    return type if !self.send(Support.snakify(type)).nil?
  end
end