Skip to content
This repository was archived by the owner on Aug 28, 2025. It is now read-only.

Commit 147fa24

Browse files
authored
Merge pull request #43 from upwork/v1.3.7
Add Room Messages API
2 parents 19d4c89 + a5a9d96 commit 147fa24

File tree

5 files changed

+32
-2
lines changed

5 files changed

+32
-2
lines changed

changelog.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
Changelog
66
***************
77

8+
.. _1.3.7:
9+
10+
Version 1.3.7
11+
-------------
12+
* Add Room Messages API
13+
814
.. _1.3.6:
915

1016
Version 1.3.6

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
README = readme.read()
1212
readme.close()
1313

14-
VERSION = (1, 3, 6, 0, 0)
14+
VERSION = (1, 3, 7, 0, 0)
1515

1616

1717
def get_version():

upwork/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
1414
"""
1515

16-
VERSION = '1.3.6'
16+
VERSION = '1.3.7'
1717

1818

1919
def get_version():

upwork/routers/messages.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,22 @@ def get_room_details(self, company, room_id, params = {}):
4141
result = self.get(url, data=params)
4242
return result.get(url, result)
4343

44+
def get_room_messages(self, company, room_id, params = {}):
45+
"""
46+
Get messages from a specific room
47+
48+
*Parameters:*
49+
:company: Company ID
50+
51+
:room_id Room ID
52+
53+
:params: List of parameters
54+
55+
"""
56+
url = '{0}/rooms/{1}/stories'.format(company, room_id)
57+
result = self.get(url, data=params)
58+
return result.get(url, result)
59+
4460
def get_room_by_offer(self, company, offer_id, params = {}):
4561
"""
4662
Get a specific room by offer ID

upwork/tests.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,14 @@ def test_get_room_details():
861861
assert messages.get_room_details("testcompany", "room-id") ==\
862862
room_dict, messages.get_room_details("testcompany", "room-id")
863863

864+
@patch('urllib3.PoolManager.urlopen', patched_urlopen_room)
865+
def test_get_room_messages():
866+
messages = get_client().messages
867+
868+
#test get_room_messages
869+
assert messages.get_room_messages("testcompany", "room-id") ==\
870+
room_dict, messages.get_room_messages("testcompany", "room-id")
871+
864872
@patch('urllib3.PoolManager.urlopen', patched_urlopen_room)
865873
def test_get_room_by_offer():
866874
messages = get_client().messages

0 commit comments

Comments
 (0)