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
|
33
|
|
|
33
|
|
216
|
use strict; |
|
33
|
|
|
|
|
60
|
|
|
33
|
|
|
|
|
908
|
|
17
|
33
|
|
|
33
|
|
149
|
use warnings; |
|
33
|
|
|
|
|
57
|
|
|
33
|
|
|
|
|
7391
|
|
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{grant_type} ||= "code_authorization"; |
47
|
0
|
|
0
|
|
|
|
$opts{access_token} ||= ""; |
48
|
0
|
|
0
|
|
|
|
$opts{refresh_token} ||= ""; |
49
|
0
|
|
0
|
|
|
|
$opts{expires_in} ||= ""; |
50
|
0
|
|
0
|
|
|
|
$opts{expires_at} ||= ""; |
51
|
0
|
|
0
|
|
|
|
$opts{redirect_uri} ||= ""; |
52
|
0
|
|
0
|
|
|
|
$opts{site} ||= "https://www.upwork.com"; |
53
|
0
|
|
0
|
|
|
|
$opts{authorize_path} ||= "/ab/account-security/oauth2/authorize"; |
54
|
0
|
|
0
|
|
|
|
$opts{access_token_path} ||= "/api/v3/oauth2/token"; |
55
|
0
|
|
0
|
|
|
|
$opts{refresh_token_path} ||= "/api/v3/oauth2/token"; |
56
|
0
|
|
0
|
|
|
|
$opts{callback} ||= ""; |
57
|
0
|
|
0
|
|
|
|
$opts{debug} ||= 0; |
58
|
0
|
0
|
0
|
|
|
|
unless ($opts{client_id} && $opts{client_secret}) { |
59
|
0
|
|
|
|
|
|
die "You must specify a consumer key (client_id) and secret (client_secret) in the config\n"; |
60
|
|
|
|
|
|
|
} |
61
|
0
|
|
|
|
|
|
my $self = bless \%opts, $class; |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
return $self; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=back |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 AUTHOR |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Maksym Novozhylov C<< >> |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 COPYRIGHT |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Copyright E Upwork Global Corp., 2018 |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=cut |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |