Class: Contentful::Management::Array

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

Overview

Resource Class for Arrays (e.g. search results) www.contentful.com/developers/documentation/content-delivery-api/#arrays It also provides an #each method and includes Ruby’s Enumerable module (gives you methods like #min, #first, etc)

Constant Summary collapse

DEFAULT_LIMIT =
100

Constants included from Resource::SystemProperties

Resource::SystemProperties::SYS_COERCIONS

Constants included from Resource

Resource::COERCIONS

Instance Attribute Summary

Attributes included from Resource::SystemProperties

#sys

Attributes included from Resource

#client, #default_locale, #properties, #raw_object, #request

Instance Method Summary collapse

Methods included from Resource::ArrayLike

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

Methods included from Resource::SystemProperties

included, #initialize, #inspect

Methods included from Resource

#array?, #fields, #initialize, #inspect, #nested_locale_fields?, #sys

Instance Method Details

#next_pageObject

Simplifies pagination



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

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