Sha256: d0a37e182ae635b51fed56cb2ffd4a8d1509ddf403111a2b5e44beabeb94129d

Contents?: true

Size: 872 Bytes

Versions: 12

Compression:

Stored size: 872 Bytes

Contents

require_relative 'resource'
require_relative 'resource/array_like'

module Contentful
  # Wrapper Class for Sync results
  class SyncPage
    attr_reader :sync

    include Contentful::Resource
    include Contentful::Resource::SystemProperties
    include Contentful::Resource::ArrayLike

    property :items
    property :nextSyncUrl
    property :nextPageUrl

    # Requests next sync page from API
    #
    # @return [Contentful::SyncPage, void]
    def next_page
      sync.get(next_page_url) if next_page?
    end

    # Returns wether there is a next sync page
    #
    # @return [Boolean]
    def next_page?
      # rubocop:disable Style/DoubleNegation
      !!next_page_url
      # rubocop:enable Style/DoubleNegation
    end

    # Returns wether it is the last sync page
    #
    # @return [Boolean]
    def last_page?
      !next_page_url
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
contentful-1.2.2 lib/contentful/sync_page.rb
contentful-1.2.1 lib/contentful/sync_page.rb
contentful-1.2.0 lib/contentful/sync_page.rb
contentful-1.1.1 lib/contentful/sync_page.rb
contentful-1.1.0 lib/contentful/sync_page.rb
contentful-1.0.2 lib/contentful/sync_page.rb
contentful-1.0.1 lib/contentful/sync_page.rb
contentful-1.0.0 lib/contentful/sync_page.rb
contentful-0.12.0 lib/contentful/sync_page.rb
contentful-0.11.0 lib/contentful/sync_page.rb
contentful-0.10.0 lib/contentful/sync_page.rb
contentful-0.9.0 lib/contentful/sync_page.rb