From 8aeebc45f3e14af5434e69da2d645a32cf8c541f Mon Sep 17 00:00:00 2001 From: Guillermo Payet Date: Thu, 6 Jun 2013 11:49:22 -0700 Subject: [PATCH] Added a few missing Classes and methods --- pypodio2/areas.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/pypodio2/areas.py b/pypodio2/areas.py index 6cd0901..05acf0d 100644 --- a/pypodio2/areas.py +++ b/pypodio2/areas.py @@ -17,6 +17,41 @@ def sanitize_id(self, item_id): return item_id +class Embed(Area): + + def __init__(self, *args, **kwargs): + super(Embed, self).__init__(*args, **kwargs) + + def create(self, attributes): + if type(attributes) != dict: + return ApiErrorException('Must be of type dict') + attributes = json.dumps(attributes) + return self.transport.POST(url='/embed/', body=attributes, type='application/json') + +class Contact(Area): + + def __init__(self, *args, **kwargs): + super(Contact, self).__init__(*args, **kwargs) + + def create(self, space_id, attributes): + if type(attributes) != dict: + return ApiErrorException('Must be of type dict') + attributes = json.dumps(attributes) + return self.transport.POST(url='/contact/space/%d/' % space_id, body=attributes, type='application/json') + + +class Search(Area): + + def __init__(self, *args, **kwargs): + super(Search, self).__init__(*args, **kwargs) + + def searchApp(self, app_id, attributes): + if type(attributes) != dict: + return ApiErrorException('Must be of type dict') + attributes = json.dumps(attributes) + return self.transport.POST(url='/search/app/%d/' % app_id, body=attributes, type='application/json') + + class Item(Area): def __init__(self, *args, **kwargs):