Class: Canvas::ResultSet

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api, arr) ⇒ ResultSet

Returns a new instance of ResultSet.



260
261
262
263
# File 'lib/canvas-api.rb', line 260

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

Instance Attribute Details

Returns the value of attribute link.



265
266
267
# File 'lib/canvas-api.rb', line 265

def link
  @link
end

#next_endpointObject

Returns the value of attribute next_endpoint.



264
265
266
# File 'lib/canvas-api.rb', line 264

def next_endpoint
  @next_endpoint
end

Instance Method Details

#more?Boolean

Returns:

  • (Boolean)


267
268
269
# File 'lib/canvas-api.rb', line 267

def more?
  !!next_endpoint
end

#next_page!Object



271
272
273
274
275
276
277
278
# File 'lib/canvas-api.rb', line 271

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