blob: 029b6f0f72912fda921f92e4a6aaf4413d5c19ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# frozen_string_literal: true
module BulkImports
module Groups
module Extractors
class SubgroupsExtractor
def extract(context)
response = http_client(context.configuration)
.each_page(:get, "#{context.entity.base_resource_path}/subgroups")
.flat_map(&:itself)
BulkImports::Pipeline::ExtractedData.new(data: response)
end
private
def http_client(configuration)
@http_client ||= BulkImports::Clients::HTTP.new(
url: configuration.url,
token: configuration.access_token,
per_page: 100
)
end
end
end
end
end
|