Skip to content

Commit

Permalink
Merge pull request #4 from upwork/v2.1.2
Browse files Browse the repository at this point in the history
Add send_message_to_rooms
  • Loading branch information
mnovozhylov committed Sep 18, 2020
2 parents b4cc8f0 + 026f258 commit 70ac815
Show file tree
Hide file tree
Showing 5 changed files with 25 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.1.1',
dist_version => '2.1.2',
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.1.1
* Add Room Messages API

## 2.1.0
* Add Specialties API
* Add Skills V2 API
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.1';
our $VERSION = '2.1.2';

use constant TOKEN_TYPE_BEARER => 'Bearer';

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

=item send_message_to_rooms
Send a message to a batch of rooms
B<Return value>
JSON response as a string
=cut

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

return $self->client()->post("/messages/v3/" . $company . '/stories/batch', %params);
}

=item update_room_settings
Update a room settings
Expand Down
3 changes: 2 additions & 1 deletion t/03.routers_messages.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env perl
use strict;
use Test::More tests => 11;
use Test::More tests => 12;
use lib qw(lib);
use Net::Upwork::API::Routers::Messages;

Expand All @@ -13,5 +13,6 @@ can_ok('Net::Upwork::API::Routers::Messages', 'get_room_by_application');
can_ok('Net::Upwork::API::Routers::Messages', 'get_room_by_contract');
can_ok('Net::Upwork::API::Routers::Messages', 'create_room');
can_ok('Net::Upwork::API::Routers::Messages', 'send_message_to_room');
can_ok('Net::Upwork::API::Routers::Messages', 'send_message_to_rooms');
can_ok('Net::Upwork::API::Routers::Messages', 'update_room_settings');
can_ok('Net::Upwork::API::Routers::Messages', 'update_room_metadata');

0 comments on commit 70ac815

Please sign in to comment.