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.04';
4              
5 1     1   868 use Catmandu::Sane;
  1         108131  
  1         5  
6              
7 1     1   196 use Moo;
  1         2  
  1         3  
8 1     1   563 use Catmandu::Store::Resolver::Bag;
  1         2  
  1         29  
9 1     1   6 use Catmandu::Store::Resolver::API;
  1         1  
  1         19  
10              
11 1     1   3 use LWP::UserAgent;
  1         1  
  1         100  
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             __END__
30              
31             =head1 NAME
32              
33             =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>
34              
35             Catmandu::Store::Resolver - Store/retrieve items from the Resolver
36              
37             =head1 SYNOPSIS
38              
39             A module that can be used to retrieve or store PIDS for records in the L<Resolver|https://github.com/PACKED-vzw/resolver>.
40              
41             lookup_in_store(
42             objectNumber,
43             Resolver,
44             username: username,
45             password: password,
46             url: http://www.resolver.be
47             )
48              
49             =head1 DESCRIPTION
50              
51             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/>.
52              
53             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.
54              
55             Data is returned as JSON.
56              
57             {
58             "data": {
59             "documents": [],
60             "domain": "",
61             "id": "",
62             "persystentURIs": [
63             dataPid
64             ],
65             "title": "",
66             "type": ""
67             }
68             }
69              
70             =head1 CONFIGURATION
71              
72             The Resolver API requires a username and password. These must be provided.
73              
74             =over
75              
76             =item C<url>
77              
78             base url of the Resolver (e.g. _http://www.resolver.be_).
79              
80             =item C<username>
81              
82             username for the Resolver.
83              
84             =item C<password>
85              
86             password for the Resolver.
87              
88             =back
89              
90             =head1 USAGE
91              
92             See L<the Catmandu documentation|http://librecat.org/Catmandu/#stores> for more information on how to use Stores.
93              
94             =head1 SEE ALSO
95              
96             L<Catmandu>
97              
98             =head1 AUTHORS
99              
100             Pieter De Praetere, C<< pieter at packed.be >>
101              
102             =head1 CONTRIBUTORS
103              
104             Pieter De Praetere, C<< pieter at packed.be >>
105              
106             =head1 COPYRIGHT AND LICENSE
107              
108             This package is copyright (c) 2016 by PACKED vzw.
109             This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
110              
111             =cut