Class: BandwidthIris::PaginatedResult

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/bandwidth-iris/paginated_result.rb

Instance Method Summary collapse

Constructor Details

#initialize(items, links, &block) ⇒ PaginatedResult

Returns a new instance of PaginatedResult.



5
6
7
8
9
# File 'lib/bandwidth-iris/paginated_result.rb', line 5

def initialize(items, links, &block)
  super(items)
  @links = links
  @requestor = block
end

Instance Method Details

#nextObject



11
12
13
14
15
# File 'lib/bandwidth-iris/paginated_result.rb', line 11

def next
  return unless @links[:next]

  @requestor.call(@links[:next].match(/\<([^>]+)\>/)[1].sub(/^http.*\/v1.0/, ""))
end