Class: WCC::Media::Base

Inherits:
Object
  • Object
show all
Includes:
ActiveRecordShim, Cacheable
Defined in:
lib/wcc/media/base.rb

Direct Known Subclasses

Message, Series, Speaker, Tag

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ActiveRecordShim

included

Methods included from Cacheable

#cache_key, hash_cache_key

Constructor Details

#initialize(raw, headers = {}) ⇒ Base

Returns a new instance of Base.



12
13
14
15
# File 'lib/wcc/media/base.rb', line 12

def initialize(raw, headers = {})
  @raw = raw
  @headers = headers
end

Instance Attribute Details

#headersObject (readonly)

Returns the value of attribute headers.



10
11
12
# File 'lib/wcc/media/base.rb', line 10

def headers
  @headers
end

#rawObject (readonly)

Returns the value of attribute raw.



10
11
12
# File 'lib/wcc/media/base.rb', line 10

def raw
  @raw
end

Instance Method Details



25
26
27
# File 'lib/wcc/media/base.rb', line 25

def _links
  OpenStruct.new(raw['_links']) if raw['_links']
end

#idObject



17
18
19
# File 'lib/wcc/media/base.rb', line 17

def id
  raw['id']&.to_s
end

#legacy_idObject



21
22
23
# File 'lib/wcc/media/base.rb', line 21

def legacy_id
  raw['legacy_id']&.to_s
end