# HG changeset patch # User Peter Sanchez # Date 1449884327 28800 # Fri Dec 11 17:38:47 2015 -0800 # Node ID f2e2f4981b37c7ebaf70ec479a866bb28f945f32 # Parent b786f60505eaf7245a23c285c300d15497c8a5a0 Added jobs & schools diff --git a/tinder/models.py b/tinder/models.py --- a/tinder/models.py +++ b/tinder/models.py @@ -1,6 +1,7 @@ import datetime from . import constants from .utils import pull_date +from .exceptions import TinderError class FieldDescriptor(object): @@ -171,6 +172,25 @@ def distance(self): return self._data.get('distance_mi', self._data.get('distance_km', 0)) + @property + def jobs(self): + return [ + [ + job.get('title', {}).get('name', None), + job['company']['name'] + ] for job in self._data.get('jobs', []) + ] + + @property + def jobs_pretty(self): + return [ + u'{0} @ {1}'.format(x[0] or u'Untitled', x[1]) for x in self.jobs + ] + + @property + def schools(self): + return [x['name'] for x in self._data.get('schools', [])] + def like(self): return self._api.like(self.id) @@ -208,6 +228,15 @@ def matches(self, since_date=None): return self._api.matches(since_date=since_date) + def like(self): + raise TinderError('You can\'t like yourself') + + def super_like(self): + raise TinderError('You can\'t super like yourself') + + def nope(self): + raise TinderError('You can\'t dislike yourself') + def __unicode__(self): return u'Profile: {name}'.format(name=self.name)