Class: Renderful::ContentEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/renderful/content_entry.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(provider:, id:, content_type: nil, fields: {}) ⇒ ContentEntry

Returns a new instance of ContentEntry.



13
14
15
16
17
18
# File 'lib/renderful/content_entry.rb', line 13

def initialize(provider:, id:, content_type: nil, fields: {})
  @provider = provider
  @id = id
  @content_type = content_type
  @fields = fields
end

Instance Attribute Details

#content_typeObject (readonly)

Returns the value of attribute content_type.



5
6
7
# File 'lib/renderful/content_entry.rb', line 5

def content_type
  @content_type
end

#fieldsObject (readonly)

Returns the value of attribute fields.



5
6
7
# File 'lib/renderful/content_entry.rb', line 5

def fields
  @fields
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/renderful/content_entry.rb', line 5

def id
  @id
end

#providerObject (readonly)

Returns the value of attribute provider.



5
6
7
# File 'lib/renderful/content_entry.rb', line 5

def provider
  @provider
end

Class Method Details

.build_cache_key(provider, id: nil) ⇒ Object



8
9
10
# File 'lib/renderful/content_entry.rb', line 8

def build_cache_key(provider, id: nil)
  ['renderful', provider.cache_prefix, id || '*'].join('/')
end

Instance Method Details

#cache_keyObject



20
21
22
# File 'lib/renderful/content_entry.rb', line 20

def cache_key
  self.class.build_cache_key(provider, id: id)
end