Class: Canvas::ResultSet

Inherits:
Array
  • Object
show all
Defined in:
lib/canvas/canvas_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api, arr) ⇒ ResultSet



299
300
301
302
# File 'lib/canvas/canvas_api.rb', line 299

def initialize(api, arr)
  @api = api
  super(arr)
end

Instance Attribute Details

Returns the value of attribute link.



305
306
307
# File 'lib/canvas/canvas_api.rb', line 305

def link
  @link
end

#next_endpointObject

Returns the value of attribute next_endpoint.



304
305
306
# File 'lib/canvas/canvas_api.rb', line 304

def next_endpoint
  @next_endpoint
end

Instance Method Details

#more?Boolean



307
308
309
# File 'lib/canvas/canvas_api.rb', line 307

def more?
  !!next_endpoint
end

#next_page!Object



311
312
313
314
315
316
317
318
# File 'lib/canvas/canvas_api.rb', line 311

def next_page!
  ResultSet.new(@api, []) unless next_endpoint
  more = @api.get(next_endpoint)
  concat(more)
  @next_endpoint = more.next_endpoint
  @link = more.link
  more
end