Skip to content

Commit

Permalink
Merge pull request #3 from upwork/v2.1.1
Browse files Browse the repository at this point in the history
v2.1.1
  • Loading branch information
mnovozhylov committed May 8, 2020
2 parents f5d371e + 2b995f2 commit b4cc8f0
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 9 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.1.0',
dist_version => '2.1.1',
dist_abstract => 'Perl bindings for Upwork API (OAuth2)',
build_requires => {
'Test::More' => '0.66',
Expand Down
1 change: 0 additions & 1 deletion MANIFEST
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.docgen
.tests
.travis.yml
Build.PL
CHANGES.md
example/example.pl
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 = '2.1.0';
our $VERSION = '2.1.1';

use constant TOKEN_TYPE_BEARER => 'Bearer';

Expand Down
19 changes: 19 additions & 0 deletions lib/Net/Upwork/API/Routers/Messages.pm
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,25 @@ sub get_room_details {
return $self->client()->get("/messages/v3/" . $company . "/rooms/" . $room_id, %params);
}

=item get_room_messages
Get messages from a specific room
B<Return value>
JSON response as a string
=cut

sub get_room_messages {
my $self = shift;
my $company = shift;
my $room_id = shift;
my %params = @_;

return $self->client()->get("/messages/v3/" . $company . "/rooms/" . $room_id . "/stories", %params);
}

=item get_room_by_offer
Get a specific room by offer ID
Expand Down
4 changes: 2 additions & 2 deletions lib/Net/Upwork/API/Routers/Snapshot.pm
Original file line number Diff line number Diff line change
Expand Up @@ -71,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 @@ -104,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
39 changes: 38 additions & 1 deletion lib/Net/Upwork/API/Routers/Workdiary.pm
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,43 @@ sub new {
return Net::Upwork::API::init_router($class, $api, ENTRY_POINT);
}

=item get
Get Workdiary
B<Parameters>
$company
Company ID
$username
User ID
$date
Date
$params
Hash of parameters
B<Return value>
JSON response as a string
=cut

sub get {
my $self = shift;
my $company = shift;
my $date = shift;
my %params = @_;

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

=item get_by_contract
Get Workdiary by Contract
Expand Down Expand Up @@ -76,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
3 changes: 2 additions & 1 deletion t/03.routers_messages.t
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/usr/bin/env perl
use strict;
use Test::More tests => 10;
use Test::More tests => 11;
use lib qw(lib);
use Net::Upwork::API::Routers::Messages;

can_ok('Net::Upwork::API::Routers::Messages', 'new');
can_ok('Net::Upwork::API::Routers::Messages', 'get_rooms');
can_ok('Net::Upwork::API::Routers::Messages', 'get_room_details');
can_ok('Net::Upwork::API::Routers::Messages', 'get_room_messages');
can_ok('Net::Upwork::API::Routers::Messages', 'get_room_by_offer');
can_ok('Net::Upwork::API::Routers::Messages', 'get_room_by_application');
can_ok('Net::Upwork::API::Routers::Messages', 'get_room_by_contract');
Expand Down

0 comments on commit b4cc8f0

Please sign in to comment.