Class: Cardio::Migration::Import::Merger

Inherits:
Object
  • Object
show all
Defined in:
card/lib/cardio/migration/import/merger.rb

Overview

executes the card import

Instance Method Summary collapse

Constructor Details

#initialize(data_path, opts = {}) ⇒ Merger

Returns a new instance of Merger.



6
7
8
9
10
# File 'card/lib/cardio/migration/import/merger.rb', line 6

def initialize data_path, opts={}
  @data_path = data_path
  @output_path = File.join data_path, "unmerged"
  @data = ImportData.load @data_path, opts
end

Instance Method Details

#mergeObject



12
13
14
15
16
17
18
19
20
21
# File 'card/lib/cardio/migration/import/merger.rb', line 12

def merge
  puts("nothing to merge") && return if @data.empty?

  Card::Mailer.perform_deliveries = false
  Card::Auth.as_bot do
    Card.merge_list @data, output_file: @output_path
  end

  update_import_data
end