Class: Contentful::Management::Array

Inherits:
Object
  • Object
show all
Includes:
Resource, Resource::ArrayLike, Resource::SystemProperties
Defined in:
lib/contentful/management/array.rb

Overview

Note:

It also provides an #each method and includes Ruby’s Enumerable module (gives you methods like #min, #first, etc)

Resource Class for Arrays (e.g. search results)

See Also:

  • https://www.contentful.com/developers/documentation/content-delivery-api/#arrays

Instance Attribute Summary

Attributes included from Resource::SystemProperties

#sys

Attributes included from Resource

#client, #properties, #raw_object, #request

Instance Method Summary collapse

Methods included from Resource::ArrayLike

#array?, #each_item, #empty?, #size

Methods included from Resource

#array?, #default_locale, #destroy, #environment_id, #fields, #nested_locale_fields?, #resource?, #save, #sys, #update

Instance Method Details

#next_pageObject

Simplifies pagination



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/contentful/management/array.rb', line 25

def next_page
  if request
    new_skip = (skip || 0) + (limit || DEFAULT_LIMIT)
    new_request = request.copy
    new_request.instance_variable_set(:@query, {}) if new_request.query.nil?
    new_request.query[:skip] = new_skip
    response = new_request.get
    ResourceBuilder.new(response, client).run
  else
    false
  end
end