Skip to content

Commit

Permalink
Merge pull request #7 from upwork/v1.2.4
Browse files Browse the repository at this point in the history
v1.3.0
  • Loading branch information
mnovozhylov authored May 25, 2018
2 parents 4c43caa + ad05362 commit 9841518
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 117 deletions.
1 change: 1 addition & 0 deletions .tests
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./Build test
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 => '1.2.3',
dist_version => '1.3.0',
dist_abstract => 'Perl bindings for Upwork API',
build_requires => {
'Test::More' => '0.66',
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.3.0
* Stop supporting deprecated Teamrooms API
* Migrate Workdiaries, Workdays and Snapshots API to v3

## 1.2.3
* Time Reports API calls do not work

Expand Down
2 changes: 1 addition & 1 deletion 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 = '1.2.3';
our $VERSION = '1.3.0';

=pod
Expand Down
108 changes: 2 additions & 106 deletions lib/Net/Upwork/API/Routers/Snapshot.pm
Original file line number Diff line number Diff line change
Expand Up @@ -46,110 +46,6 @@ sub new {
return Net::Upwork::API::init_router($class, $api, ENTRY_POINT);
}

=item get
Get snapshot info
B<Parameters>
$company
Company ID
$username
User ID
$ts
Timestamp
B<Return value>
JSON response as a string
=cut

sub get {
my $self = shift;
my $company = shift;
my $username = shift;
my $ts = shift;

return $self->client()->get("/team/v1/snapshots/" . $company . "/" . $username . "/" . $ts);
}

=item update
Update snapshot info
B<Parameters>
$company
Company ID
$username
User ID
$ts
Timestamp
$params
Hash of parameters
B<Return value>
JSON response as a string
=cut

sub update {
my $self = shift;
my $company = shift;
my $username = shift;
my $ts = shift;
my %params = @_;

return $self->client()->put("/team/v1/snapshots/" . $company . "/" . $username . "/" . $ts, %params);
}

=item delete
Delete snapshot info
B<Parameters>
$company
Company ID
$username
User ID
$ts
Timestamp
B<Return value>
JSON response as a string
=cut

sub delete {
my $self = shift;
my $company = shift;
my $username = shift;
my $ts = shift;

return $self->client()->delete("/team/v1/snapshots/" . $company . "/" . $username . "/" . $ts);
}

=item get_by_contract
Get snapshot info by specific contract
Expand All @@ -175,7 +71,7 @@ sub get_by_contract {
my $contract = shift;
my $ts = shift;

return $self->client()->get("/team/v2/snapshots/contracts/" . $contract . "/" . $ts);
return $self->client()->get("/team/v3/snapshots/contracts/" . $contract . "/" . $ts);
}

=item update_by_contract
Expand Down Expand Up @@ -208,7 +104,7 @@ sub update_by_contract {
my $ts = shift;
my %params = @_;

return $self->client()->put("/team/v2/snapshots/contracts/" . $contract . "/" . $ts, %params);
return $self->client()->put("/team/v3/snapshots/contracts/" . $contract . "/" . $ts, %params);
}

=item delete_by_contract
Expand Down
4 changes: 2 additions & 2 deletions lib/Net/Upwork/API/Routers/Workdays.pm
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ sub get_by_company {
my $till_date = shift;
my %params = @_;

return $self->client()->get("/team/v2/workdays/companies/" . $company . "/" . $from_date . "," . $till_date, %params);
return $self->client()->get("/team/v3/workdays/companies/" . $company . "/" . $from_date . "," . $till_date, %params);
}

=item get_by_contract
Expand Down Expand Up @@ -119,7 +119,7 @@ sub get_by_contract {
my $till_date = shift;
my %params = @_;

return $self->client()->get("/team/v2/workdays/contracts/" . $contract . "/" . $from_date . "," . $till_date, %params);
return $self->client()->get("/team/v3/workdays/contracts/" . $contract . "/" . $from_date . "," . $till_date, %params);
}

=back
Expand Down
5 changes: 2 additions & 3 deletions lib/Net/Upwork/API/Routers/Workdiary.pm
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,10 @@ B<Return value>
sub get {
my $self = shift;
my $company = shift;
my $username = shift;
my $date = shift;
my %params = @_;

return $self->client()->get("/team/v1/workdiaries/" . $company . "/" . $username . "/" . $date, %params);
return $self->client()->get("/team/v3/workdiaries/companies/" . $company . "/" . $date, %params);
}

=item get_by_contract
Expand Down Expand Up @@ -114,7 +113,7 @@ sub get_by_contract {
my $date = shift;
my %params = @_;

return $self->client()->get("/team/v2/workdiaries/contracts/" . $contract . "/" . $date, %params);
return $self->client()->get("/team/v3/workdiaries/contracts/" . $contract . "/" . $date, %params);
}

=back
Expand Down
5 changes: 1 addition & 4 deletions t/04.routers_snapshot.t
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
#!/usr/bin/env perl
use strict;
use Test::More tests => 7;
use Test::More tests => 4;
use lib qw(lib);
use Net::Upwork::API::Routers::Snapshot;

can_ok('Net::Upwork::API::Routers::Snapshot', 'new');
can_ok('Net::Upwork::API::Routers::Snapshot', 'get');
can_ok('Net::Upwork::API::Routers::Snapshot', 'update');
can_ok('Net::Upwork::API::Routers::Snapshot', 'delete');
can_ok('Net::Upwork::API::Routers::Snapshot', 'get_by_contract');
can_ok('Net::Upwork::API::Routers::Snapshot', 'update_by_contract');
can_ok('Net::Upwork::API::Routers::Snapshot', 'delete_by_contract');

0 comments on commit 9841518

Please sign in to comment.