File Coverage

lib/Net/Upwork/API/Config.pm
Criterion Covered Total %
statement 6 25 24.0
branch 0 2 0.0
condition 0 29 0.0
subroutine 2 3 66.6
pod 1 1 100.0
total 9 60 15.0


line stmt bran cond sub pod time code
1             # Licensed under the Upwork's API Terms of Use;
2             # you may not use this file except in compliance with the Terms.
3             #
4             # Unless required by applicable law or agreed to in writing, software
5             # distributed under the License is distributed on an "AS IS" BASIS,
6             # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7             # See the License for the specific language governing permissions and
8             # limitations under the License.
9             #
10             # Author:: Maksym Novozhylov (mnovozhilov@upwork.com)
11             # Copyright:: Copyright 2015(c) Upwork.com
12             # License:: See LICENSE.txt and TOS - https://developers.upwork.com/api-tos.html
13              
14             package Net::Upwork::API::Config;
15              
16 32     32   209 use strict;
  32         56  
  32         893  
17 32     32   147 use warnings;
  32         52  
  32         6616  
18              
19             =pod
20              
21             =head1 NAME
22              
23             Config
24              
25             =head1 FUNCTIONS
26              
27             =over 4
28              
29             =item new(%params)
30              
31             Create a new Config
32              
33             B
34              
35             $params
36              
37             List of configuration options
38              
39             =cut
40              
41             sub new {
42 0     0 1   my $class = shift;
43 0           my %opts = @_;
44 0   0       $opts{client_id} ||= "";
45 0   0       $opts{client_secret} ||= "";
46 0   0       $opts{access_token} ||= "";
47 0   0       $opts{refresh_token} ||= "";
48 0   0       $opts{expires_in} ||= "";
49 0   0       $opts{expires_at} ||= "";
50 0   0       $opts{redirect_uri} ||= "";
51 0   0       $opts{site} ||= "https://www.upwork.com";
52 0   0       $opts{authorize_path} ||= "/ab/account-security/oauth2/authorize";
53 0   0       $opts{access_token_path} ||= "/api/v3/oauth2/token";
54 0   0       $opts{refresh_token_path} ||= "/api/v3/oauth2/token";
55 0   0       $opts{callback} ||= "";
56 0   0       $opts{debug} ||= 0;
57 0 0 0       unless ($opts{client_id} && $opts{client_secret}) {
58 0           die "You must specify a consumer key (client_id) and secret (client_secret) in the config\n";
59             }
60 0           my $self = bless \%opts, $class;
61              
62 0           return $self;
63             }
64              
65             =back
66              
67             =head1 AUTHOR
68              
69             Maksym Novozhylov C<< >>
70              
71             =head1 COPYRIGHT
72              
73             Copyright E Upwork Global Corp., 2018
74              
75             =cut
76              
77             1;