| 1 | package Document::eSign::Docusign::getToken; | ||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use Data::Dumper; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | =head1 NAME | ||||||||||
| 8 | |||||||||||
| 9 | Document::eSign::Docusign::getToken - Retrieves an OAUTH2 token. | ||||||||||
| 10 | |||||||||||
| 11 | =head1 VERSION | ||||||||||
| 12 | |||||||||||
| 13 | Version 0.02 | ||||||||||
| 14 | |||||||||||
| 15 | =cut | ||||||||||
| 16 | |||||||||||
| 17 | =head1 functions | ||||||||||
| 18 | |||||||||||
| 19 | =head2 getToken($varshashref) | ||||||||||
| 20 | |||||||||||
| 21 | my $response = $ds->getToken( | ||||||||||
| 22 | { | ||||||||||
| 23 | grant_type => 'password', # only option | ||||||||||
| 24 | scope => 'api' # only option | ||||||||||
| 25 | } | ||||||||||
| 26 | ); | ||||||||||
| 27 | |||||||||||
| 28 | =cut | ||||||||||
| 29 | |||||||||||
| 30 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 31 | 0 | ▶ | carp("Got token request: " . Dumper(@_)) if $_[1]->debug; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 0 | my $class = shift; | |||||||||
| 33 | 0 | my $main = shift; | |||||||||
| 34 | 0 | my $vars = shift; | |||||||||
| 35 | 0 | my $self = bless {}, $class; | |||||||||
| 36 | |||||||||||
| 37 | 0 | my $uri = '/v2/oauth2/token'; | |||||||||
| 38 | |||||||||||
| 39 | # Build the portions of the get string as needed. | ||||||||||
| 40 | |||||||||||
| 41 | 0 | my $creds = $main->buildCredentials(); | |||||||||
| 42 | |||||||||||
| 43 | 0 | my $response = $main->sendRequest('POST', 'application/json', $creds, $main->defaultUrl . $uri, $vars); | |||||||||
| 44 | |||||||||||
| 45 | 0 | return $response; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | |||||||||||
| 49 | 1 | 1; | |||||||||