Class: DiasporaFederation::Parsers::JsonParser

Inherits:
BaseParser
  • Object
show all
Defined in:
lib/diaspora_federation/parsers/json_parser.rb

Overview

This is a parser of JSON serialized object. JSON object format is defined by JSON schema which is available at diaspora.github.io/diaspora_federation/schemas/federation_entities.json. TODO: We must publish the schema at a real URL

Direct Known Subclasses

RelayableJsonParser

Defined Under Namespace

Classes: DeserializationError

Instance Method Summary collapse

Methods inherited from BaseParser

#initialize

Constructor Details

This class inherits a constructor from DiasporaFederation::Parsers::BaseParser

Instance Method Details

#parse(json_hash) ⇒ Array[1]

Returns comprehensive data for an entity instantiation.

Parameters:

  • json_hash (Hash)

    A hash acquired by running JSON.parse with JSON serialized entity

Returns:

  • (Array[1])

    comprehensive data for an entity instantiation

See Also:



12
13
14
15
# File 'lib/diaspora_federation/parsers/json_parser.rb', line 12

def parse(json_hash)
  from_json_sanity_validation(json_hash)
  parse_entity_data(json_hash["entity_data"])
end