Module: ArchiveImporter::ArchiveHelper

Included in:
ArchiveImporter, ArchiveValidator, ArchiveValidator::BaseValidator
Defined in:
lib/archive_importer/archive_helper.rb

Instance Method Summary collapse

Instance Method Details

#archive_author_diaspora_idObject


29
30
31
# File 'lib/archive_importer/archive_helper.rb', line 29

def archive_author_diaspora_id
  @archive_author_diaspora_id ||= archive_hash.fetch("user").fetch("profile").fetch("entity_data").fetch("author")
end

#contact_groupsObject


25
26
27
# File 'lib/archive_importer/archive_helper.rb', line 25

def contact_groups
  @contact_groups ||= archive_hash.fetch("user").fetch("contact_groups", [])
end

#contactsObject


21
22
23
# File 'lib/archive_importer/archive_helper.rb', line 21

def contacts
  archive_hash.fetch("user").fetch("contacts", [])
end

#others_relayablesObject


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

def others_relayables
  @others_relayables ||= archive_hash.fetch("others_data", {}).fetch("relayables", [])
end

#personObject


33
34
35
# File 'lib/archive_importer/archive_helper.rb', line 33

def person
  @person ||= Person.find_or_fetch_by_identifier(archive_author_diaspora_id)
end

#post_subscriptionsObject


17
18
19
# File 'lib/archive_importer/archive_helper.rb', line 17

def post_subscriptions
  archive_hash.fetch("user").fetch("post_subscriptions", [])
end

#postsObject


5
6
7
# File 'lib/archive_importer/archive_helper.rb', line 5

def posts
  @posts ||= archive_hash.fetch("user").fetch("posts", [])
end

#private_keyObject


37
38
39
# File 'lib/archive_importer/archive_helper.rb', line 37

def private_key
  OpenSSL::PKey::RSA.new(serialized_private_key)
end

#relayablesObject


9
10
11
# File 'lib/archive_importer/archive_helper.rb', line 9

def relayables
  @relayables ||= archive_hash.fetch("user").fetch("relayables", [])
end

#serialized_private_keyObject


41
42
43
# File 'lib/archive_importer/archive_helper.rb', line 41

def serialized_private_key
  archive_hash.fetch("user").fetch("private_key")
end