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.



163
164
165
166
# File 'lib/canvas-api.rb', line 163

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

Instance Attribute Details

Returns the value of attribute link.



168
169
170
# File 'lib/canvas-api.rb', line 168

def link
  @link
end

#next_endpointObject

Returns the value of attribute next_endpoint.



167
168
169
# File 'lib/canvas-api.rb', line 167

def next_endpoint
  @next_endpoint
end

Instance Method Details

#more?Boolean

Returns:

  • (Boolean)


170
171
172
# File 'lib/canvas-api.rb', line 170

def more?
  !!next_endpoint
end

#next_page!Object



174
175
176
177
178
179
180
181
# File 'lib/canvas-api.rb', line 174

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