Commit 03c6d418 by Raphael Lullis

Merge pull request #1 from mgalves/master

Thanks for the work. I will break down the "send text" and "send json" into two distinct methods (Push.message and Push.alert?)
parents d0909ac0 f8b31e53
...@@ -24,14 +24,23 @@ class Push(ParseResource): ...@@ -24,14 +24,23 @@ class Push(ParseResource):
ENDPOINT_ROOT = '/'.join([API_ROOT, 'push']) ENDPOINT_ROOT = '/'.join([API_ROOT, 'push'])
@classmethod @classmethod
def send(cls, message, channels=None, **kw): def send(cls, message, channels=None, device_type=None, push_time=None, expiration_interval=None, **kw):
alert_message = {'alert': message} if type(message) == dict:
data = message
else:
data = {'alert': message}
targets = {} targets = {}
if push_time:
targets["push_time"] = push_time
if expiration_interval:
targets["expiration_interval"] = expiration_interval
if device_type:
targets["type"] = device_type
if channels: if channels:
targets['channels'] = channels targets['channels'] = channels
if kw: if kw:
targets['where'] = kw targets['where'] = kw
return cls.POST('', data=alert_message, **targets) return cls.POST('', data=data, **targets)
Installation.Query = QueryManager(Installation) Installation.Query = QueryManager(Installation)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment