Module: DiasporaFederation::Entities::Relayable::Parsing
- Defined in:
- lib/diaspora_federation/entities/relayable.rb
Overview
Override class methods from DiasporaFederation::Entity to parse serialized data
Instance Method Summary collapse
-
#from_hash(properties_hash, property_order) ⇒ Object
Does the same job as Entity.from_hash except of the following differences: 1) unknown properties from the properties_hash are stored to additional_data of the relayable instance 2) parent entity fetch is attempted 3) signatures verification is performed; property_order is used as the order in which properties are composed to compute signatures 4) unknown properties' keys must be of String type.
Instance Method Details
#from_hash(properties_hash, property_order) ⇒ Object
Does the same job as Entity.from_hash except of the following differences:
- unknown properties from the properties_hash are stored to additional_data of the relayable instance
- parent entity fetch is attempted
- signatures verification is performed; property_order is used as the order in which properties are composed to compute signatures
- unknown properties' keys must be of String type
163 164 165 166 167 168 169 170 171 |
# File 'lib/diaspora_federation/entities/relayable.rb', line 163 def from_hash(properties_hash, property_order) # Use all known properties to build the Entity (entity_data). All additional elements # are respected and attached to a hash as string (additional_data). This is needed # to support receiving objects from the future versions of diaspora*, where new elements may have been added. additional_data = properties_hash.reject {|key, _| class_props.has_key?(key) } fetch_parent(properties_hash) new(properties_hash, property_order, additional_data).tap(&:verify_signature) end |