2021-02-01 07:09:03 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module BulkImports
|
|
|
|
module Pipeline
|
|
|
|
class ExtractedData
|
|
|
|
attr_reader :data
|
|
|
|
|
|
|
|
def initialize(data: nil, page_info: {})
|
2021-05-27 14:10:52 -04:00
|
|
|
@data = data.is_a?(Enumerator) ? data : Array.wrap(data)
|
2021-02-01 07:09:03 -05:00
|
|
|
@page_info = page_info
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_next_page?
|
2021-03-18 11:09:04 -04:00
|
|
|
Gitlab::Utils.to_boolean(
|
|
|
|
@page_info&.dig('has_next_page'),
|
|
|
|
default: false
|
|
|
|
)
|
2021-02-01 07:09:03 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def next_page
|
2021-03-26 20:09:34 -04:00
|
|
|
@page_info&.dig('next_page')
|
2021-02-01 07:09:03 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def each(&block)
|
|
|
|
data.each(&block)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|