diff --git a/pushbullet/chat.py b/pushbullet/chat.py index 18fe5ac..4e23013 100644 --- a/pushbullet/chat.py +++ b/pushbullet/chat.py @@ -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)) diff --git a/pushbullet/device.py b/pushbullet/device.py index 1a3cff0..d3b0805 100644 --- a/pushbullet/device.py +++ b/pushbullet/device.py @@ -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"): diff --git a/pushbullet/pushbullet.py b/pushbullet/pushbullet.py index 1c5b02b..143d7ee 100644 --- a/pushbullet/pushbullet.py +++ b/pushbullet/pushbullet.py @@ -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: diff --git a/tests/test_chats.py b/tests/test_chats.py index b9fa838..47cfa7c 100644 --- a/tests/test_chats.py +++ b/tests/test_chats.py @@ -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)