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
#archived? ⇒ Boolean
49
50
51
|
# File 'lib/wcc/media/message.rb', line 49
def archived?
raw.dig('flags', 'archived') || false
end
|
#has_audio? ⇒ Boolean
rubocop:disable Naming/PredicateName
102
103
104
105
|
# File 'lib/wcc/media/message.rb', line 102
def has_audio? assets.each_pair
.any? { |k, v| /^audio/.match(k) && v && !v.empty? }
end
|
#has_video? ⇒ Boolean
rubocop:disable Naming/PredicateName
97
98
99
100
|
# File 'lib/wcc/media/message.rb', line 97
def has_video? assets.each_pair
.any? { |k, v| /video/.match(k) && v && !v.empty? }
end
|
#hide_from_internal_search ⇒ Object
45
46
47
|
# File 'lib/wcc/media/message.rb', line 45
def hide_from_internal_search
raw.dig('flags', 'hide_from_internal_search') || false
end
|
#playlists ⇒ Object
57
58
59
|
# File 'lib/wcc/media/message.rb', line 57
def playlists
(raw['playlists'] || []).map { |val| WCC::Media::Playlist.new(val) }
end
|
#series ⇒ Object
74
75
76
|
# File 'lib/wcc/media/message.rb', line 74
def series
WCC::Media::Series.new(raw['series']) if raw['series']
end
|
#speakers ⇒ Object
53
54
55
|
# File 'lib/wcc/media/message.rb', line 53
def speakers
(raw['speakers'] || []).map { |val| WCC::Media::Speaker.new(val) }
end
|
61
62
63
|
# File 'lib/wcc/media/message.rb', line 61
def tags
(raw['tags'] || []).map { |val| WCC::Media::Tag.new(val) }
end
|
#to_param ⇒ Object
107
108
109
|
# File 'lib/wcc/media/message.rb', line 107
def to_param
"#{id}-#{slug}"
end
|