lib/wcc/media/series.rb in wcc-media-client-0.1.1 vs lib/wcc/media/series.rb in wcc-media-client-0.2.0

- old
+ new

@@ -1,42 +1,45 @@ -module WCC - module Media - class Series - include WCC::Media::Cacheable +require_relative 'base' - attr_reader :raw, :headers +class WCC::Media::Series < WCC::Media::Base + active_record_shim do + filters %w[ + begin_on_or_before_date + begin_on_or_after_date + end_on_or_before_date + end_on_or_after_date + tag_id + speaker_id + scripture_book_id + title_like + legacy_id + ] + end - def initialize(raw, headers = {}) - @raw = raw - @headers = headers - end + def id + raw['id']&.to_s + end - def id - raw['id']&.to_s - end + def legacy_id + raw['legacy_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[ - 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 + %w[ + images + ].each do |att| + define_method att do + OpenStruct.new(raw[att]) if raw[att] end end end