File Coverage

blib/lib/Catmandu/Store/Resolver.pm
Criterion Covered Total %
statement 15 17 88.2
branch n/a
condition n/a
subroutine 5 6 83.3
pod n/a
total 20 23 86.9


line stmt bran cond sub pod time code
1             package Catmandu::Store::Resolver;
2              
3             our $VERSION = '0.03';
4              
5 1     1   871 use Catmandu::Sane;
  1         109931  
  1         6  
6              
7 1     1   200 use Moo;
  1         1  
  1         5  
8 1     1   624 use Catmandu::Store::Resolver::Bag;
  1         3  
  1         34  
9 1     1   7 use Catmandu::Store::Resolver::API;
  1         1  
  1         18  
10              
11 1     1   3 use LWP::UserAgent;
  1         1  
  1         114  
12              
13             with 'Catmandu::Store';
14              
15             has url => (is => 'ro', required => 1);
16             has username => (is => 'ro', required => 1);
17             has password => (is => 'ro', required => 1);
18              
19             has client => (is => 'lazy');
20              
21             sub _build_client {
22 0     0     my $self = shift;
23 0           return LWP::UserAgent->new();
24             }
25              
26              
27             1;
28              
29             =head1 NAME
30              
31             =for html <a href="https://travis-ci.org/PACKED-vzw/Catmandu-Store-Resolver"><img src="https://travis-ci.org/PACKED-vzw/Catmandu-Store-Resolver.svg?branch=master"></a>
32              
33             Catmandu::Store::Resolver - Store/retrieve items from the Resolver
34              
35             =head1 SYNOPSIS
36              
37             A module that can be used to retrieve or store PIDS for records in the L<Resolver|https://github.com/PACKED-vzw/resolver>.
38              
39             lookup_in_store(
40             objectNumber,
41             Resolver,
42             username: username,
43             password: password,
44             url: http://www.resolver.be
45             )
46              
47             =head1 DESCRIPTION
48              
49             Configure the L<Resolver|https://github.com/PACKED-vzw/resolver> as a L<store|http://librecat.org/Catmandu/#stores> for L<Catmandu|http://librecat.org/>.
50              
51             Museum objects and records require a PID to be uniquely identifiable. The Resolver tool generates and resolves these PIDs. By using this store, PIDs can be queried (based on the object number of the record as stored in the resolver), created, updated and deleted from Catmandu.
52              
53             Data is returned as JSON.
54              
55             {
56             "data": {
57             "documents": [],
58             "domain": "",
59             "id": "",
60             "persystentURIs": [
61             dataPid
62             ],
63             "title": "",
64             "type": ""
65             }
66             }
67              
68             =head1 CONFIGURATION
69              
70             The Resolver API requires a username and password. These must be provided.
71              
72             =over
73              
74             =item C<url>
75              
76             base url of the Resolver (e.g. _http://www.resolver.be_).
77              
78             =item C<username>
79              
80             username for the Resolver.
81              
82             =item C<password>
83              
84             password for the Resolver.
85              
86             =back
87              
88             =head1 USAGE
89              
90             See L<the Catmandu documentation|http://librecat.org/Catmandu/#stores> for more information on how to use Stores.
91              
92             =head1 SEE ALSO
93              
94             L<Catmandu>
95              
96             =head1 AUTHORS
97              
98             Pieter De Praetere, C<< pieter at packed.be >>
99              
100             =head1 CONTRIBUTORS
101              
102             Pieter De Praetere, C<< pieter at packed.be >>
103              
104             =head1 COPYRIGHT AND LICENSE
105              
106             This package is copyright (c) 2016 by PACKED vzw.
107             This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
108              
109             =cut