NAME
Metabase::Gateway - Manage Metabase fact submission
VERSION
version 0.009
SYNOPSIS
my $mg = Metabase::Gateway->new(
fact_classes => \@valid_fact_classes,
librarian => $librarian,
private_librarian => $private_librarian,
);
$mg->handle_submission( $fact_struct, $user_guid, $user_secret);
DESCRIPTION
The Metabase::Gateway class manages submissions to the Metabase. It provides fact and submitter validation or authorization before storing new facts in a Metabase.
USAGE
new
my $mg = Metabase::Gateway->new(
fact_classes => \@valid_fact_classes,
public_librarian => $public_librarian,
private_librarian => $private_librarian,
);
Gateway constructor. Takes three required attributes fact_classes
, public_librarian
and private_librarian
. See below for details.
ATTRIBUTES
approved_types
Returns a list of approved fact types. Automatically generated; cannot be initialized. Used for validating submitted facts.
A "type" is a class name with "::" converted to "-", so this attribute returns an arrayref of the fact_classes
attribute converted to types.
disable_security
A boolean option. If true, submitter profiles will not be authenticated. (This is generally useful for testing, only.) Default is false.
allow_registration
A boolean option. If true, new submitter profiles and secrets may be stored. Default is true.
fact_classes
Array reference containing a list of valid Metabase::Fact subclasses. Only facts from these classes may be added to the Metabase. Required.
public_librarian
A librarian object to manage fact data. Required.
private_librarian
A librarian object to manage user authentication data and possibly other facts that should be segregated from searchable and retrievable facts. This should not be the same as the public_librarian. Required.
METHODS
enqueue
$mg->enqueue( $fact );
Add a fact from a user (identified by a profile) via the public_librarian. Used internally by handle_submission.
handle_submission
$mg->handle_submission( $fact_struct, $user_guid, $user_secret);
Extract a fact a deserialized data structure and add it to the Metabase via the public_librarian. The fact is regenerated from the as_struct
method.
handle_registration
$mg->handle_registration( $profile_struct, $secret_struct );
Extract a new user profile and secret from deserialized data structures and add them via the public_librarian and private_librarian, respectively.
BUGS
Please report any bugs or feature using the CPAN Request Tracker. Bugs can be submitted through the web interface at http://rt.cpan.org/Dist/Display.html?Queue=Metabase
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
AUTHORS
David Golden <dagolden@cpan.org>
Ricardo Signes <rjbs@cpan.org>
Leon Brocard <acme@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2010 by David Golden.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004