Class: WCC::Contentful::Model
- Inherits:
-
Object
- Object
- WCC::Contentful::Model
- Extended by:
- Helpers, ModelValidators
- Defined in:
- lib/wcc/contentful/model.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Menu, MenuButton
Class Attribute Summary collapse
-
.store ⇒ Object
Returns the value of attribute store.
Class Method Summary collapse
Methods included from Helpers
constant_from_content_type, content_type_from_raw, shared_prefix
Methods included from ModelValidators
schema, transform_content_types_for_validation, validate_field, validate_fields
Class Attribute Details
.store ⇒ Object
Returns the value of attribute store.
9 10 11 |
# File 'lib/wcc/contentful/model.rb', line 9 def store @store end |
Class Method Details
.all_models ⇒ Object
12 13 14 |
# File 'lib/wcc/contentful/model.rb', line 12 def self.all_models WCC::Contentful::Model.constants(false).map { |k| WCC::Contentful::Model.const_get(k) } end |
.find(id, context = nil) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/wcc/contentful/model.rb', line 16 def self.find(id, context = nil) return unless raw = store.find(id) content_type = content_type_from_raw(raw) const = WCC::Contentful::Model.const_get(constant_from_content_type(content_type)) const.new(raw, context) end |