Class: Sink::PageCursorNestedItems
- Inherits:
-
Object
- Object
- Sink::PageCursorNestedItems
show all
- Defined in:
- lib/sink/page_cursor_nested_items.rb
Defined Under Namespace
Classes: Data, ObjectProp
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#cursor ⇒ String
35
36
37
|
# File 'lib/sink/page_cursor_nested_items.rb', line 35
def cursor
@cursor
end
|
32
33
34
|
# File 'lib/sink/page_cursor_nested_items.rb', line 32
def data
@data
end
|
38
39
40
|
# File 'lib/sink/page_cursor_nested_items.rb', line 38
def object_prop
@object_prop
end
|
Instance Method Details
#auto_paging_each(&blk) ⇒ nil
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/sink/page_cursor_nested_items.rb', line 67
def auto_paging_each(&blk)
if !blk
raise "A block must be given to #auto_paging_each"
end
page = self
loop do
page.items.each { |e| blk.call(e) }
break if !page.next_page?
page = page.next_page
end
end
|
#inspect ⇒ Object
80
81
82
|
# File 'lib/sink/page_cursor_nested_items.rb', line 80
def inspect
"#<#{selfl.class}:0x#{object_id.to_s(16)} data=#{data.inspect} cursor=#{cursor.inspect} object_prop=#{object_prop.inspect}>"
end
|
59
60
61
62
63
64
|
# File 'lib/sink/page_cursor_nested_items.rb', line 59
def next_page
if !next_page?
raise "No more pages available; please check #next_page? before calling #next_page"
end
client.request(Util.deep_merge(req, {query: {cursor: cursor}}), opts)
end
|
#next_page? ⇒ Boolean
54
55
56
|
# File 'lib/sink/page_cursor_nested_items.rb', line 54
def next_page?
!cursor.nil?
end
|