Skip to content

Commit

Permalink
Merge pull request #9 from upwork/v2.2.1
Browse files Browse the repository at this point in the history
v2.2.1
  • Loading branch information
mnovozhylov committed Mar 25, 2024
2 parents c1e4689 + 9345830 commit e010986
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Build.PL
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ my $builder = Module::Build->new(
module_name => 'Net::Upwork::API',
license => 'apache',
dist_author => 'Maksym Novozhylov <mnovozhilov@upwork.com>',
dist_version => '2.2.0',
dist_version => '2.2.1',
dist_abstract => 'Perl bindings for Upwork API (OAuth2)',
build_requires => {
'Test::More' => '0.66',
Expand Down
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2.2.1
* Fix auto-refreshing issue. Introduce new parameter for set_access_token_session(). See example script.

## 2.2.0
* Add support of Client Credentials Grant

Expand Down
46 changes: 46 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,52 @@
Build.PL
CHANGES.md
example/example.pl
html/_blkbluw.css
html/_blkcynw.css
html/_blkgrng.css
html/_blkmagw.css
html/_grygrnk.css
html/_grygrnw.css
html/_podly.js
html/_whtgrng.css
html/_whtnavk.css
html/_whtprpk.css
html/index.html
html/Net/Upwork/API.html
html/Net/Upwork/API/Client.html
html/Net/Upwork/API/Config.html
html/Net/Upwork/API/Routers/Activities/Engagement.html
html/Net/Upwork/API/Routers/Activities/Team.html
html/Net/Upwork/API/Routers/Auth.html
html/Net/Upwork/API/Routers/Freelancers/Profile.html
html/Net/Upwork/API/Routers/Freelancers/Search.html
html/Net/Upwork/API/Routers/Graphql.html
html/Net/Upwork/API/Routers/Hr/Clients/Applications.html
html/Net/Upwork/API/Routers/Hr/Clients/Offers.html
html/Net/Upwork/API/Routers/Hr/Contracts.html
html/Net/Upwork/API/Routers/Hr/Engagements.html
html/Net/Upwork/API/Routers/Hr/Freelancers/Applications.html
html/Net/Upwork/API/Routers/Hr/Freelancers/Offers.html
html/Net/Upwork/API/Routers/Hr/Interviews.html
html/Net/Upwork/API/Routers/Hr/Jobs.html
html/Net/Upwork/API/Routers/Hr/Milestones.html
html/Net/Upwork/API/Routers/Hr/Roles.html
html/Net/Upwork/API/Routers/Hr/Submissions.html
html/Net/Upwork/API/Routers/Jobs/Profile.html
html/Net/Upwork/API/Routers/Jobs/Search.html
html/Net/Upwork/API/Routers/Messages.html
html/Net/Upwork/API/Routers/Metadata.html
html/Net/Upwork/API/Routers/Organization/Companies.html
html/Net/Upwork/API/Routers/Organization/Teams.html
html/Net/Upwork/API/Routers/Organization/Users.html
html/Net/Upwork/API/Routers/Payments.html
html/Net/Upwork/API/Routers/Reports/Finance/Accounts.html
html/Net/Upwork/API/Routers/Reports/Finance/Billings.html
html/Net/Upwork/API/Routers/Reports/Finance/Earnings.html
html/Net/Upwork/API/Routers/Reports/Time.html
html/Net/Upwork/API/Routers/Snapshot.html
html/Net/Upwork/API/Routers/Workdays.html
html/Net/Upwork/API/Routers/Workdiary.html
lib/Net/Upwork/API.pm
lib/Net/Upwork/API/Client.pm
lib/Net/Upwork/API/Config.pm
Expand Down
7 changes: 5 additions & 2 deletions lib/Net/Upwork/API.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use warnings;
use Net::Upwork::API::Config;
use Net::Upwork::API::Client;

our $VERSION = '2.2.0';
our $VERSION = '2.2.1';

use constant TOKEN_TYPE_BEARER => 'Bearer';

Expand Down Expand Up @@ -170,10 +170,11 @@ B<Return value>

sub set_access_token_session() {
my $self = shift;
my $auto_refresh = shift;

$self->{client}{access_token_session} = Net::OAuth2::AccessToken->new(
profile => $self->{client}->get_oauth_client,
auto_refresh => 0,
auto_refresh => $auto_refresh ? 1 : 0,
(
access_token => $self->{config}{access_token},
refresh_token => $self->{config}{refresh_token},
Expand All @@ -187,6 +188,8 @@ sub set_access_token_session() {
if ($self->{config}{expires_at} < time()) {
$self->{client}{access_token_session}->refresh();
}

return $self->{client}{access_token_session};
}

=item client()
Expand Down

0 comments on commit e010986

Please sign in to comment.