line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
our $VERSION = '0.004'; |
3
|
|
|
|
|
|
|
use Moo::Role; |
4
|
6
|
|
|
6
|
|
48080
|
use namespace::autoclean; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
34
|
|
5
|
6
|
|
|
6
|
|
2121
|
|
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
52
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: A REST API client for ValidSign |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Carp qw(croak); |
9
|
6
|
|
|
6
|
|
470
|
use HTTP::Request; |
|
6
|
|
|
|
|
18
|
|
|
6
|
|
|
|
|
321
|
|
10
|
6
|
|
|
6
|
|
2299
|
use JSON qw(decode_json); |
|
6
|
|
|
|
|
86739
|
|
|
6
|
|
|
|
|
189
|
|
11
|
6
|
|
|
6
|
|
3137
|
use URI; |
|
6
|
|
|
|
|
50421
|
|
|
6
|
|
|
|
|
31
|
|
12
|
6
|
|
|
6
|
|
760
|
use Types::Standard qw(Str); |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
136
|
|
13
|
6
|
|
|
6
|
|
2745
|
use WebService::ValidSign::Types qw( |
|
6
|
|
|
|
|
408748
|
|
|
6
|
|
|
|
|
61
|
|
14
|
6
|
|
|
|
|
58
|
WebServiceValidSignURI |
15
|
|
|
|
|
|
|
); |
16
|
6
|
|
|
6
|
|
6588
|
|
|
6
|
|
|
|
|
77
|
|
17
|
|
|
|
|
|
|
has lwp => ( |
18
|
|
|
|
|
|
|
is => 'ro', |
19
|
|
|
|
|
|
|
lazy => 1, |
20
|
|
|
|
|
|
|
builder => 1, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has endpoint => ( |
24
|
|
|
|
|
|
|
is => 'ro', |
25
|
|
|
|
|
|
|
isa => WebServiceValidSignURI, |
26
|
|
|
|
|
|
|
default => sub { 'https://try.validsign.nl/api' }, |
27
|
|
|
|
|
|
|
coerce => 1 |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has secret => ( |
31
|
|
|
|
|
|
|
is => 'ro', |
32
|
|
|
|
|
|
|
isa => Str, |
33
|
|
|
|
|
|
|
required => 1, |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $self = shift; |
37
|
|
|
|
|
|
|
return map { $_ => $self->$_ } qw(secret endpoint lwp); |
38
|
6
|
|
|
6
|
0
|
15
|
} |
39
|
6
|
|
|
|
|
14
|
|
|
18
|
|
|
|
|
170
|
|
40
|
|
|
|
|
|
|
require LWP::UserAgent; |
41
|
|
|
|
|
|
|
return LWP::UserAgent->new( |
42
|
|
|
|
|
|
|
agent => "WebService::ValidSign/$VERSION", |
43
|
5
|
|
|
5
|
|
1639
|
protocols_allowed => [qw(https)], |
44
|
5
|
|
|
|
|
51024
|
ssl_opts => { verify_hostname => 1 }, |
45
|
|
|
|
|
|
|
requests_redirectable => [qw(HEAD GET)], |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
around '_build_lwp' => sub { |
50
|
|
|
|
|
|
|
my ($orig, $self, @args) = @_; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my $lwp = $orig->($self, @args); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
$lwp->default_header("Authorization", join(" ", "Basic", $self->secret)); |
55
|
|
|
|
|
|
|
return $lwp; |
56
|
|
|
|
|
|
|
}; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=pod |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=encoding UTF-8 |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 NAME |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
WebService::ValidSign::API::Constructor - A REST API client for ValidSign |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 VERSION |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
version 0.004 |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 SYNOPSIS |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
use WebService::ValidSign; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
my $client = WebService::ValidSign->new( |
79
|
|
|
|
|
|
|
secret => "Your API key", |
80
|
|
|
|
|
|
|
endpoint => 'https://hostname.validsign.nl/api' |
81
|
|
|
|
|
|
|
); |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
$client-> |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=over |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item api_uri |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
The API URI endpoint as described in the Acceplication Integrator's Guide |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=item lwp |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
An LWP::UserAgent object. If you extend this module you can use your own |
96
|
|
|
|
|
|
|
builder or just inject something that respects the LWP::UserAgent API. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=back |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 METHODS |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 AUTHOR |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Wesley Schwengle <waterkip@cpan.org> |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This software is Copyright (c) 2019 by Wesley Schwengle. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This is free software, licensed under: |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
The (three-clause) BSD License |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=cut |