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.06';
4              
5 1     1   950 use Catmandu::Sane;
  1         112324  
  1         5  
6              
7 1     1   235 use Moo;
  1         1  
  1         4  
8 1     1   666 use Catmandu::Store::Resolver::Bag;
  1         3  
  1         27  
9 1     1   6 use Catmandu::Store::Resolver::API;
  1         1  
  1         17  
10              
11 1     1   3 use LWP::UserAgent;
  1         1  
  1         97  
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             # From the command line
40             $ catmandu export Resolver --id 1234 --url http://www.resolver.be --username demo --password demo to YAML
41             ---
42             data:
43             data_pids:
44             - https://resolver.be/collection/work/data/9031
45             documents:
46             - 88682
47             - 88683
48             domain: https://resolver.be
49             id: '9031'
50             persistentURIs:
51             - https://resolver.be/collection/9031
52             - https://resolver.be/collection/9031/untitled
53             - https://resolver.be/collection/work/data/9031/html
54             - https://resolver.be/collection/work/data/9031/html/untitled
55             - https://resolver.be/collection/work/data/9031
56             - https://resolver.be/collection/work/representation/9031/1
57             - https://resolver.be/collection/work/representation/9031/1/untitled
58             - https://resolver.be/collection/work/representation/9031
59             type: work
60             work_pid: https://resolver.be/collection/9031
61             ...
62              
63             # From a Catmandu Fix
64             lookup_in_store(
65             objectNumber,
66             Resolver,
67             username: username,
68             password: password,
69             url: http://www.resolver.be
70             )
71              
72             =head1 DESCRIPTION
73              
74             # From a Catmandu Fix
75             lookup_in_store(
76             objectNumber,
77             Resolver,
78             username: username,
79             password: password,
80             url: http://www.resolver.be
81             )
82              
83             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/>.
84              
85             Museum objects and records require a PID to be uniquely identifiable. The Resolver tool
86             generates and resolves these PIDs. By using this store, PIDs can be queried (based on
87             the object number of the record as stored in the resolver), created, updated and deleted
88             from Catmandu.
89              
90             The C<_id> attribute of the data after a L<add_to_store|Catmandu::Fix::add_to_store>
91             is set to the I<workPid>, which is the first item of the I<presistenURIs> array.
92              
93             The I<Store> returns the following data:
94              
95             data:
96             data_pids:
97             - https://resolver.be/collection/work/data/9031
98             documents:
99             - 88682
100             - 88683
101             domain: https://resolver.be
102             id: '9031'
103             persistentURIs:
104             - https://resolver.be/collection/9031
105             - https://resolver.be/collection/9031/untitled
106             - https://resolver.be/collection/work/data/9031/html
107             - https://resolver.be/collection/work/data/9031/html/untitled
108             - https://resolver.be/collection/work/data/9031
109             - https://resolver.be/collection/work/representation/9031/1
110             - https://resolver.be/collection/work/representation/9031/1/untitled
111             - https://resolver.be/collection/work/representation/9031
112             type: work
113             work_pid: https://resolver.be/collection/9031
114              
115             =head1 PARAMETERS
116              
117             The Resolver API requires a username and password. These must be provided.
118              
119             =over
120              
121             =item C<url>
122              
123             base url of the Resolver (e.g. I<http://www.resolver.be>).
124              
125             =item C<username>
126              
127             username for the Resolver.
128              
129             =item C<password>
130              
131             password for the Resolver.
132              
133             =back
134              
135             =head1 SEE ALSO
136              
137             L<Catmandu::Resolver>
138              
139             =head1 AUTHORS
140              
141             Pieter De Praetere, C<< pieter at packed.be >>
142              
143             =head1 CONTRIBUTORS
144              
145             Pieter De Praetere, C<< pieter at packed.be >>
146              
147             =head1 COPYRIGHT AND LICENSE
148              
149             This package is copyright (c) 2016 by PACKED vzw.
150             This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
151              
152             =cut