add more documentation
This commit is contained in:
parent
e9c299f993
commit
73fab4d01c
6 changed files with 20 additions and 8 deletions
|
|
@ -33,7 +33,6 @@ module DiasporaFederation
|
|||
# {Callbacks} instance with defined callbacks
|
||||
# @see Callbacks#on
|
||||
# @see Callbacks#trigger
|
||||
#
|
||||
attr_reader :callbacks
|
||||
|
||||
# the pod url
|
||||
|
|
@ -122,6 +121,7 @@ module DiasporaFederation
|
|||
# @param [String] guid of the entity
|
||||
# @return [String] Diaspora ID of the person
|
||||
#
|
||||
# @see Callbacks#on
|
||||
#
|
||||
# @example
|
||||
# config.define_callbacks do
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
module DiasporaFederation
|
||||
module Entities
|
||||
# this entity represents a claim of deletion of a previously federated
|
||||
# this entity represents a claim of deletion of a previously federated entity
|
||||
#
|
||||
# @see Validators::RetractionValidator
|
||||
class Retraction < Entity
|
||||
|
|
|
|||
|
|
@ -25,9 +25,17 @@ module DiasporaFederation
|
|||
# author_pubkey = however_you_retrieve_the_authors_public_key(slap.author_id)
|
||||
#
|
||||
# entity = slap.entity(author_pubkey)
|
||||
#
|
||||
class Slap
|
||||
attr_accessor :author_id, :magic_envelope, :cipher_params
|
||||
# the author of the slap
|
||||
# @overload author_id
|
||||
# @return [String] the author diaspora id
|
||||
# @overload author_id=
|
||||
# @param [String] the author diaspora id
|
||||
attr_accessor :author_id
|
||||
|
||||
# the key and iv if it is an encrypted slap
|
||||
# @param [Hash] value hash containing the key and iv
|
||||
attr_writer :cipher_params
|
||||
|
||||
# Namespaces
|
||||
NS = {d: Salmon::XMLNS, me: MagicEnvelope::XMLNS}
|
||||
|
|
@ -47,7 +55,7 @@ module DiasporaFederation
|
|||
return @entity unless @entity.nil?
|
||||
|
||||
raise ArgumentError unless pubkey.instance_of?(OpenSSL::PKey::RSA)
|
||||
@entity = MagicEnvelope.unenvelop(magic_envelope, pubkey, @cipher_params)
|
||||
@entity = MagicEnvelope.unenvelop(@magic_envelope, pubkey, @cipher_params)
|
||||
@entity
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,9 @@ module DiasporaFederation
|
|||
# This is included to validatros which validate entities which include {Entities::Relayable}
|
||||
module RelayableValidator
|
||||
# when this module is included in a Validator child it adds rules for relayable validation
|
||||
def self.included(model)
|
||||
model.class_eval do
|
||||
# @param [Validation::Validator] validator the validator in which it is included
|
||||
def self.included(validator)
|
||||
validator.class_eval do
|
||||
rule :parent_guid, :guid
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,8 +3,11 @@ module Validation
|
|||
# Rule for validating the number of Diaspora* ids in a string.
|
||||
# The evaluated string is split at ";" and the result will be counted.
|
||||
class DiasporaIdCount
|
||||
# This rule must have a +maximum+ param
|
||||
# @return [Hash] params
|
||||
attr_reader :params
|
||||
|
||||
# create a new rule for a maximum diaspora id count validation
|
||||
# @param [Hash] params
|
||||
# @option params [Fixnum] :maximum maximum allowed id count
|
||||
def initialize(params)
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ XML
|
|||
subject { Salmon::EncryptedSlap.from_xml(slap_xml, okey) }
|
||||
|
||||
it "should have cipher params set" do
|
||||
expect(subject.cipher_params).to_not be_nil
|
||||
expect(subject.instance_variable_get(:@cipher_params)).to_not be_nil
|
||||
end
|
||||
|
||||
it_behaves_like "a Slap instance"
|
||||
|
|
|
|||
Loading…
Reference in a new issue