Class: WCC::Media::Base

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ActiveRecordShim

included

Methods included from Cacheable

#cache_key, hash_cache_key, #last_modified

Constructor Details

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

Returns a new instance of Base.



14
15
16
17
# File 'lib/wcc/media/base.rb', line 14

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

Instance Attribute Details

#headersObject (readonly)

Returns the value of attribute headers.



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

def headers
  @headers
end

#rawObject (readonly)

Returns the value of attribute raw.



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

def raw
  @raw
end

Instance Method Details



27
28
29
# File 'lib/wcc/media/base.rb', line 27

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

#idObject



19
20
21
# File 'lib/wcc/media/base.rb', line 19

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

#legacy_idObject



23
24
25
# File 'lib/wcc/media/base.rb', line 23

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