| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Catmandu::Importer::Zotero; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
40207
|
use Catmandu::Sane; |
|
|
2
|
|
|
|
|
186288
|
|
|
|
2
|
|
|
|
|
13
|
|
|
4
|
2
|
|
|
2
|
|
2158
|
use Catmandu::Util qw(:is); |
|
|
2
|
|
|
|
|
99774
|
|
|
|
2
|
|
|
|
|
762
|
|
|
5
|
2
|
|
|
2
|
|
1458
|
use WWW::Zotero; |
|
|
2
|
|
|
|
|
157043
|
|
|
|
2
|
|
|
|
|
73
|
|
|
6
|
2
|
|
|
2
|
|
16
|
use Moo; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
9
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
with 'Catmandu::Importer'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has userID => (is => 'ro'); |
|
11
|
|
|
|
|
|
|
has groupID => (is => 'ro'); |
|
12
|
|
|
|
|
|
|
has collectionID => (is => 'ro'); |
|
13
|
|
|
|
|
|
|
has apiKey => (is => 'ro'); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# From WWW::Zotero |
|
16
|
|
|
|
|
|
|
has sort => (is => 'ro'); |
|
17
|
|
|
|
|
|
|
has direction => (is => 'ro'); |
|
18
|
|
|
|
|
|
|
has itemKey => (is => 'ro'); |
|
19
|
|
|
|
|
|
|
has itemType => (is => 'ro'); |
|
20
|
|
|
|
|
|
|
has q => (is => 'ro'); |
|
21
|
|
|
|
|
|
|
has qmode => (is => 'ro'); |
|
22
|
|
|
|
|
|
|
has since => (is => 'ro'); |
|
23
|
|
|
|
|
|
|
has tag => (is => 'ro'); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has client => (is => 'lazy'); |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _build_client { |
|
28
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
|
29
|
0
|
|
|
|
|
|
WWW::Zotero->new(key => $self->apiKey); |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub generator { |
|
33
|
|
|
|
|
|
|
my ($self) = @_; |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my %options = (); |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
$options{user} = $self->userID if $self->userID; |
|
38
|
|
|
|
|
|
|
$options{group} = $self->groupID if $self->groupID; |
|
39
|
|
|
|
|
|
|
$options{sort} = $self->sort if $self->sort; |
|
40
|
|
|
|
|
|
|
$options{direction} = $self->direction if $self->direction; |
|
41
|
|
|
|
|
|
|
$options{itemKey} = $self->itemKey if $self->itemKey; |
|
42
|
|
|
|
|
|
|
$options{itemType} = $self->itemType if $self->itemType; |
|
43
|
|
|
|
|
|
|
$options{q} = $self->q if $self->q(); |
|
44
|
|
|
|
|
|
|
$options{qmode} = $self->qmode if $self->qmode; |
|
45
|
|
|
|
|
|
|
$options{since} = $self->since if $self->since; |
|
46
|
|
|
|
|
|
|
$options{tag} = $self->tag if $self->tag; |
|
47
|
|
|
|
|
|
|
$options{include} = 'data'; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
if ($self->collectionID) { |
|
50
|
|
|
|
|
|
|
$options{collectionKey} = $self->collectionID; |
|
51
|
|
|
|
|
|
|
$self->client->listCollectionItems(%options, generator => 1); |
|
52
|
|
|
|
|
|
|
} else { |
|
53
|
|
|
|
|
|
|
$self->client->listItems(%options, generator => 1); |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |