Class: Darjeelink::RebrandlyImporter

Inherits:
Object
  • Object
show all
Defined in:
app/importers/darjeelink/rebrandly_importer.rb

Instance Method Summary collapse

Constructor Details

#initializeRebrandlyImporter

Returns a new instance of RebrandlyImporter.



5
6
7
8
# File 'app/importers/darjeelink/rebrandly_importer.rb', line 5

def initialize
  @duplicates = []
  @api = Rebrandly::Api.new
end

Instance Method Details

#importObject



10
11
12
13
14
15
16
# File 'app/importers/darjeelink/rebrandly_importer.rb', line 10

def import
  import_rebrandly_links

  Rails.logger.info("Imported #{api.link_count - duplicates.count} links from Rebrandly")
  duplicate_string = duplicates.join("\n")
  Rails.logger.warn("Duplicates:\n#{duplicate_string}") unless duplicates.empty?
end