class Workable::Collection

Attributes

data[R]

Public Class Methods

new(data:, next_page_method:, transform_mapping:, root_key:, paging: nil) click to toggle source
# File lib/workable/collection.rb, line 8
def initialize(data:, next_page_method:, transform_mapping:, root_key:, paging: nil)
  @data = data

  if paging
    @next_page         = paging['next']
    @next_page_method  = next_page_method
    @transform_mapping = transform_mapping
    @root_key          = root_key
  end
end

Public Instance Methods

fetch_next_page() click to toggle source
# File lib/workable/collection.rb, line 23
def fetch_next_page
  return unless next_page?

  @next_page_method.call(@next_page, @transform_mapping, @root_key)
end
next_page?() click to toggle source
# File lib/workable/collection.rb, line 19
def next_page?
  !! @next_page
end