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.



270
271
272
273
# File 'lib/canvas-api.rb', line 270

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

Instance Attribute Details

Returns the value of attribute link.



275
276
277
# File 'lib/canvas-api.rb', line 275

def link
  @link
end

#next_endpointObject

Returns the value of attribute next_endpoint.



274
275
276
# File 'lib/canvas-api.rb', line 274

def next_endpoint
  @next_endpoint
end

Instance Method Details

#more?Boolean

Returns:

  • (Boolean)


277
278
279
# File 'lib/canvas-api.rb', line 277

def more?
  !!next_endpoint
end

#next_page!Object



281
282
283
284
285
286
287
288
# File 'lib/canvas-api.rb', line 281

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