Class: NaranyaEcm::Content
- Inherits:
-
Object
- Object
- NaranyaEcm::Content
- Includes:
- AASM, AASM::Persistence::NContentRestPersistence, Behaviors::MediaMethods, Behaviors::Timestampable, Search::Methods
- Defined in:
- lib/naranya_ecm/models/content.rb
Overview
Represents a Content unit in the Naranya CaaS Service
A content unit is made of by a list of some required attributes, along with any non-required attributes.
Attributes List
Required Attributes
In order to create a Content Unit, the Content Object should contain at least the following attributes:
-
lifecycle_name:
Indicates whether the Content object follows asimple
lifecycle, avalidatable
lifecycle (can’t publish without some sort of editorial validation first), or any other significant lifecycle. -
title_translations:
At least one localized title is required. This attribute is a Hash-like object, requiring the locale name as a key, and the localized string as value. -
author:
This string represents the name of the author of the content.
Other significant attributes
The Naranya CaaS Service is prepared to manage and gives meaning to the following attributes:
-
type:
The type of content. Aids the client application in determining how to display and manage the content. -
description_translations:
Localizable descriptions of the Content. -
content_rating:
-
keywords:
Array containing a list of keywords -
main_url:
The main URL pointing to the content AS DISPLAYED BY THE CLIENT APP.
Associations
-
category:
-
versions:
-
current_version:
-
latest_version:
-
media_resources:
Instance Method Summary collapse
-
#author ⇒ Object
:attr: author.
-
#category ⇒ Object
:attr: category :category: Associations.
-
#content_rating ⇒ Object
:attr: content_rating.
-
#current_version ⇒ Object
:attr: current_version :category: Associations.
-
#description ⇒ Object
:attr: description.
-
#keywords ⇒ Object
:attr: keywords.
-
#latest_version ⇒ Object
:attr: latest_version :category: Associations.
-
#lifecycle_name ⇒ Object
:attr: lifecycle_name.
-
#lifecycle_state ⇒ Object
:method: deactivate! :call-seq: deactivate! => true or Error.
-
#main_url ⇒ Object
:attr: main_url.
-
#media_resources ⇒ Object
:attr: media_resources :category: Associations.
-
#simple_lifecycle? ⇒ Boolean
:method: simple_lifecycle? :call-seq: simple_lifecycle? => true or false.
-
#title ⇒ Object
:attr: title.
-
#type ⇒ Object
:attr: type.
-
#validatable_lifecycle? ⇒ Boolean
:method: validatable_lifecycle? :call-seq: validatable_lifecycle? => true or false.
-
#versions ⇒ Object
:attr: versions :category: Associations.
Methods included from AASM::Persistence::NContentRestPersistence
Methods included from Behaviors::MediaMethods
#detect_media_by_roles, #detect_media_url_by_roles, #find_media_by_role, #find_media_url_by_role, #select_media_by_role, #select_media_by_roles, #select_media_urls_by_role, #select_media_urls_by_roles
Methods included from Search::Methods
Instance Method Details
#author ⇒ Object
:attr: author
Author: The name of the user who created this content.
122 |
# File 'lib/naranya_ecm/models/content.rb', line 122 field :author, type: String |
#category ⇒ Object
:attr: category :category: Associations
The category to which the Content belongs.
138 |
# File 'lib/naranya_ecm/models/content.rb', line 138 belongs_to :category |
#content_rating ⇒ Object
:attr: content_rating
Hash-like object containing all the localized content ratings, with the rating system as a Key, and the corresponding ratin object as value.
109 |
# File 'lib/naranya_ecm/models/content.rb', line 109 field :content_rating, type: Hash |
#current_version ⇒ Object
:attr: current_version :category: Associations
The ContentVersion object marked as current. It must be published.
152 |
# File 'lib/naranya_ecm/models/content.rb', line 152 belongs_to :current_version, class_name: :ContentVersion |
#description ⇒ Object
:attr: description
The localized content description that can be displayed as header, result, etc.
98 |
# File 'lib/naranya_ecm/models/content.rb', line 98 field :description, type: String, localize: true |
#keywords ⇒ Object
:attr: keywords
Array containing a list of keywords
115 |
# File 'lib/naranya_ecm/models/content.rb', line 115 field :keywords, type: Array |
#latest_version ⇒ Object
:attr: latest_version :category: Associations
The ContentVersion object marked as latest.
159 |
# File 'lib/naranya_ecm/models/content.rb', line 159 belongs_to :latest_version, class_name: :ContentVersion |
#lifecycle_name ⇒ Object
:attr: lifecycle_name
Determines the lifecycle for the specific content:
-
simple:
draft -> published -> deactivated -
validatable:
draft -> awaiting_acceptance -> accepted -> published -> deactivated -
expirable:
draft -> published -> expired/inactive
65 |
# File 'lib/naranya_ecm/models/content.rb', line 65 field :lifecycle_name, type: String, default: -> { 'simple' } |
#lifecycle_state ⇒ Object
:method: deactivate! :call-seq:
deactivate! => true or Error
Same as #deactivate, but raises an error if the transition did not complete.
79 |
# File 'lib/naranya_ecm/models/content.rb', line 79 field :lifecycle_state, type: String, default: -> { :draft } |
#main_url ⇒ Object
:attr: main_url
Main URL: The URL that should be used to render or display the content.
130 |
# File 'lib/naranya_ecm/models/content.rb', line 130 field :main_url, type: String |
#media_resources ⇒ Object
:attr: media_resources :category: Associations
A list of MediaResource objects associated directly to the Content.
166 |
# File 'lib/naranya_ecm/models/content.rb', line 166 has_many :media_resources, class_name: :MediaResource, inverse_of: :content |
#simple_lifecycle? ⇒ Boolean
:method: simple_lifecycle? :call-seq:
simple_lifecycle? => true or false
Shows whether the Content object has a simple lifecycle.
290 291 292 |
# File 'lib/naranya_ecm/models/content.rb', line 290 def simple_lifecycle? self.lifecycle_name == 'simple' end |
#title ⇒ Object
:attr: title
The content title that can be displayed as header, result, etc.
86 |
# File 'lib/naranya_ecm/models/content.rb', line 86 field :title, type: String, localize: true |
#type ⇒ Object
:attr: type
Describes the main type of the content - App, Note, etc.
56 |
# File 'lib/naranya_ecm/models/content.rb', line 56 field :type, type: String |
#validatable_lifecycle? ⇒ Boolean
:method: validatable_lifecycle? :call-seq:
validatable_lifecycle? => true or false
Shows whether the Content object has a validatable lifecycle.
300 301 302 |
# File 'lib/naranya_ecm/models/content.rb', line 300 def validatable_lifecycle? self.lifecycle_name == 'validatable' end |
#versions ⇒ Object
:attr: versions :category: Associations
A list of ContentVersion objects corresponding to changes in a versionable content.
145 |
# File 'lib/naranya_ecm/models/content.rb', line 145 has_many :versions, class_name: :ContentVersion |