@@ -132,13 +132,61 @@ def __init__(self, api_key=None, as_xml=False):
132
132
self .output = Output (self .api_key , self .as_xml )
133
133
134
134
class Response (object ):
135
- """ Response object """
135
+ """
136
+ The Response object stores the details of an API request in an XML/JSON
137
+ agnostic way.
138
+ """
136
139
def __init__ (self , code , body , raw_body , raw_response ):
137
140
self .code = code
138
141
self .body = body
139
142
self .raw_body = raw_body
140
143
self .raw_response = raw_response
141
144
145
+ class Account (HTTPBackend ):
146
+ """ Account object """
147
+ def __init__ (self , api_key = None , as_xml = False ):
148
+ """
149
+ Initializes an Account object
150
+ """
151
+ super (Account , self ).__init__ (api_key , as_xml , 'account' )
152
+
153
+ def create (self , email , tos = True , options = None ):
154
+ """
155
+ Creates an account with Zencoder, no API Key necessary.
156
+ """
157
+ data = {'email' : email ,
158
+ 'terms_of_service' : int (tos )}
159
+ if options :
160
+ data .update (options )
161
+
162
+ return self .post (self .base_url , body = self .encode (data ))
163
+
164
+ def details (self ):
165
+ """
166
+ Gets your account details.
167
+ """
168
+ data = {'api_key' : self .api_key }
169
+
170
+ return self .get (self .base_url , params = urlencode (data ))
171
+
172
+ def integration (self ):
173
+ """
174
+ Puts your account into integration mode.
175
+ """
176
+ data = {'api_key' : self .api_key }
177
+
178
+ return self .get (self .base_url + '/integration' ,
179
+ params = urlencode (data ))
180
+
181
+ def live (self ):
182
+ """
183
+ Puts your account into live mode."
184
+ """
185
+ data = {'api_key' : self .api_key }
186
+
187
+ return self .get (self .base_url + '/live' ,
188
+ params = urlencode (data ))
189
+
142
190
class Output (HTTPBackend ):
143
191
""" Gets information regarding outputs """
144
192
def __init__ (self , api_key , as_xml = False ):
@@ -215,52 +263,3 @@ def delete(self, job_id):
215
263
"""
216
264
pass
217
265
218
- class Notification (object ):
219
- """ Notification object """
220
- pass
221
-
222
- class Account (HTTPBackend ):
223
- """ Account object """
224
- def __init__ (self , api_key = None , as_xml = False ):
225
- """
226
- Initializes an Account object
227
- """
228
- super (Account , self ).__init__ (api_key , as_xml , 'account' )
229
-
230
- def create (self , email , tos = True , options = None ):
231
- """
232
- Creates an account with Zencoder, no API Key necessary.
233
- """
234
- data = {'email' : email ,
235
- 'terms_of_service' : int (tos )}
236
- if options :
237
- data .update (options )
238
-
239
- return self .post (self .base_url , body = self .encode (data ))
240
-
241
- def details (self ):
242
- """
243
- Gets your account details.
244
- """
245
- data = {'api_key' : self .api_key }
246
-
247
- return self .get (self .base_url , params = urlencode (data ))
248
-
249
- def integration (self ):
250
- """
251
- Puts your account into integration mode.
252
- """
253
- data = {'api_key' : self .api_key }
254
-
255
- return self .get (self .base_url + '/integration' ,
256
- params = urlencode (data ))
257
-
258
- def live (self ):
259
- """
260
- Puts your account into live mode."
261
- """
262
- data = {'api_key' : self .api_key }
263
-
264
- return self .get (self .base_url + '/live' ,
265
- params = urlencode (data ))
266
-
0 commit comments