# frozen_string_literal: true module WCC::Blogs class CollectionSummary extend WCC::Blogs::Utils attr_reader :raw def initialize(raw, client: WCC::Blogs.client) @raw = raw @client = client end define_camelcase_alias( 'key', 'title' ) do |camelcase| raw[camelcase] end def posts @posts ||= (raw['posts'] || []).map do |summary| WCC::Blogs::LinkedBlogPostSummary.new(summary, client: @client) end end end end