Sha256: 8cfa69932212bb42ab786b895e7b9cb89e1092749fb8fed2d51ae653b98aa3fd
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
require_relative 'cacheable' module WCC module Media class Message include WCC::Media::Cacheable attr_reader :raw, :headers def initialize(raw, headers = {}) @raw = raw @headers = headers end def id raw['id']&.to_s end def legacy_id raw['legacy_id']&.to_s end %w[ date title description series_position ].each do |att| define_method att do raw[att] end end def speakers (raw['speakers'] || []).map { |val| Speaker.new(val) } end def tags (raw['tags'] || []).map { |val| Tag.new(val) } end %w[ scripture_references downloads ].each do |att| define_method att do (raw[att] || []).map { |val| OpenStruct.new(val) } end end def series Series.new(raw['series']) if raw['series'] end %w[ embeds assets images external_urls transcript ].each do |att| define_method att do OpenStruct.new(raw[att]) if raw[att] end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wcc-media-client-0.1.1 | lib/wcc/media/message.rb |