Class: OnyxMesh::Page

Inherits:
ResponseObject show all
Includes:
Enumerable
Defined in:
lib/onyx_mesh/page.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ResponseObject

#[], #[]=, #to_h, #to_json

Constructor Details

#initialize(raw_attribs, translate) ⇒ Page

Returns a new instance of Page.



25
26
27
28
# File 'lib/onyx_mesh/page.rb', line 25

def initialize(raw_attribs, translate)
  super(raw_attribs)
  @items = (@items || []).map { |i| translate.call(i) }
end

Instance Attribute Details

#cursor ⇒ String (readonly)

String encoding the query object to request the next page of items.

Returns:

  • (String)


18
# File 'lib/onyx_mesh/page.rb', line 18

attrib :cursor

#items ⇒ Array (readonly)

List of items.

Returns:

  • (Array)


13
# File 'lib/onyx_mesh/page.rb', line 13

attrib :items

#last_page ⇒ Boolean (readonly)

Indicator of whether there are more pages to load.

Returns:

  • (Boolean)


23
# File 'lib/onyx_mesh/page.rb', line 23

attrib :last_page

Instance Method Details

#each ⇒ Object



30
31
32
33
34
# File 'lib/onyx_mesh/page.rb', line 30

def each
  @items.each do |item|
    yield item
  end
end