Class: DiasporaFederation::Entities::AccountMigration

Inherits:
DiasporaFederation::Entity show all
Includes:
Signable
Defined in:
lib/diaspora_federation/entities/account_migration.rb

Overview

This entity is sent when a person changes their diaspora* ID (e.g. when a user migration from one to another pod happens).

Defined Under Namespace

Classes: NewPrivateKeyNotFound

Constant Summary

Constants included from Signable

Signable::DIGEST

Constants inherited from DiasporaFederation::Entity

DiasporaFederation::Entity::ENTITY_NAME_REGEX, DiasporaFederation::Entity::INVALID_XML_REGEX

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Signable

#sign_with_key

Methods included from Logging

included

Methods inherited from DiasporaFederation::Entity

class_name, entity_class, entity_name, from_json, from_xml, #initialize, #to_h, #to_json, #to_xml

Methods included from PropertiesDSL

#class_props, #default_values, #entity, #find_property_for_xml_name, #missing_props, #optional_props, #property, #resolv_aliases, #xml_names

Constructor Details

This class inherits a constructor from DiasporaFederation::Entity

Instance Attribute Details

#authorString (readonly)

The old diaspora* ID of the person who changes their ID

Returns:

  • (String)

    author diaspora* ID

See Also:



14
# File 'lib/diaspora_federation/entities/account_migration.rb', line 14

property :author, :string

#profilePerson (readonly)

Holds new updated profile of a person, including diaspora* ID

Returns:

  • (Person)

    person new data



19
# File 'lib/diaspora_federation/entities/account_migration.rb', line 19

entity :profile, Entities::Profile

#signatureString (readonly)

Signature that validates original and target diaspora* IDs with the new key of person

Returns:

  • (String)

    signature



24
# File 'lib/diaspora_federation/entities/account_migration.rb', line 24

property :signature, :string, default: nil

Class Method Details

.from_hash(*args) ⇒ Object

Calls super and additionally does signature verification for the instantiated entity.



41
42
43
# File 'lib/diaspora_federation/entities/account_migration.rb', line 41

def self.from_hash(*args)
  super.tap(&:verify_signature)
end

Instance Method Details

#to_sString

Returns string representation of this object.

Returns:

  • (String)

    string representation of this object



27
28
29
# File 'lib/diaspora_federation/entities/account_migration.rb', line 27

def to_s
  "AccountMigration:#{author}:#{profile.author}"
end

#verify_signatureObject

Shortcut for calling super method with sensible arguments



34
35
36
# File 'lib/diaspora_federation/entities/account_migration.rb', line 34

def verify_signature
  super(profile.author, :signature)
end