| 1 | package Document::eSign::Docusign::login; | ||||||||||
| 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::login - Handles the login to Docusign. Should not be used outside of this module. | ||||||||||
| 10 | |||||||||||
| 11 | =head1 VERSION | ||||||||||
| 12 | |||||||||||
| 13 | Version 0.02 | ||||||||||
| 14 | |||||||||||
| 15 | =cut | ||||||||||
| 16 | |||||||||||
| 17 | =head1 functions | ||||||||||
| 18 | |||||||||||
| 19 | =head2 new($parent, $vars) | ||||||||||
| 20 | |||||||||||
| 21 | Takes the parent class and a hashref of options as arguments. Performs the login and sets the parent object's internal vars. | ||||||||||
| 22 | |||||||||||
| 23 | =cut | ||||||||||
| 24 | |||||||||||
| 25 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||
| 26 | 0 | ▶ | carp("Got login request: " . Dumper(@_)) if $_[1]->debug; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 0 | my $class = shift; | |||||||||
| 28 | 0 | my $main = shift; | |||||||||
| 29 | 0 | my $vars = shift; | |||||||||
| 30 | 0 | my $self = bless {}, $class; | |||||||||
| 31 | |||||||||||
| 32 | 0 | my $uri = '/v2/login_information?'; | |||||||||
| 33 | |||||||||||
| 34 | # Build the portions of the get string as needed. | ||||||||||
| 35 | |||||||||||
| 36 | 0 | for ( qw{api_password include_account_id_guid login_settings} ) { | |||||||||
| 37 | 0 | ▶ | if (defined $vars->{$_} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | 0 | $uri .= $_ . '=' . $vars->{$_}; | |||||||||
| 39 | } | ||||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | 0 | my $creds = $main->buildCredentials(); | |||||||||
| 43 | |||||||||||
| 44 | 0 | my $response = $main->sendRequest('GET', undef, $creds, $main->baseUrl . $uri, undef); | |||||||||
| 45 | |||||||||||
| 46 | 0 | ▶ | while ( my ( $key, $value ) = each %{$response->{loginAccounts}->[0]} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | 0 | eval {$main->$key($value)}; | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | 0 | return $self; | |||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | |||||||||||
| 54 | 1 | 1; | |||||||||