Commit 22d10a73 authored by Aaron Swartz's avatar Aaron Swartz Committed by Josh Roesslein
Browse files

Add support for related_result

parent b4c2ce23
......@@ -77,6 +77,14 @@ class API(object):
allowed_param = ['id', 'count', 'page'],
require_auth = True
)
"""/related_results/show/:id.format"""
related_results = bind_api(
path = '/related_results/show/{id}.json',
payload_type = 'relation', payload_list = True,
allowed_param = ['id'],
require_auth = False
)
"""/statuses/:id/retweeted_by/ids.format"""
retweeted_by_ids = bind_api(
......
......@@ -276,6 +276,19 @@ class List(Model):
def is_subscribed(self, id):
return self._api.is_subscribed_list(self.user.screen_name, self.slug, id)
class Relation(Model):
@classmethod
def parse(cls, api, json):
result = cls(api)
for k,v in json.items():
if k == 'value' and json['kind'] in ['Tweet', 'LookedupStatus']:
setattr(result, k, Status.parse(api, v))
elif k == 'results':
setattr(result, k, Relation.parse_list(api, v))
else:
setattr(result, k, v)
return result
class JSONModel(Model):
......@@ -308,6 +321,7 @@ class ModelFactory(object):
saved_search = SavedSearch
search_result = SearchResult
list = List
relation = Relation
json = JSONModel
ids = IDModel
......
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