Class: Contentful::TaxonomyConcept
- Inherits:
-
BaseResource
- Object
- BaseResource
- Contentful::TaxonomyConcept
- Defined in:
- lib/contentful/taxonomy_concept.rb
Overview
Resource class for TaxonomyConcept.
Instance Attribute Summary collapse
-
#broader ⇒ Object
readonly
Returns the value of attribute broader.
-
#concept_schemes ⇒ Object
readonly
Returns the value of attribute concept_schemes.
-
#notations ⇒ Object
readonly
Returns the value of attribute notations.
-
#related ⇒ Object
readonly
Returns the value of attribute related.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Attributes inherited from BaseResource
#_metadata, #default_locale, #raw, #sys
Instance Method Summary collapse
- #alt_labels(locale = nil) ⇒ Object
-
#asset? ⇒ Boolean
Returns false for resources that are not assets.
- #change_note(locale = nil) ⇒ Object
- #definition(locale = nil) ⇒ Object
- #editorial_note(locale = nil) ⇒ Object
-
#entry? ⇒ Boolean
Returns false for resources that are not entries.
- #example(locale = nil) ⇒ Object
- #hidden_labels(locale = nil) ⇒ Object
- #history_note(locale = nil) ⇒ Object
-
#initialize(item) ⇒ TaxonomyConcept
constructor
A new instance of TaxonomyConcept.
- #note(locale = nil) ⇒ Object
-
#pref_label(locale = nil) ⇒ Object
Access localized fields.
- #scope_note(locale = nil) ⇒ Object
-
#taxonomy_concept? ⇒ Boolean
Returns true for resources that are taxonomy concepts.
Methods inherited from BaseResource
#==, #inspect, #marshal_dump, #marshal_load, #reload
Constructor Details
#initialize(item) ⇒ TaxonomyConcept
Returns a new instance of TaxonomyConcept.
9 10 11 12 13 14 15 16 17 |
# File 'lib/contentful/taxonomy_concept.rb', line 9 def initialize(item, *) super @uri = item.fetch('uri', nil) @notations = item.fetch('notations', []) @broader = item.fetch('broader', []) = item.fetch('related', []) @concept_schemes = item.fetch('conceptSchemes', []) end |
Instance Attribute Details
#broader ⇒ Object (readonly)
Returns the value of attribute broader.
7 8 9 |
# File 'lib/contentful/taxonomy_concept.rb', line 7 def broader @broader end |
#concept_schemes ⇒ Object (readonly)
Returns the value of attribute concept_schemes.
7 8 9 |
# File 'lib/contentful/taxonomy_concept.rb', line 7 def concept_schemes @concept_schemes end |
#notations ⇒ Object (readonly)
Returns the value of attribute notations.
7 8 9 |
# File 'lib/contentful/taxonomy_concept.rb', line 7 def notations @notations end |
#related ⇒ Object (readonly)
Returns the value of attribute related.
7 8 9 |
# File 'lib/contentful/taxonomy_concept.rb', line 7 def end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
7 8 9 |
# File 'lib/contentful/taxonomy_concept.rb', line 7 def uri @uri end |
Instance Method Details
#alt_labels(locale = nil) ⇒ Object
41 42 43 44 45 |
# File 'lib/contentful/taxonomy_concept.rb', line 41 def alt_labels(locale = nil) locale ||= default_locale alt_labels = raw.fetch('altLabels', {}) alt_labels.is_a?(Hash) ? alt_labels.fetch(locale.to_s, []) : alt_labels end |
#asset? ⇒ Boolean
Returns false for resources that are not assets
30 31 32 |
# File 'lib/contentful/taxonomy_concept.rb', line 30 def asset? false end |
#change_note(locale = nil) ⇒ Object
59 60 61 62 63 |
# File 'lib/contentful/taxonomy_concept.rb', line 59 def change_note(locale = nil) locale ||= default_locale change_note = raw.fetch('changeNote', {}) change_note.is_a?(Hash) ? change_note.fetch(locale.to_s, '') : change_note end |
#definition(locale = nil) ⇒ Object
65 66 67 68 69 |
# File 'lib/contentful/taxonomy_concept.rb', line 65 def definition(locale = nil) locale ||= default_locale definition = raw.fetch('definition', {}) definition.is_a?(Hash) ? definition.fetch(locale.to_s, '') : definition end |
#editorial_note(locale = nil) ⇒ Object
71 72 73 74 75 |
# File 'lib/contentful/taxonomy_concept.rb', line 71 def editorial_note(locale = nil) locale ||= default_locale editorial_note = raw.fetch('editorialNote', {}) editorial_note.is_a?(Hash) ? editorial_note.fetch(locale.to_s, '') : editorial_note end |
#entry? ⇒ Boolean
Returns false for resources that are not entries
25 26 27 |
# File 'lib/contentful/taxonomy_concept.rb', line 25 def entry? false end |
#example(locale = nil) ⇒ Object
77 78 79 80 81 |
# File 'lib/contentful/taxonomy_concept.rb', line 77 def example(locale = nil) locale ||= default_locale example = raw.fetch('example', {}) example.is_a?(Hash) ? example.fetch(locale.to_s, '') : example end |
#hidden_labels(locale = nil) ⇒ Object
47 48 49 50 51 |
# File 'lib/contentful/taxonomy_concept.rb', line 47 def hidden_labels(locale = nil) locale ||= default_locale hidden_labels = raw.fetch('hiddenLabels', {}) hidden_labels.is_a?(Hash) ? hidden_labels.fetch(locale.to_s, []) : hidden_labels end |
#history_note(locale = nil) ⇒ Object
83 84 85 86 87 |
# File 'lib/contentful/taxonomy_concept.rb', line 83 def history_note(locale = nil) locale ||= default_locale history_note = raw.fetch('historyNote', {}) history_note.is_a?(Hash) ? history_note.fetch(locale.to_s, '') : history_note end |
#note(locale = nil) ⇒ Object
53 54 55 56 57 |
# File 'lib/contentful/taxonomy_concept.rb', line 53 def note(locale = nil) locale ||= default_locale note = raw.fetch('note', {}) note.is_a?(Hash) ? note.fetch(locale.to_s, '') : note end |
#pref_label(locale = nil) ⇒ Object
Access localized fields
35 36 37 38 39 |
# File 'lib/contentful/taxonomy_concept.rb', line 35 def pref_label(locale = nil) locale ||= default_locale pref_label = raw.fetch('prefLabel', {}) pref_label.is_a?(Hash) ? pref_label.fetch(locale.to_s, nil) : pref_label end |
#scope_note(locale = nil) ⇒ Object
89 90 91 92 93 |
# File 'lib/contentful/taxonomy_concept.rb', line 89 def scope_note(locale = nil) locale ||= default_locale scope_note = raw.fetch('scopeNote', {}) scope_note.is_a?(Hash) ? scope_note.fetch(locale.to_s, '') : scope_note end |
#taxonomy_concept? ⇒ Boolean
Returns true for resources that are taxonomy concepts
20 21 22 |
# File 'lib/contentful/taxonomy_concept.rb', line 20 def taxonomy_concept? true end |