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.



253
254
255
256
# File 'lib/canvas-api.rb', line 253

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

Instance Attribute Details

Returns the value of attribute link.



258
259
260
# File 'lib/canvas-api.rb', line 258

def link
  @link
end

#next_endpointObject

Returns the value of attribute next_endpoint.



257
258
259
# File 'lib/canvas-api.rb', line 257

def next_endpoint
  @next_endpoint
end

Instance Method Details

#more?Boolean

Returns:

  • (Boolean)


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

def more?
  !!next_endpoint
end

#next_page!Object



264
265
266
267
268
269
270
271
# File 'lib/canvas-api.rb', line 264

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