view release on metacpan or search on metacpan
},
"WebService::ValidSign::Types" : {
"file" : "lib/WebService/ValidSign/Types.pm",
"version" : "0.004"
}
},
"release_status" : "stable",
"resources" : {
"repository" : {
"type" : "git",
"url" : "git://gitlab.com/waterkip/webservice-validsign.git",
"web" : "https://gitlab.com/waterkip/webservice-validsign"
}
},
"version" : "0.004",
"x_contributors" : [
"Wesley Schwengle <wesley.schwengle@exxellence.nl>"
],
"x_generated_by_perl" : "v5.34.0",
"x_serialization_backend" : "Cpanel::JSON::XS version 4.30",
"x_spdx_expression" : "BSD"
}
Moose: '0'
Pod::Usage: '0'
String::CamelSnakeKebab: '0'
Type::Library: '0'
Type::Utils: '0'
Types::Standard: '0'
URI: '0'
namespace::autoclean: '0'
perl: '5.010'
resources:
repository: git://gitlab.com/waterkip/webservice-validsign.git
version: '0.004'
x_contributors:
- 'Wesley Schwengle <wesley.schwengle@exxellence.nl>'
x_generated_by_perl: v5.34.0
x_serialization_backend: 'YAML::Tiny version 1.73'
x_spdx_expression: BSD
# SYNOPSIS
use WebService::ValidSign;
use WebService::ValidSign::Object::DocumentPackage;
use WebService::ValidSign::Object::Document;
my $client = WebService::ValidSign->new(
secret => 'my very secret API key',
endpoint => 'https://my.validsign.nl/api'
lwp => LWP::UserAgent->new(), # optional
);
my $documentpackage = WebService::ValidSign::Object::DocumentPackage->new(
name => "Document package name"
);
my $senders = $client->account->senders(search => $sender);
if (!@$senders) {
die "Unable to find sender $opts{senders}\n";
bin/vs-download.pl view on Meta::CPAN
use File::Spec::Functions qw(catfile);
use Getopt::Long;
use Pod::Usage;
use WebService::ValidSign;
use WebService::ValidSign::Object::DocumentPackage;
use WebService::ValidSign::Object::Document;
my %opts = (
help => 0,
config => catfile($ENV{HOME}, qw (.config validsign.conf)),
);
{
local $SIG{__WARN__};
my $ok = eval {
GetOptions(
\%opts, qw(help secret=s endpoint=s sender=s
document-package-id=s file=s@ signer=s@ use-fh)
);
};
bin/vs-upload.pl view on Meta::CPAN
use File::Spec::Functions qw(catfile);
use Getopt::Long;
use Pod::Usage;
use WebService::ValidSign;
use WebService::ValidSign::Object::DocumentPackage;
use WebService::ValidSign::Object::Document;
my %opts = (
help => 0,
config => catfile($ENV{HOME}, qw (.config validsign.conf)),
);
{
local $SIG{__WARN__};
my $ok = eval {
GetOptions(
\%opts, qw(help secret=s endpoint=s sender=s
document-package-name=s file=s@ signer=s@ use-fh)
);
};
lib/WebService/ValidSign.pm view on Meta::CPAN
version 0.004
=head1 SYNOPSIS
use WebService::ValidSign;
use WebService::ValidSign::Object::DocumentPackage;
use WebService::ValidSign::Object::Document;
my $client = WebService::ValidSign->new(
secret => 'my very secret API key',
endpoint => 'https://my.validsign.nl/api'
lwp => LWP::UserAgent->new(), # optional
);
my $documentpackage = WebService::ValidSign::Object::DocumentPackage->new(
name => "Document package name"
);
my $senders = $client->account->senders(search => $sender);
if (!@$senders) {
die "Unable to find sender $opts{senders}\n";
lib/WebService/ValidSign/API.pm view on Meta::CPAN
=head1 VERSION
version 0.004
=head1 SYNOPSIS
use WebService::ValidSign;
my $client = WebService::ValidSign->new(
endpoint => 'https://hostname.validsign.nl/api'
);
$client->
=head1 ATTRIBUTES
=over
=item endpoint
lib/WebService/ValidSign/API/Constructor.pm view on Meta::CPAN
has lwp => (
is => 'ro',
lazy => 1,
builder => 1,
);
has endpoint => (
is => 'ro',
isa => WebServiceValidSignURI,
default => sub { 'https://try.validsign.nl/api' },
coerce => 1
);
has secret => (
is => 'ro',
isa => Str,
required => 1,
);
sub args_builder {
lib/WebService/ValidSign/API/Constructor.pm view on Meta::CPAN
=head1 VERSION
version 0.004
=head1 SYNOPSIS
use WebService::ValidSign;
my $client = WebService::ValidSign->new(
secret => "Your API key",
endpoint => 'https://hostname.validsign.nl/api'
);
$client->
=head1 ATTRIBUTES
=over
=item api_uri
t/01-basic.t view on Meta::CPAN
use strict;
use warnings;
use Test::More 0.96;
use Test::Exception;
use Sub::Override;
use WebService::ValidSign;
use HTTP::Response;
my $client = WebService::ValidSign->new(
endpoint => 'https://try.validsign.nl/api',
secret => 'Foo',
);
isa_ok($client, "WebService::ValidSign");
isa_ok($client->endpoint, 'URI');
my $lwp = $client->lwp;
isa_ok($lwp, "LWP::UserAgent");
is(
$lwp->agent,
t/02-types.t view on Meta::CPAN
use Test::Lib;
use Test::WebService::ValidSign;
use WebService::ValidSign::Types qw(WebServiceValidSignURI);
use URI;
my $endpoint = 'https://try.validsign.nl/api';
my $uri = URI->new($endpoint);
ok(
WebServiceValidSignURI->check($uri),
"URI->new($endpoint) is a valid URI object"
);
isa_ok(
WebServiceValidSignURI->coerce($endpoint),
t/100-auth.t view on Meta::CPAN
},
);
my $token = $auth->token();
is($token, "a very secret token", "Got a token from the API");
is($client->token, $token, "... client->token also works");
is($call_count, 1, "... and the token is cached");
is(
$auth->get_endpoint("foo"),
'https://try.validsign.nl/api/foo',
"Got the correct endpoint"
);
{
# Test to see if multiple empty path sections are stripped off
my $client = WebService::ValidSign->new(
secret => 'Foo',
endpoint => 'https://foo.bar.nl/bar//',
);
is(
t/210-document-package-api.t view on Meta::CPAN
name => "Package foo"
);
my $result = $api->create($package);
is($package->id, 42, "Our package now has an ID");
is($request->method, 'POST', "We have a post method");
is(
$request->uri,
'https://try.validsign.nl/api/packages',
".. with a correct endpoint"
);
is(
$request->headers->header('Content-type'),
'application/json',
".. and content type is correct"
);
is($request->headers->header('accept'),
'application/json', ".. and we only accept JSON");
t/210-document-package-api.t view on Meta::CPAN
);
$package->add_document($document);
my $result = $api->create_with_documents($package);
is($package->id, 42, "Our package now has an ID");
is($request->method, 'POST', "We have a post method");
is(
$request->uri,
'https://try.validsign.nl/api/packages',
".. with a correct endpoint"
);
is(
$request->headers->header('Content-type'),
'multipart/form-data; boundary=xYzZY',
".. and content type is correct"
);
is($request->headers->header('accept'),
'application/json', ".. and we only accept JSON");
t/210-document-package-api.t view on Meta::CPAN
is($pkg->count_documents, 1, "... well, only one");
# TODO: Coerce json answer in proper document objects, should be tested
# within the document package unit.
my $rv = $api->download_document($pkg);
isa_ok($rv, "File::Temp");
is($request->method, 'GET', "Download document has correct HTTP method");
is(
$request->uri,
'https://try.validsign.nl/api/packages/42/documents/13/pdf',
".. and points to the correct URI"
);
$rv = $api->download_documents($pkg);
isa_ok($rv, "File::Temp");
is($request->method, 'GET',
"Download documents (zip) has correct HTTP method");
is(
$request->uri,
'https://try.validsign.nl/api/packages/42/documents/zip',
".. and points to the correct URI"
);
}
done_testing();