Class: WCC::Media::Message

Inherits:
Base
  • Object
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

Methods included from ActiveRecordShim

included

Methods included from Cacheable

#cache_key, hash_cache_key, #last_modified

Constructor Details

This class inherits a constructor from WCC::Media::Base

Instance Method Details

#has_audio?Boolean

rubocop:disable Naming/PredicateName

Returns:

  • (Boolean)


93
94
95
96
# File 'lib/wcc/media/message.rb', line 93

def has_audio? # rubocop:disable Naming/PredicateName
  assets.each_pair
        .any? { |k, v| /^audio/.match(k) && v && !v.empty? }
end

#has_video?Boolean

rubocop:disable Naming/PredicateName

Returns:

  • (Boolean)


88
89
90
91
# File 'lib/wcc/media/message.rb', line 88

def has_video? # rubocop:disable Naming/PredicateName
  assets.each_pair
        .any? { |k, v| /video/.match(k) && v && !v.empty? }
end

#hide_from_internal_searchObject



41
42
43
# File 'lib/wcc/media/message.rb', line 41

def hide_from_internal_search
  raw['flags']['hide_from_internal_search'] || false
end

#playlistsObject



49
50
51
# File 'lib/wcc/media/message.rb', line 49

def playlists
  (raw['playlists'] || []).map { |val| WCC::Media::Playlist.new(val) }
end

#seriesObject



66
67
68
# File 'lib/wcc/media/message.rb', line 66

def series
  WCC::Media::Series.new(raw['series']) if raw['series']
end

#speakersObject



45
46
47
# File 'lib/wcc/media/message.rb', line 45

def speakers
  (raw['speakers'] || []).map { |val| WCC::Media::Speaker.new(val) }
end

#tagsObject



53
54
55
# File 'lib/wcc/media/message.rb', line 53

def tags
  (raw['tags'] || []).map { |val| WCC::Media::Tag.new(val) }
end

#to_paramObject



98
99
100
# File 'lib/wcc/media/message.rb', line 98

def to_param
  "#{id}-#{slug}"
end