Class: HubLink::Importer

Inherits:
Object
  • Object
show all
Defined in:
lib/hub_link/importer.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repo:, since:, resources:) ⇒ Importer

Returns a new instance of Importer.



9
10
11
12
13
# File 'lib/hub_link/importer.rb', line 9

def initialize(repo:, since:, resources:)
  @repo = repo.to_s
  @since = since
  @resources = resources
end

Class Method Details

.run(*args) ⇒ Object



5
6
7
# File 'lib/hub_link/importer.rb', line 5

def self.run(*args)
  new(*args).run
end

Instance Method Details

#runObject



15
16
17
18
19
20
21
# File 'lib/hub_link/importer.rb', line 15

def run
  stream.in_batches do |batch|
    resources.each do |source, target|
      import batch.fetch(source), to: target
    end
  end
end