Skip to content
This repository has been archived by the owner on Jul 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #109 from bil-elmoussaoui/master
Browse files Browse the repository at this point in the history
fixes #79 and #81
  • Loading branch information
kovacsbalu authored Jan 18, 2017
2 parents 2dff6ce + c8fe677 commit 06b6c57
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pushbullet/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def __init__(self, account, chat_info):
self.iden = chat_info.get("iden")

contact_info = chat_info['with']
for attr in ("created", "modified"):
for attr in ("created", "modified", "muted"):
setattr(self, attr, chat_info.get(attr))
for attr in ("name", "email", "email_normalized", "image_url"):
setattr(self, attr, contact_info.get(attr))
Expand Down
3 changes: 2 additions & 1 deletion pushbullet/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class Device(object):
def __init__(self, account, device_info):
self._account = account
self.device_iden = device_info.get("iden")

if not device_info.get("icon", None):
device_info["icon"] = "system"
for attr in ("push_token", "app_version", "fingerprint", "created", "modified",
"active", "nickname", "generated_nickname", "manufacturer", "icon",
"model", "has_sms", "key_fingerprint"):
Expand Down
4 changes: 3 additions & 1 deletion pushbullet/pushbullet.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,10 @@ def edit_device(self, device, nickname=None, model=None, manufacturer=None, icon
raise PushbulletError(r.text)


def edit_chat(self, chat, name):
def edit_chat(self, chat, name, muted=None):
data = {"name": name}
if muted is not None:
data["muted"] = muted
iden = chat.iden
r = self._session.post("{}/{}".format(self.CHATS_URL, iden), data=json.dumps(data))
if r.status_code == requests.codes.ok:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_chats.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_encoding_support(self):
print(self.chat)

def test_push(self):
data = {"title": "test title"}
data = {"title": "test title", "muted": True}
self.chat._push(data)
pushed_data = {"title": "test title", "email": self.contact_email}
pushed_data = {"title": "test title", "email": self.contact_email, "muted": True}
self.account._push.assert_called_with(pushed_data)

0 comments on commit 06b6c57

Please sign in to comment.