Sha256: 1fc787ae25b0ee71ffd867e55e0d3bf13062a3957c885e0be39675d14275037f

Contents?: true

Size: 676 Bytes

Versions: 1

Compression:

Stored size: 676 Bytes

Contents

module WCC
  module Media
    class Series
      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[
        title
        subtitle
        summary
        date_range
        messages_count
      ].each do |att|
        define_method att do
          raw[att]
        end
      end

      %w[
        images
      ].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/series.rb