Class: DiasporaFederation::Salmon::Slap Deprecated
- Inherits:
-
Object
- Object
- DiasporaFederation::Salmon::Slap
- Defined in:
- lib/diaspora_federation/salmon/slap.rb
Overview
Deprecated.
Slap
provides class methods to create unencrypted Slap XML from payload data and parse incoming XML into a Slap instance.
A diaspora* flavored magic-enveloped XML message looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<diaspora xmlns="https://joindiaspora.com/protocol" xmlns:me="http://salmon-protocol.org/ns/magic-env">
<header>
<author_id>{author}</author_id>
</header>
{magic_envelope}
</diaspora>
Direct Known Subclasses
Constant Summary collapse
- NS =
Namespaces
{d: Salmon::XMLNS, me: MagicEnvelope::XMLNS}.freeze
Class Method Summary collapse
-
.from_xml(slap_xml) ⇒ MagicEnvelope
Parses an unencrypted Salmon XML string and returns a new instance of MagicEnvelope with the XML data.
Class Method Details
.from_xml(slap_xml) ⇒ MagicEnvelope
Parses an unencrypted Salmon XML string and returns a new instance of MagicEnvelope with the XML data.
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/diaspora_federation/salmon/slap.rb', line 34 def self.from_xml(slap_xml) raise ArgumentError unless slap_xml.instance_of?(String) doc = Nokogiri::XML(slap_xml) = doc.at_xpath("d:diaspora/d:header/d:author_id", Slap::NS) raise MissingAuthor if .nil? || .content.empty? sender = .content MagicEnvelope.unenvelop(magic_env_from_doc(doc), sender) end |