@@ 33,6 33,8 @@ class API(object):
self.host = host
self.debug = debug
self.likes_remaining = -1
+ self.super_likes_remaining = -1
+ self.super_likes_allotment = -1
self.rate_limited_until = None
def set_auth(self, fb_id, fb_token):
@@ 77,6 79,12 @@ class API(object):
allowed_param=['user_id'],
)
+ # XXX Needs to be updated. Path is incorrect
+ _super_like = bind_api(
+ path='/like/{user_id}/super',
+ allowed_param=['user_id'],
+ )
+
nope = bind_api(
path='/pass/{user_id}',
allowed_param=['user_id'],
@@ 167,6 175,12 @@ class API(object):
return data.get('match', False)
+ def super_like(self, user_id):
+ ''' XXX needs to be inspected and updated
+ '''
+ data = self._super_like(user_id)
+ return data
+
def update_likes_remaining(self):
data = self.meta()
try:
@@ 176,6 190,19 @@ class API(object):
except (KeyError, TypeError):
pass
+ try:
+ self.super_likes_remaining = \
+ data['rating']['super_likes']['remaining']
+ self.super_likes_allotment = \
+ data['rating']['super_likes']['allotment']
+ if self.debug:
+ log.info('* Super Likes Remaining: {0} (out of {1})'.format(
+ self.super_likes_remaining,
+ self.super_likes_allotment,
+ ))
+ except (KeyError, TypeError):
+ pass
+
def nearby(self, limit=11):
data = self.recs(limit=limit)
if not 'results' in data:
@@ 174,6 174,9 @@ class User(BaseModel):
def like(self):
return self._api.like(self.id)
+ def super_like(self):
+ return self._api.super_like(self.id)
+
def nope(self):
return self._api.nope(self.id)