Class: WCC::Media::Message
- Inherits:
-
Base
- Object
- Base
- WCC::Media::Message
show all
- Defined in:
- lib/wcc/media/message.rb
Instance Attribute Summary
Attributes inherited from Base
#headers, #raw
Instance Method Summary
collapse
Methods inherited from Base
#_links, #id, #initialize, #legacy_id
included
Methods included from Cacheable
#cache_key, hash_cache_key, #last_modified
Instance Method Details
#has_audio? ⇒ Boolean
rubocop:disable Naming/PredicateName
93
94
95
96
|
# File 'lib/wcc/media/message.rb', line 93
def has_audio? assets.each_pair
.any? { |k, v| /^audio/.match(k) && v && !v.empty? }
end
|
#has_video? ⇒ Boolean
rubocop:disable Naming/PredicateName
88
89
90
91
|
# File 'lib/wcc/media/message.rb', line 88
def has_video? assets.each_pair
.any? { |k, v| /video/.match(k) && v && !v.empty? }
end
|
#hide_from_internal_search ⇒ Object
41
42
43
|
# File 'lib/wcc/media/message.rb', line 41
def hide_from_internal_search
raw['flags']['hide_from_internal_search'] || false
end
|
#playlists ⇒ Object
49
50
51
|
# File 'lib/wcc/media/message.rb', line 49
def playlists
(raw['playlists'] || []).map { |val| WCC::Media::Playlist.new(val) }
end
|
#series ⇒ Object
66
67
68
|
# File 'lib/wcc/media/message.rb', line 66
def series
WCC::Media::Series.new(raw['series']) if raw['series']
end
|
#speakers ⇒ Object
45
46
47
|
# File 'lib/wcc/media/message.rb', line 45
def speakers
(raw['speakers'] || []).map { |val| WCC::Media::Speaker.new(val) }
end
|
53
54
55
|
# File 'lib/wcc/media/message.rb', line 53
def tags
(raw['tags'] || []).map { |val| WCC::Media::Tag.new(val) }
end
|
#to_param ⇒ Object
98
99
100
|
# File 'lib/wcc/media/message.rb', line 98
def to_param
"#{id}-#{slug}"
end
|