Class: ArchiveImporter::ContactImporter

Inherits:
Object
  • Object
show all
Includes:
Diaspora::Logging
Defined in:
lib/archive_importer/contact_importer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json, user) ⇒ ContactImporter

Returns a new instance of ContactImporter.


7
8
9
10
# File 'lib/archive_importer/contact_importer.rb', line 7

def initialize(json, user)
  @json = json
  @user = user
end

Instance Attribute Details

#jsonObject (readonly)

Returns the value of attribute json


12
13
14
# File 'lib/archive_importer/contact_importer.rb', line 12

def json
  @json
end

#userObject (readonly)

Returns the value of attribute user


13
14
15
# File 'lib/archive_importer/contact_importer.rb', line 13

def user
  @user
end

Instance Method Details

#importObject


15
16
17
18
19
20
# File 'lib/archive_importer/contact_importer.rb', line 15

def import
  @imported_contact = create_contact
  add_to_aspects
rescue ActiveRecord::RecordInvalid => e
  logger.warn "#{self}: #{e}"
end