Class: Contentful::Array

Inherits:
Object
  • Object
show all
Includes:
Resource, Resource::ArrayLike, Resource::SystemProperties
Defined in:
lib/contentful/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, #default_locale, #properties, #raw, #request

Instance Method Summary collapse

Methods included from Resource::ArrayLike

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

Methods included from Resource

#array?, #fields, #localized?, #reload, #sys

Instance Method Details

#next_pageContentful::Array, false

Simplifies pagination

Returns:



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

def next_page
  if request
    new_skip    = (skip || 0) + (limit || DEFAULT_LIMIT)
    new_request = request.copy
    new_request.query[:skip] = new_skip
    new_request.get
  else
    false
  end
end