Skip to content

Commit 9fbd687

Browse files
committed
Moving Find to it's own module.
1 parent 381a7f9 commit 9fbd687

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

intercom/api_operations/find.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from intercom import Intercom
2+
from intercom import utils
3+
4+
class Find(object):
5+
6+
@classmethod
7+
def find(cls, **params):
8+
collection = utils.resource_class_to_collection_name(cls)
9+
print "find %s in %s" % (params, collection)
10+
if 'id' in params:
11+
response = Intercom.get("/%s/%s" % (collection, params['id']))
12+
else:
13+
response = Intercom.get("/%s" % (collection), **params)
14+
return cls(**response)

intercom/user.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import datetime
1111
import time
1212
import types
13+
from intercom.api_operations.find import Find
1314
from intercom.api_operations.save import Save
1415

1516

@@ -224,19 +225,6 @@ class DynamicClass(Resource):
224225
return dyncls
225226

226227

227-
class Find(object):
228-
229-
@classmethod
230-
def find(cls, **params):
231-
collection = utils.resource_class_to_collection_name(cls)
232-
print "find %s in %s" % (params, collection)
233-
if 'id' in params:
234-
response = Intercom.get("/%s/%s" % (collection, params['id']))
235-
else:
236-
response = Intercom.get("/%s" % (collection), **params)
237-
return cls(**response)
238-
239-
240228
class CollectionProxy(object):
241229

242230
def __init__(self, cls, collection, finder_url, finder_params={}):

0 commit comments

Comments
 (0)