Sha256: bbc1a20cfe5732aa6b205eb17d8d22e84ccad1dc8203dfb7f5f766e35b2bb745

Contents?: true

Size: 797 Bytes

Versions: 1

Compression:

Stored size: 797 Bytes

Contents

module Harvesting
  module Models
    class HarvestRecordCollection < Base
      include Harvesting::Enumerable
      extend Forwardable

      attributed :per_page,
                 :total_pages,
                 :total_entries,
                 :next_page,
                 :previous_page,
                 :page,
                 :links

      attr_reader :entries

      def initialize(attrs, query_opts = {}, opts = {})
        super(attrs, opts)
        @query_opts = query_opts
        @api_page = attrs
      end

      def page
        @attributes['page']
      end

      def size
        total_entries
      end

      def next_page_query_opts
        @query_opts.merge(page: page + 1)
      end

      def fetch_next_page
        raise NotImplementedError
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
harvesting-0.3.0 lib/harvesting/models/harvest_record_collection.rb