box-api 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/box-api.gemspec +1 -1
- data/doc/Box.html +108 -0
- data/doc/Box/Account.html +1099 -0
- data/doc/Box/Api.html +3428 -0
- data/doc/Box/Api/AccountExceeded.html +130 -0
- data/doc/Box/Api/EmailInvalid.html +141 -0
- data/doc/Box/Api/EmailTaken.html +130 -0
- data/doc/Box/Api/ErrorStatus.html +130 -0
- data/doc/Box/Api/Exception.html +120 -0
- data/doc/Box/Api/Generic.html +130 -0
- data/doc/Box/Api/InvalidFolder.html +141 -0
- data/doc/Box/Api/InvalidInput.html +130 -0
- data/doc/Box/Api/InvalidName.html +130 -0
- data/doc/Box/Api/NameTaken.html +130 -0
- data/doc/Box/Api/NoAccess.html +130 -0
- data/doc/Box/Api/NoParent.html +130 -0
- data/doc/Box/Api/NotAuthorized.html +130 -0
- data/doc/Box/Api/Restricted.html +141 -0
- data/doc/Box/Api/SizeExceeded.html +130 -0
- data/doc/Box/Api/Unknown.html +130 -0
- data/doc/Box/Api/UnknownResponse.html +141 -0
- data/doc/Box/Api/UploadFailed.html +141 -0
- data/doc/Box/File.html +580 -0
- data/doc/Box/Folder.html +1078 -0
- data/doc/Box/Item.html +1884 -0
- data/doc/_index.html +342 -0
- data/doc/class_list.html +47 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +53 -0
- data/doc/css/style.css +320 -0
- data/doc/file.README.html +98 -0
- data/doc/file_list.html +49 -0
- data/doc/frames.html +13 -0
- data/doc/index.html +98 -0
- data/doc/js/app.js +205 -0
- data/doc/js/full_list.js +150 -0
- data/doc/js/jquery.js +16 -0
- data/doc/method_list.html +574 -0
- data/doc/top-level-namespace.html +103 -0
- data/examples/login.rb +4 -4
- data/lib/box/account.rb +168 -51
- data/lib/box/api.rb +174 -16
- data/lib/box/api/exceptions.rb +4 -0
- data/lib/box/file.rb +17 -4
- data/lib/box/folder.rb +85 -30
- data/lib/box/item.rb +89 -20
- data/spec/account_spec.rb +0 -4
- data/spec/folder_spec.rb +3 -9
- metadata +42 -4
data/doc/Box/Api.html
ADDED
@@ -0,0 +1,3428 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: Box::Api
|
8
|
+
|
9
|
+
— Documentation by YARD 0.7.2
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
relpath = '..';
|
19
|
+
if (relpath != '') relpath += '/';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
25
|
+
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<div id="header">
|
34
|
+
<div id="menu">
|
35
|
+
|
36
|
+
<a href="../_index.html">Index (A)</a> »
|
37
|
+
<span class='title'><span class='object_link'><a href="../Box.html" title="Box (module)">Box</a></span></span>
|
38
|
+
»
|
39
|
+
<span class="title">Api</span>
|
40
|
+
|
41
|
+
|
42
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div id="search">
|
46
|
+
|
47
|
+
<a id="class_list_link" href="#">Class List</a>
|
48
|
+
|
49
|
+
<a id="method_list_link" href="#">Method List</a>
|
50
|
+
|
51
|
+
<a id="file_list_link" href="#">File List</a>
|
52
|
+
|
53
|
+
</div>
|
54
|
+
<div class="clear"></div>
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<iframe id="search_frame"></iframe>
|
58
|
+
|
59
|
+
<div id="content"><h1>Class: Box::Api
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
<dt class="r1">Inherits:</dt>
|
68
|
+
<dd class="r1">
|
69
|
+
<span class="inheritName">Object</span>
|
70
|
+
|
71
|
+
<ul class="fullTree">
|
72
|
+
<li>Object</li>
|
73
|
+
|
74
|
+
<li class="next">Box::Api</li>
|
75
|
+
|
76
|
+
</ul>
|
77
|
+
<a href="#" class="inheritanceTree">show all</a>
|
78
|
+
|
79
|
+
</dd>
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
<dt class="r2">Includes:</dt>
|
87
|
+
<dd class="r2">HTTMultiParty</dd>
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
<dt class="r1 last">Defined in:</dt>
|
94
|
+
<dd class="r1 last">lib/box/api.rb<span class="defines">,<br />
|
95
|
+
lib/box/api/exceptions.rb</span>
|
96
|
+
</dd>
|
97
|
+
|
98
|
+
</dl>
|
99
|
+
<div class="clear"></div>
|
100
|
+
|
101
|
+
<h2>Overview</h2><div class="docstring">
|
102
|
+
<div class="discussion">
|
103
|
+
<p>
|
104
|
+
A wrapper and interface to the Box api. Please visit the Box developers
|
105
|
+
site for a full explaination of what each of the Box api methods expect and
|
106
|
+
perform. TODO: Link to the site.
|
107
|
+
</p>
|
108
|
+
|
109
|
+
|
110
|
+
</div>
|
111
|
+
</div>
|
112
|
+
<div class="tags">
|
113
|
+
|
114
|
+
</div><h2>Defined Under Namespace</h2>
|
115
|
+
<p class="children">
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Api/AccountExceeded.html" title="Box::Api::AccountExceeded (class)">AccountExceeded</a></span>, <span class='object_link'><a href="Api/EmailInvalid.html" title="Box::Api::EmailInvalid (class)">EmailInvalid</a></span>, <span class='object_link'><a href="Api/EmailTaken.html" title="Box::Api::EmailTaken (class)">EmailTaken</a></span>, <span class='object_link'><a href="Api/ErrorStatus.html" title="Box::Api::ErrorStatus (class)">ErrorStatus</a></span>, <span class='object_link'><a href="Api/Exception.html" title="Box::Api::Exception (class)">Exception</a></span>, <span class='object_link'><a href="Api/Generic.html" title="Box::Api::Generic (class)">Generic</a></span>, <span class='object_link'><a href="Api/InvalidFolder.html" title="Box::Api::InvalidFolder (class)">InvalidFolder</a></span>, <span class='object_link'><a href="Api/InvalidInput.html" title="Box::Api::InvalidInput (class)">InvalidInput</a></span>, <span class='object_link'><a href="Api/InvalidName.html" title="Box::Api::InvalidName (class)">InvalidName</a></span>, <span class='object_link'><a href="Api/NameTaken.html" title="Box::Api::NameTaken (class)">NameTaken</a></span>, <span class='object_link'><a href="Api/NoAccess.html" title="Box::Api::NoAccess (class)">NoAccess</a></span>, <span class='object_link'><a href="Api/NoParent.html" title="Box::Api::NoParent (class)">NoParent</a></span>, <span class='object_link'><a href="Api/NotAuthorized.html" title="Box::Api::NotAuthorized (class)">NotAuthorized</a></span>, <span class='object_link'><a href="Api/Restricted.html" title="Box::Api::Restricted (class)">Restricted</a></span>, <span class='object_link'><a href="Api/SizeExceeded.html" title="Box::Api::SizeExceeded (class)">SizeExceeded</a></span>, <span class='object_link'><a href="Api/Unknown.html" title="Box::Api::Unknown (class)">Unknown</a></span>, <span class='object_link'><a href="Api/UnknownResponse.html" title="Box::Api::UnknownResponse (class)">UnknownResponse</a></span>, <span class='object_link'><a href="Api/UploadFailed.html" title="Box::Api::UploadFailed (class)">UploadFailed</a></span>
|
121
|
+
|
122
|
+
|
123
|
+
</p>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
128
|
+
<ul class="summary">
|
129
|
+
|
130
|
+
<li class="public ">
|
131
|
+
<span class="summary_signature">
|
132
|
+
|
133
|
+
<a href="#base_url-instance_method" title="#base_url (instance method)">- (String) <strong>base_url</strong> </a>
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
</span>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
<span class="summary_desc"><div class='inline'><p>
|
150
|
+
The base url of the box api.
|
151
|
+
</p>
|
152
|
+
</div></span>
|
153
|
+
|
154
|
+
</li>
|
155
|
+
|
156
|
+
|
157
|
+
<li class="public ">
|
158
|
+
<span class="summary_signature">
|
159
|
+
|
160
|
+
<a href="#upload_url-instance_method" title="#upload_url (instance method)">- (String) <strong>upload_url</strong> </a>
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
</span>
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
<span class="summary_desc"><div class='inline'><p>
|
177
|
+
The upload url of the box api.
|
178
|
+
</p>
|
179
|
+
</div></span>
|
180
|
+
|
181
|
+
</li>
|
182
|
+
|
183
|
+
|
184
|
+
</ul>
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
<h2>
|
192
|
+
Class Method Summary
|
193
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
194
|
+
</h2>
|
195
|
+
|
196
|
+
<ul class="summary">
|
197
|
+
|
198
|
+
<li class="public ">
|
199
|
+
<span class="summary_signature">
|
200
|
+
|
201
|
+
<a href="#get_exception-class_method" title="get_exception (class method)">+ (Exception) <strong>get_exception</strong>(status) </a>
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
</span>
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
<span class="summary_desc"><div class='inline'><p>
|
215
|
+
Given a status, returning a cooresponding Exception class.
|
216
|
+
</p>
|
217
|
+
</div></span>
|
218
|
+
|
219
|
+
</li>
|
220
|
+
|
221
|
+
|
222
|
+
</ul>
|
223
|
+
|
224
|
+
<h2>
|
225
|
+
Instance Method Summary
|
226
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
227
|
+
</h2>
|
228
|
+
|
229
|
+
<ul class="summary">
|
230
|
+
|
231
|
+
<li class="public ">
|
232
|
+
<span class="summary_signature">
|
233
|
+
|
234
|
+
<a href="#copy-instance_method" title="#copy (instance method)">- (Object) <strong>copy</strong>(target, target_id, destination_id) </a>
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
</span>
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
<span class="summary_desc"><div class='inline'><p>
|
248
|
+
Copy the the item to a new destination.
|
249
|
+
</p>
|
250
|
+
</div></span>
|
251
|
+
|
252
|
+
</li>
|
253
|
+
|
254
|
+
|
255
|
+
<li class="public ">
|
256
|
+
<span class="summary_signature">
|
257
|
+
|
258
|
+
<a href="#create_folder-instance_method" title="#create_folder (instance method)">- (Object) <strong>create_folder</strong>(parent_id, name, share = 0) </a>
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
</span>
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
<span class="summary_desc"><div class='inline'><p>
|
272
|
+
Create a new folder.
|
273
|
+
</p>
|
274
|
+
</div></span>
|
275
|
+
|
276
|
+
</li>
|
277
|
+
|
278
|
+
|
279
|
+
<li class="public ">
|
280
|
+
<span class="summary_signature">
|
281
|
+
|
282
|
+
<a href="#delete-instance_method" title="#delete (instance method)">- (Object) <strong>delete</strong>(target, target_id) </a>
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
</span>
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
<span class="summary_desc"><div class='inline'><p>
|
296
|
+
Delete the item.
|
297
|
+
</p>
|
298
|
+
</div></span>
|
299
|
+
|
300
|
+
</li>
|
301
|
+
|
302
|
+
|
303
|
+
<li class="public ">
|
304
|
+
<span class="summary_signature">
|
305
|
+
|
306
|
+
<a href="#download-instance_method" title="#download (instance method)">- (Object) <strong>download</strong>(path, file_id, version = nil) </a>
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
</span>
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
<span class="summary_desc"><div class='inline'><p>
|
320
|
+
Download the file to the given path.
|
321
|
+
</p>
|
322
|
+
</div></span>
|
323
|
+
|
324
|
+
</li>
|
325
|
+
|
326
|
+
|
327
|
+
<li class="public ">
|
328
|
+
<span class="summary_signature">
|
329
|
+
|
330
|
+
<a href="#get_account_info-instance_method" title="#get_account_info (instance method)">- (Object) <strong>get_account_info</strong> </a>
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
</span>
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
<span class="summary_desc"><div class='inline'><p>
|
344
|
+
Get the user’s account info.
|
345
|
+
</p>
|
346
|
+
</div></span>
|
347
|
+
|
348
|
+
</li>
|
349
|
+
|
350
|
+
|
351
|
+
<li class="public ">
|
352
|
+
<span class="summary_signature">
|
353
|
+
|
354
|
+
<a href="#get_account_tree-instance_method" title="#get_account_tree (instance method)">- (Object) <strong>get_account_tree</strong>(folder_id, *args) </a>
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
</span>
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
<span class="summary_desc"><div class='inline'><p>
|
368
|
+
Get the entire tree of a given folder.
|
369
|
+
</p>
|
370
|
+
</div></span>
|
371
|
+
|
372
|
+
</li>
|
373
|
+
|
374
|
+
|
375
|
+
<li class="public ">
|
376
|
+
<span class="summary_signature">
|
377
|
+
|
378
|
+
<a href="#get_auth_token-instance_method" title="#get_auth_token (instance method)">- (Object) <strong>get_auth_token</strong>(ticket) </a>
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
</span>
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
<span class="summary_desc"><div class='inline'><p>
|
392
|
+
Request an auth token given a ticket.
|
393
|
+
</p>
|
394
|
+
</div></span>
|
395
|
+
|
396
|
+
</li>
|
397
|
+
|
398
|
+
|
399
|
+
<li class="public ">
|
400
|
+
<span class="summary_signature">
|
401
|
+
|
402
|
+
<a href="#get_file_info-instance_method" title="#get_file_info (instance method)">- (Object) <strong>get_file_info</strong>(file_id) </a>
|
403
|
+
|
404
|
+
|
405
|
+
|
406
|
+
</span>
|
407
|
+
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
<span class="summary_desc"><div class='inline'><p>
|
416
|
+
Get the file info.
|
417
|
+
</p>
|
418
|
+
</div></span>
|
419
|
+
|
420
|
+
</li>
|
421
|
+
|
422
|
+
|
423
|
+
<li class="public ">
|
424
|
+
<span class="summary_signature">
|
425
|
+
|
426
|
+
<a href="#get_ticket-instance_method" title="#get_ticket (instance method)">- (Object) <strong>get_ticket</strong> </a>
|
427
|
+
|
428
|
+
|
429
|
+
|
430
|
+
</span>
|
431
|
+
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
<span class="summary_desc"><div class='inline'><p>
|
440
|
+
Request a ticket for authorization.
|
441
|
+
</p>
|
442
|
+
</div></span>
|
443
|
+
|
444
|
+
</li>
|
445
|
+
|
446
|
+
|
447
|
+
<li class="public ">
|
448
|
+
<span class="summary_signature">
|
449
|
+
|
450
|
+
<a href="#handle_response-instance_method" title="#handle_response (instance method)">- (Hash) <strong>handle_response</strong>(response, expected = nil) </a>
|
451
|
+
|
452
|
+
|
453
|
+
|
454
|
+
</span>
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
<span class="summary_desc"><div class='inline'><p>
|
464
|
+
Handle the response of the request.
|
465
|
+
</p>
|
466
|
+
</div></span>
|
467
|
+
|
468
|
+
</li>
|
469
|
+
|
470
|
+
|
471
|
+
<li class="public ">
|
472
|
+
<span class="summary_signature">
|
473
|
+
|
474
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Api) <strong>initialize</strong>(key, url = 'https://box.net', upload_url = 'https://upload.box.net', version = '1.0') </a>
|
475
|
+
|
476
|
+
|
477
|
+
|
478
|
+
</span>
|
479
|
+
|
480
|
+
<span class="note title constructor">constructor</span>
|
481
|
+
|
482
|
+
|
483
|
+
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
<span class="summary_desc"><div class='inline'><p>
|
490
|
+
Create a new API object using the given parameters.
|
491
|
+
</p>
|
492
|
+
</div></span>
|
493
|
+
|
494
|
+
</li>
|
495
|
+
|
496
|
+
|
497
|
+
<li class="public ">
|
498
|
+
<span class="summary_signature">
|
499
|
+
|
500
|
+
<a href="#logout-instance_method" title="#logout (instance method)">- (Object) <strong>logout</strong> </a>
|
501
|
+
|
502
|
+
|
503
|
+
|
504
|
+
</span>
|
505
|
+
|
506
|
+
|
507
|
+
|
508
|
+
|
509
|
+
|
510
|
+
|
511
|
+
|
512
|
+
|
513
|
+
<span class="summary_desc"><div class='inline'><p>
|
514
|
+
Request the user be logged out.
|
515
|
+
</p>
|
516
|
+
</div></span>
|
517
|
+
|
518
|
+
</li>
|
519
|
+
|
520
|
+
|
521
|
+
<li class="public ">
|
522
|
+
<span class="summary_signature">
|
523
|
+
|
524
|
+
<a href="#move-instance_method" title="#move (instance method)">- (Object) <strong>move</strong>(target, target_id, destination_id) </a>
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
</span>
|
529
|
+
|
530
|
+
|
531
|
+
|
532
|
+
|
533
|
+
|
534
|
+
|
535
|
+
|
536
|
+
|
537
|
+
<span class="summary_desc"><div class='inline'><p>
|
538
|
+
Move the item to a new destination.
|
539
|
+
</p>
|
540
|
+
</div></span>
|
541
|
+
|
542
|
+
</li>
|
543
|
+
|
544
|
+
|
545
|
+
<li class="public ">
|
546
|
+
<span class="summary_signature">
|
547
|
+
|
548
|
+
<a href="#new_copy-instance_method" title="#new_copy (instance method)">- (Object) <strong>new_copy</strong>(path, file_id, name = nil) </a>
|
549
|
+
|
550
|
+
|
551
|
+
|
552
|
+
</span>
|
553
|
+
|
554
|
+
|
555
|
+
|
556
|
+
|
557
|
+
|
558
|
+
|
559
|
+
|
560
|
+
|
561
|
+
<span class="summary_desc"><div class='inline'><p>
|
562
|
+
Upload a new copy of the given file.
|
563
|
+
</p>
|
564
|
+
</div></span>
|
565
|
+
|
566
|
+
</li>
|
567
|
+
|
568
|
+
|
569
|
+
<li class="public ">
|
570
|
+
<span class="summary_signature">
|
571
|
+
|
572
|
+
<a href="#overwrite-instance_method" title="#overwrite (instance method)">- (Object) <strong>overwrite</strong>(path, file_id, name = nil) </a>
|
573
|
+
|
574
|
+
|
575
|
+
|
576
|
+
</span>
|
577
|
+
|
578
|
+
|
579
|
+
|
580
|
+
|
581
|
+
|
582
|
+
|
583
|
+
|
584
|
+
|
585
|
+
<span class="summary_desc"><div class='inline'><p>
|
586
|
+
Overwrite the given file with a new one.
|
587
|
+
</p>
|
588
|
+
</div></span>
|
589
|
+
|
590
|
+
</li>
|
591
|
+
|
592
|
+
|
593
|
+
<li class="public ">
|
594
|
+
<span class="summary_signature">
|
595
|
+
|
596
|
+
<a href="#query_download-instance_method" title="#query_download (instance method)">- (Object) <strong>query_download</strong>(args, options = {}) </a>
|
597
|
+
|
598
|
+
|
599
|
+
|
600
|
+
</span>
|
601
|
+
|
602
|
+
|
603
|
+
|
604
|
+
|
605
|
+
|
606
|
+
|
607
|
+
|
608
|
+
|
609
|
+
<span class="summary_desc"><div class='inline'><p>
|
610
|
+
Make a download request.
|
611
|
+
</p>
|
612
|
+
</div></span>
|
613
|
+
|
614
|
+
</li>
|
615
|
+
|
616
|
+
|
617
|
+
<li class="public ">
|
618
|
+
<span class="summary_signature">
|
619
|
+
|
620
|
+
<a href="#query_raw-instance_method" title="#query_raw (instance method)">- (Hash) <strong>query_raw</strong>(method, url, expected, options = {}) </a>
|
621
|
+
|
622
|
+
|
623
|
+
|
624
|
+
</span>
|
625
|
+
|
626
|
+
|
627
|
+
|
628
|
+
|
629
|
+
|
630
|
+
|
631
|
+
|
632
|
+
|
633
|
+
<span class="summary_desc"><div class='inline'><p>
|
634
|
+
Make a raw request.
|
635
|
+
</p>
|
636
|
+
</div></span>
|
637
|
+
|
638
|
+
</li>
|
639
|
+
|
640
|
+
|
641
|
+
<li class="public ">
|
642
|
+
<span class="summary_signature">
|
643
|
+
|
644
|
+
<a href="#query_rest-instance_method" title="#query_rest (instance method)">- (Hash) <strong>query_rest</strong>(expected, options = {}) </a>
|
645
|
+
|
646
|
+
|
647
|
+
|
648
|
+
</span>
|
649
|
+
|
650
|
+
|
651
|
+
|
652
|
+
|
653
|
+
|
654
|
+
|
655
|
+
|
656
|
+
|
657
|
+
<span class="summary_desc"><div class='inline'><p>
|
658
|
+
Make a normal REST request.
|
659
|
+
</p>
|
660
|
+
</div></span>
|
661
|
+
|
662
|
+
</li>
|
663
|
+
|
664
|
+
|
665
|
+
<li class="public ">
|
666
|
+
<span class="summary_signature">
|
667
|
+
|
668
|
+
<a href="#query_upload-instance_method" title="#query_upload (instance method)">- (Hash) <strong>query_upload</strong>(query, args, expected, options = {}) </a>
|
669
|
+
|
670
|
+
|
671
|
+
|
672
|
+
</span>
|
673
|
+
|
674
|
+
|
675
|
+
|
676
|
+
|
677
|
+
|
678
|
+
|
679
|
+
|
680
|
+
|
681
|
+
<span class="summary_desc"><div class='inline'><p>
|
682
|
+
Make an upload request.
|
683
|
+
</p>
|
684
|
+
</div></span>
|
685
|
+
|
686
|
+
</li>
|
687
|
+
|
688
|
+
|
689
|
+
<li class="public ">
|
690
|
+
<span class="summary_signature">
|
691
|
+
|
692
|
+
<a href="#register_new_user-instance_method" title="#register_new_user (instance method)">- (Object) <strong>register_new_user</strong>(email, password) </a>
|
693
|
+
|
694
|
+
|
695
|
+
|
696
|
+
</span>
|
697
|
+
|
698
|
+
|
699
|
+
|
700
|
+
|
701
|
+
|
702
|
+
|
703
|
+
|
704
|
+
|
705
|
+
<span class="summary_desc"><div class='inline'><p>
|
706
|
+
Register a new user.
|
707
|
+
</p>
|
708
|
+
</div></span>
|
709
|
+
|
710
|
+
</li>
|
711
|
+
|
712
|
+
|
713
|
+
<li class="public ">
|
714
|
+
<span class="summary_signature">
|
715
|
+
|
716
|
+
<a href="#rename-instance_method" title="#rename (instance method)">- (Object) <strong>rename</strong>(target, target_id, new_name) </a>
|
717
|
+
|
718
|
+
|
719
|
+
|
720
|
+
</span>
|
721
|
+
|
722
|
+
|
723
|
+
|
724
|
+
|
725
|
+
|
726
|
+
|
727
|
+
|
728
|
+
|
729
|
+
<span class="summary_desc"><div class='inline'><p>
|
730
|
+
Rename the item.
|
731
|
+
</p>
|
732
|
+
</div></span>
|
733
|
+
|
734
|
+
</li>
|
735
|
+
|
736
|
+
|
737
|
+
<li class="public ">
|
738
|
+
<span class="summary_signature">
|
739
|
+
|
740
|
+
<a href="#set_auth_token-instance_method" title="#set_auth_token (instance method)">- (Object) <strong>set_auth_token</strong>(auth_token) </a>
|
741
|
+
|
742
|
+
|
743
|
+
|
744
|
+
</span>
|
745
|
+
|
746
|
+
|
747
|
+
|
748
|
+
|
749
|
+
|
750
|
+
|
751
|
+
|
752
|
+
|
753
|
+
<span class="summary_desc"><div class='inline'><p>
|
754
|
+
Add the auth token to every request.
|
755
|
+
</p>
|
756
|
+
</div></span>
|
757
|
+
|
758
|
+
</li>
|
759
|
+
|
760
|
+
|
761
|
+
<li class="public ">
|
762
|
+
<span class="summary_signature">
|
763
|
+
|
764
|
+
<a href="#set_description-instance_method" title="#set_description (instance method)">- (Object) <strong>set_description</strong>(target, target_id, description) </a>
|
765
|
+
|
766
|
+
|
767
|
+
|
768
|
+
</span>
|
769
|
+
|
770
|
+
|
771
|
+
|
772
|
+
|
773
|
+
|
774
|
+
|
775
|
+
|
776
|
+
|
777
|
+
<span class="summary_desc"><div class='inline'><p>
|
778
|
+
Set the item description.
|
779
|
+
</p>
|
780
|
+
</div></span>
|
781
|
+
|
782
|
+
</li>
|
783
|
+
|
784
|
+
|
785
|
+
<li class="public ">
|
786
|
+
<span class="summary_signature">
|
787
|
+
|
788
|
+
<a href="#upload-instance_method" title="#upload (instance method)">- (Object) <strong>upload</strong>(path, folder_id, new_copy = false) </a>
|
789
|
+
|
790
|
+
|
791
|
+
|
792
|
+
</span>
|
793
|
+
|
794
|
+
|
795
|
+
|
796
|
+
|
797
|
+
|
798
|
+
|
799
|
+
|
800
|
+
|
801
|
+
<span class="summary_desc"><div class='inline'><p>
|
802
|
+
Upload the file to the specified folder.
|
803
|
+
</p>
|
804
|
+
</div></span>
|
805
|
+
|
806
|
+
</li>
|
807
|
+
|
808
|
+
|
809
|
+
<li class="public ">
|
810
|
+
<span class="summary_signature">
|
811
|
+
|
812
|
+
<a href="#verify_registration_email-instance_method" title="#verify_registration_email (instance method)">- (Object) <strong>verify_registration_email</strong>(email) </a>
|
813
|
+
|
814
|
+
|
815
|
+
|
816
|
+
</span>
|
817
|
+
|
818
|
+
|
819
|
+
|
820
|
+
|
821
|
+
|
822
|
+
|
823
|
+
|
824
|
+
|
825
|
+
<span class="summary_desc"><div class='inline'><p>
|
826
|
+
Verify a registration email.
|
827
|
+
</p>
|
828
|
+
</div></span>
|
829
|
+
|
830
|
+
</li>
|
831
|
+
|
832
|
+
|
833
|
+
</ul>
|
834
|
+
|
835
|
+
|
836
|
+
|
837
|
+
<div id="constructor_details" class="method_details_list">
|
838
|
+
<h2>Constructor Details</h2>
|
839
|
+
|
840
|
+
<div class="method_details first">
|
841
|
+
<p class="signature first" id="initialize-instance_method">
|
842
|
+
|
843
|
+
- (<tt><span class='object_link'><a href="" title="Box::Api (class)">Api</a></span></tt>) <strong>initialize</strong>(key, url = 'https://box.net', upload_url = 'https://upload.box.net', version = '1.0')
|
844
|
+
|
845
|
+
|
846
|
+
|
847
|
+
</p><div class="docstring">
|
848
|
+
<div class="discussion">
|
849
|
+
|
850
|
+
<div class="note notetag">
|
851
|
+
<strong>Note:</strong>
|
852
|
+
<div class='inline'><p>
|
853
|
+
Chances are that if the Box api is updated or moves location, this class
|
854
|
+
will no longer work. However, the option to change the defaults still
|
855
|
+
remains.
|
856
|
+
</p>
|
857
|
+
</div>
|
858
|
+
</div>
|
859
|
+
|
860
|
+
<p>
|
861
|
+
Create a new API object using the given parameters.
|
862
|
+
</p>
|
863
|
+
|
864
|
+
|
865
|
+
</div>
|
866
|
+
</div>
|
867
|
+
<div class="tags">
|
868
|
+
<h3>Parameters:</h3>
|
869
|
+
<ul class="param">
|
870
|
+
|
871
|
+
<li>
|
872
|
+
|
873
|
+
<span class='name'>api_key</span>
|
874
|
+
|
875
|
+
|
876
|
+
<span class='type'>(<tt>String</tt>, <tt><span class='object_link'><a href="" title="Box::Api (class)">Api</a></span></tt>)</span>
|
877
|
+
|
878
|
+
|
879
|
+
|
880
|
+
—
|
881
|
+
<div class='inline'><p>
|
882
|
+
The api key for your application. You can request one on the Box developer
|
883
|
+
website at <a href="http://www.box.net/developers/services" target="_parent" title="http://www.box.net/developers/services">http://www.box.net/developers/services</a>. If an <span class='object_link'><a href="" title="Box::Api (class)">Box::Api</a></span> instance
|
884
|
+
is passed instead, its key is used.
|
885
|
+
</p>
|
886
|
+
</div>
|
887
|
+
|
888
|
+
</li>
|
889
|
+
|
890
|
+
<li>
|
891
|
+
|
892
|
+
<span class='name'>url</span>
|
893
|
+
|
894
|
+
|
895
|
+
<span class='type'>(<tt>String</tt>)</span>
|
896
|
+
|
897
|
+
|
898
|
+
<em class="default">(defaults to: <tt>'https://box.net'</tt>)</em>
|
899
|
+
|
900
|
+
|
901
|
+
—
|
902
|
+
<div class='inline'><p>
|
903
|
+
the url of the Box api.
|
904
|
+
</p>
|
905
|
+
</div>
|
906
|
+
|
907
|
+
</li>
|
908
|
+
|
909
|
+
<li>
|
910
|
+
|
911
|
+
<span class='name'>upload_url</span>
|
912
|
+
|
913
|
+
|
914
|
+
<span class='type'>(<tt>String</tt>)</span>
|
915
|
+
|
916
|
+
|
917
|
+
<em class="default">(defaults to: <tt>'https://upload.box.net'</tt>)</em>
|
918
|
+
|
919
|
+
|
920
|
+
—
|
921
|
+
<div class='inline'><p>
|
922
|
+
the url of the upload host for the Box api.
|
923
|
+
</p>
|
924
|
+
</div>
|
925
|
+
|
926
|
+
</li>
|
927
|
+
|
928
|
+
<li>
|
929
|
+
|
930
|
+
<span class='name'>version</span>
|
931
|
+
|
932
|
+
|
933
|
+
<span class='type'>(<tt>String</tt>)</span>
|
934
|
+
|
935
|
+
|
936
|
+
<em class="default">(defaults to: <tt>'1.0'</tt>)</em>
|
937
|
+
|
938
|
+
|
939
|
+
—
|
940
|
+
<div class='inline'><p>
|
941
|
+
the version of the Box api in use.
|
942
|
+
</p>
|
943
|
+
</div>
|
944
|
+
|
945
|
+
</li>
|
946
|
+
|
947
|
+
</ul>
|
948
|
+
|
949
|
+
</div><table class="source_code">
|
950
|
+
<tr>
|
951
|
+
<td>
|
952
|
+
<pre class="lines">
|
953
|
+
|
954
|
+
|
955
|
+
36
|
956
|
+
37
|
957
|
+
38
|
958
|
+
39
|
959
|
+
40
|
960
|
+
41</pre>
|
961
|
+
</td>
|
962
|
+
<td>
|
963
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 36</span>
|
964
|
+
|
965
|
+
<span class='kw'>def</span> <span class='id initialize'>initialize</span><span class='lparen'>(</span><span class='id key'>key</span><span class='comma'>,</span> <span class='id url'>url</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>https://box.net</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id upload_url'>upload_url</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>https://upload.box.net</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id version'>version</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>1.0</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
966
|
+
<span class='ivar'>@default_params</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='symbol'>:api_key</span> <span class='op'>=></span> <span class='id key'>key</span> <span class='rbrace'>}</span> <span class='comment'># add the api_key to every query
|
967
|
+
</span>
|
968
|
+
<span class='ivar'>@base_url</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span> <span class='id url'>url</span> <span class='rbrace'>}</span><span class='tstring_content'>/api/</span><span class='embexpr_beg'>#{</span> <span class='id version'>version</span> <span class='rbrace'>}</span><span class='tstring_end'>"</span></span> <span class='comment'># set the base of the request url
|
969
|
+
</span> <span class='ivar'>@upload_url</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span> <span class='id upload_url'>upload_url</span> <span class='rbrace'>}</span><span class='tstring_content'>/api/</span><span class='embexpr_beg'>#{</span> <span class='id version'>version</span> <span class='rbrace'>}</span><span class='tstring_end'>"</span></span> <span class='comment'># uploads use a different url than everything else
|
970
|
+
</span><span class='kw'>end</span></pre>
|
971
|
+
</td>
|
972
|
+
</tr>
|
973
|
+
</table>
|
974
|
+
</div>
|
975
|
+
|
976
|
+
</div>
|
977
|
+
|
978
|
+
<div id="instance_attr_details" class="attr_details">
|
979
|
+
<h2>Instance Attribute Details</h2>
|
980
|
+
|
981
|
+
|
982
|
+
<span id="base_url=-instance_method"></span>
|
983
|
+
<span id="base_url-instance_method"></span>
|
984
|
+
<div class="method_details first">
|
985
|
+
<p class="signature first" id="base_url-instance_method">
|
986
|
+
|
987
|
+
- (<tt>String</tt>) <strong>base_url</strong>
|
988
|
+
|
989
|
+
|
990
|
+
|
991
|
+
</p><div class="docstring">
|
992
|
+
<div class="discussion">
|
993
|
+
<p>
|
994
|
+
The base url of the box api.
|
995
|
+
</p>
|
996
|
+
|
997
|
+
|
998
|
+
</div>
|
999
|
+
</div>
|
1000
|
+
<div class="tags">
|
1001
|
+
<h3>Returns:</h3>
|
1002
|
+
<ul class="return">
|
1003
|
+
|
1004
|
+
<li>
|
1005
|
+
|
1006
|
+
|
1007
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1008
|
+
|
1009
|
+
|
1010
|
+
|
1011
|
+
—
|
1012
|
+
<div class='inline'><p>
|
1013
|
+
The base url of the box api.
|
1014
|
+
</p>
|
1015
|
+
</div>
|
1016
|
+
|
1017
|
+
</li>
|
1018
|
+
|
1019
|
+
</ul>
|
1020
|
+
|
1021
|
+
</div><table class="source_code">
|
1022
|
+
<tr>
|
1023
|
+
<td>
|
1024
|
+
<pre class="lines">
|
1025
|
+
|
1026
|
+
|
1027
|
+
16
|
1028
|
+
17
|
1029
|
+
18</pre>
|
1030
|
+
</td>
|
1031
|
+
<td>
|
1032
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 16</span>
|
1033
|
+
|
1034
|
+
<span class='kw'>def</span> <span class='id base_url'>base_url</span>
|
1035
|
+
<span class='ivar'>@base_url</span>
|
1036
|
+
<span class='kw'>end</span></pre>
|
1037
|
+
</td>
|
1038
|
+
</tr>
|
1039
|
+
</table>
|
1040
|
+
</div>
|
1041
|
+
|
1042
|
+
|
1043
|
+
<span id="upload_url=-instance_method"></span>
|
1044
|
+
<span id="upload_url-instance_method"></span>
|
1045
|
+
<div class="method_details ">
|
1046
|
+
<p class="signature " id="upload_url-instance_method">
|
1047
|
+
|
1048
|
+
- (<tt>String</tt>) <strong>upload_url</strong>
|
1049
|
+
|
1050
|
+
|
1051
|
+
|
1052
|
+
</p><div class="docstring">
|
1053
|
+
<div class="discussion">
|
1054
|
+
<p>
|
1055
|
+
The upload url of the box api.
|
1056
|
+
</p>
|
1057
|
+
|
1058
|
+
|
1059
|
+
</div>
|
1060
|
+
</div>
|
1061
|
+
<div class="tags">
|
1062
|
+
<h3>Returns:</h3>
|
1063
|
+
<ul class="return">
|
1064
|
+
|
1065
|
+
<li>
|
1066
|
+
|
1067
|
+
|
1068
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1069
|
+
|
1070
|
+
|
1071
|
+
|
1072
|
+
—
|
1073
|
+
<div class='inline'><p>
|
1074
|
+
The upload url of the box api.
|
1075
|
+
</p>
|
1076
|
+
</div>
|
1077
|
+
|
1078
|
+
</li>
|
1079
|
+
|
1080
|
+
</ul>
|
1081
|
+
|
1082
|
+
</div><table class="source_code">
|
1083
|
+
<tr>
|
1084
|
+
<td>
|
1085
|
+
<pre class="lines">
|
1086
|
+
|
1087
|
+
|
1088
|
+
19
|
1089
|
+
20
|
1090
|
+
21</pre>
|
1091
|
+
</td>
|
1092
|
+
<td>
|
1093
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 19</span>
|
1094
|
+
|
1095
|
+
<span class='kw'>def</span> <span class='id upload_url'>upload_url</span>
|
1096
|
+
<span class='ivar'>@upload_url</span>
|
1097
|
+
<span class='kw'>end</span></pre>
|
1098
|
+
</td>
|
1099
|
+
</tr>
|
1100
|
+
</table>
|
1101
|
+
</div>
|
1102
|
+
|
1103
|
+
</div>
|
1104
|
+
|
1105
|
+
|
1106
|
+
<div id="class_method_details" class="method_details_list">
|
1107
|
+
<h2>Class Method Details</h2>
|
1108
|
+
|
1109
|
+
|
1110
|
+
<div class="method_details first">
|
1111
|
+
<p class="signature first" id="get_exception-class_method">
|
1112
|
+
|
1113
|
+
+ (<tt><span class='object_link'><a href="Api/Exception.html" title="Box::Api::Exception (class)">Exception</a></span></tt>) <strong>get_exception</strong>(status)
|
1114
|
+
|
1115
|
+
|
1116
|
+
|
1117
|
+
</p><div class="docstring">
|
1118
|
+
<div class="discussion">
|
1119
|
+
<p>
|
1120
|
+
Given a status, returning a cooresponding Exception class.
|
1121
|
+
</p>
|
1122
|
+
|
1123
|
+
|
1124
|
+
</div>
|
1125
|
+
</div>
|
1126
|
+
<div class="tags">
|
1127
|
+
<h3>Parameters:</h3>
|
1128
|
+
<ul class="param">
|
1129
|
+
|
1130
|
+
<li>
|
1131
|
+
|
1132
|
+
<span class='name'>status</span>
|
1133
|
+
|
1134
|
+
|
1135
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1136
|
+
|
1137
|
+
|
1138
|
+
|
1139
|
+
—
|
1140
|
+
<div class='inline'><p>
|
1141
|
+
The failing status to look for.
|
1142
|
+
</p>
|
1143
|
+
</div>
|
1144
|
+
|
1145
|
+
</li>
|
1146
|
+
|
1147
|
+
</ul>
|
1148
|
+
<h3>Returns:</h3>
|
1149
|
+
<ul class="return">
|
1150
|
+
|
1151
|
+
<li>
|
1152
|
+
|
1153
|
+
|
1154
|
+
<span class='type'>(<tt><span class='object_link'><a href="Api/Exception.html" title="Box::Api::Exception (class)">Exception</a></span></tt>)</span>
|
1155
|
+
|
1156
|
+
|
1157
|
+
|
1158
|
+
—
|
1159
|
+
<div class='inline'><p>
|
1160
|
+
A coorespondng Exception.
|
1161
|
+
</p>
|
1162
|
+
</div>
|
1163
|
+
|
1164
|
+
</li>
|
1165
|
+
|
1166
|
+
</ul>
|
1167
|
+
|
1168
|
+
</div><table class="source_code">
|
1169
|
+
<tr>
|
1170
|
+
<td>
|
1171
|
+
<pre class="lines">
|
1172
|
+
|
1173
|
+
|
1174
|
+
36
|
1175
|
+
37
|
1176
|
+
38
|
1177
|
+
39
|
1178
|
+
40
|
1179
|
+
41
|
1180
|
+
42
|
1181
|
+
43
|
1182
|
+
44
|
1183
|
+
45
|
1184
|
+
46
|
1185
|
+
47
|
1186
|
+
48
|
1187
|
+
49
|
1188
|
+
50
|
1189
|
+
51
|
1190
|
+
52
|
1191
|
+
53
|
1192
|
+
54
|
1193
|
+
55
|
1194
|
+
56
|
1195
|
+
57
|
1196
|
+
58
|
1197
|
+
59
|
1198
|
+
60
|
1199
|
+
61
|
1200
|
+
62
|
1201
|
+
63
|
1202
|
+
64
|
1203
|
+
65
|
1204
|
+
66
|
1205
|
+
67
|
1206
|
+
68
|
1207
|
+
69
|
1208
|
+
70
|
1209
|
+
71
|
1210
|
+
72
|
1211
|
+
73
|
1212
|
+
74
|
1213
|
+
75
|
1214
|
+
76
|
1215
|
+
77</pre>
|
1216
|
+
</td>
|
1217
|
+
<td>
|
1218
|
+
<pre class="code"><span class="info file"># File 'lib/box/api/exceptions.rb', line 36</span>
|
1219
|
+
|
1220
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id get_exception'>get_exception</span><span class='lparen'>(</span><span class='id status'>status</span><span class='rparen'>)</span>
|
1221
|
+
<span class='kw'>case</span> <span class='id status'>status</span>
|
1222
|
+
<span class='comment'># Common responses
|
1223
|
+
</span> <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>application_restricted</span><span class='tstring_end'>"</span></span>
|
1224
|
+
<span class='const'>Restricted</span>
|
1225
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>wrong_input</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Wrong input params</span><span class='tstring_end'>"</span></span>
|
1226
|
+
<span class='const'>InvalidInput</span>
|
1227
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>not_logged_in</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>wrong auth token</span><span class='tstring_end'>"</span></span>
|
1228
|
+
<span class='const'>NotAuthorized</span>
|
1229
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>e_no_access</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>e_access_denied</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>access_denied</span><span class='tstring_end'>"</span></span>
|
1230
|
+
<span class='const'>NoAccess</span>
|
1231
|
+
<span class='comment'># Registration specific responses
|
1232
|
+
</span> <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>email_invalid</span><span class='tstring_end'>"</span></span>
|
1233
|
+
<span class='const'>EmailInvalid</span>
|
1234
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>email_already_registered</span><span class='tstring_end'>"</span></span>
|
1235
|
+
<span class='const'>EmailTaken</span>
|
1236
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>get_auth_token_error</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>e_register</span><span class='tstring_end'>"</span></span>
|
1237
|
+
<span class='const'>Generic</span>
|
1238
|
+
<span class='comment'># Folder/File specific responses
|
1239
|
+
</span> <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>e_folder_id</span><span class='tstring_end'>"</span></span>
|
1240
|
+
<span class='const'>InvalidFolder</span>
|
1241
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>no_parent</span><span class='tstring_end'>"</span></span>
|
1242
|
+
<span class='const'>NoParent</span>
|
1243
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>invalid_folder_name</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>e_no_folder_name</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>folder_name_too_big</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>upload_invalid_file_name</span><span class='tstring_end'>"</span></span>
|
1244
|
+
<span class='const'>InvalidName</span>
|
1245
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>e_input_params</span><span class='tstring_end'>"</span></span>
|
1246
|
+
<span class='const'>InvalidInput</span>
|
1247
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>e_filename_in_use</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>s_folder_exists</span><span class='tstring_end'>"</span></span>
|
1248
|
+
<span class='const'>NameTaken</span>
|
1249
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>e_move_node</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>e_copy_node</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>e_rename_node</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>e_set_description</span><span class='tstring_end'>"</span></span>
|
1250
|
+
<span class='const'>Generic</span>
|
1251
|
+
<span class='comment'># Upload/Download specific responses
|
1252
|
+
</span> <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>upload_some_files_failed</span><span class='tstring_end'>"</span></span>
|
1253
|
+
<span class='const'>UploadFailed</span>
|
1254
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>not_enough_free_space</span><span class='tstring_end'>"</span></span>
|
1255
|
+
<span class='const'>AccountExceeded</span>
|
1256
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>filesize_limit_exceeded</span><span class='tstring_end'>"</span></span>
|
1257
|
+
<span class='const'>SizeExceeded</span>
|
1258
|
+
<span class='kw'>else</span>
|
1259
|
+
<span class='const'>Unknown</span>
|
1260
|
+
<span class='kw'>end</span>
|
1261
|
+
<span class='kw'>end</span></pre>
|
1262
|
+
</td>
|
1263
|
+
</tr>
|
1264
|
+
</table>
|
1265
|
+
</div>
|
1266
|
+
|
1267
|
+
</div>
|
1268
|
+
|
1269
|
+
<div id="instance_method_details" class="method_details_list">
|
1270
|
+
<h2>Instance Method Details</h2>
|
1271
|
+
|
1272
|
+
|
1273
|
+
<div class="method_details first">
|
1274
|
+
<p class="signature first" id="copy-instance_method">
|
1275
|
+
|
1276
|
+
- (<tt>Object</tt>) <strong>copy</strong>(target, target_id, destination_id)
|
1277
|
+
|
1278
|
+
|
1279
|
+
|
1280
|
+
</p><div class="docstring">
|
1281
|
+
<div class="discussion">
|
1282
|
+
|
1283
|
+
<div class="note notetag">
|
1284
|
+
<strong>Note:</strong>
|
1285
|
+
<div class='inline'><p>
|
1286
|
+
The api currently only supports copying files.
|
1287
|
+
</p>
|
1288
|
+
</div>
|
1289
|
+
</div>
|
1290
|
+
|
1291
|
+
<p>
|
1292
|
+
Copy the the item to a new destination.
|
1293
|
+
</p>
|
1294
|
+
|
1295
|
+
|
1296
|
+
</div>
|
1297
|
+
</div>
|
1298
|
+
<div class="tags">
|
1299
|
+
<h3>Parameters:</h3>
|
1300
|
+
<ul class="param">
|
1301
|
+
|
1302
|
+
<li>
|
1303
|
+
|
1304
|
+
<span class='name'>target</span>
|
1305
|
+
|
1306
|
+
|
1307
|
+
<span class='type'>(<tt>"file"</tt>)</span>
|
1308
|
+
|
1309
|
+
|
1310
|
+
|
1311
|
+
—
|
1312
|
+
<div class='inline'><p>
|
1313
|
+
The type of item.
|
1314
|
+
</p>
|
1315
|
+
</div>
|
1316
|
+
|
1317
|
+
</li>
|
1318
|
+
|
1319
|
+
<li>
|
1320
|
+
|
1321
|
+
<span class='name'>target_id</span>
|
1322
|
+
|
1323
|
+
|
1324
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1325
|
+
|
1326
|
+
|
1327
|
+
|
1328
|
+
—
|
1329
|
+
<div class='inline'><p>
|
1330
|
+
The id of the item to copy.
|
1331
|
+
</p>
|
1332
|
+
</div>
|
1333
|
+
|
1334
|
+
</li>
|
1335
|
+
|
1336
|
+
<li>
|
1337
|
+
|
1338
|
+
<span class='name'>destination_id</span>
|
1339
|
+
|
1340
|
+
|
1341
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1342
|
+
|
1343
|
+
|
1344
|
+
|
1345
|
+
—
|
1346
|
+
<div class='inline'><p>
|
1347
|
+
The id of the parent to copy to.
|
1348
|
+
</p>
|
1349
|
+
</div>
|
1350
|
+
|
1351
|
+
</li>
|
1352
|
+
|
1353
|
+
</ul>
|
1354
|
+
|
1355
|
+
</div><table class="source_code">
|
1356
|
+
<tr>
|
1357
|
+
<td>
|
1358
|
+
<pre class="lines">
|
1359
|
+
|
1360
|
+
|
1361
|
+
222
|
1362
|
+
223
|
1363
|
+
224</pre>
|
1364
|
+
</td>
|
1365
|
+
<td>
|
1366
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 222</span>
|
1367
|
+
|
1368
|
+
<span class='kw'>def</span> <span class='id copy'>copy</span><span class='lparen'>(</span><span class='id target'>target</span><span class='comma'>,</span> <span class='id target_id'>target_id</span><span class='comma'>,</span> <span class='id destination_id'>destination_id</span><span class='rparen'>)</span>
|
1369
|
+
<span class='id query_rest'>query_rest</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>s_copy_node</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:action</span> <span class='op'>=></span> <span class='symbol'>:copy</span><span class='comma'>,</span> <span class='symbol'>:target</span> <span class='op'>=></span> <span class='id target'>target</span><span class='comma'>,</span> <span class='symbol'>:target_id</span> <span class='op'>=></span> <span class='id target_id'>target_id</span><span class='comma'>,</span> <span class='symbol'>:destination_id</span> <span class='op'>=></span> <span class='id destination_id'>destination_id</span><span class='rparen'>)</span>
|
1370
|
+
<span class='kw'>end</span></pre>
|
1371
|
+
</td>
|
1372
|
+
</tr>
|
1373
|
+
</table>
|
1374
|
+
</div>
|
1375
|
+
|
1376
|
+
<div class="method_details ">
|
1377
|
+
<p class="signature " id="create_folder-instance_method">
|
1378
|
+
|
1379
|
+
- (<tt>Object</tt>) <strong>create_folder</strong>(parent_id, name, share = 0)
|
1380
|
+
|
1381
|
+
|
1382
|
+
|
1383
|
+
</p><div class="docstring">
|
1384
|
+
<div class="discussion">
|
1385
|
+
<p>
|
1386
|
+
Create a new folder.
|
1387
|
+
</p>
|
1388
|
+
|
1389
|
+
|
1390
|
+
</div>
|
1391
|
+
</div>
|
1392
|
+
<div class="tags">
|
1393
|
+
<h3>Parameters:</h3>
|
1394
|
+
<ul class="param">
|
1395
|
+
|
1396
|
+
<li>
|
1397
|
+
|
1398
|
+
<span class='name'>parent_id</span>
|
1399
|
+
|
1400
|
+
|
1401
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1402
|
+
|
1403
|
+
|
1404
|
+
|
1405
|
+
—
|
1406
|
+
<div class='inline'><p>
|
1407
|
+
The id of the parent folder to use.
|
1408
|
+
</p>
|
1409
|
+
</div>
|
1410
|
+
|
1411
|
+
</li>
|
1412
|
+
|
1413
|
+
<li>
|
1414
|
+
|
1415
|
+
<span class='name'>name</span>
|
1416
|
+
|
1417
|
+
|
1418
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1419
|
+
|
1420
|
+
|
1421
|
+
|
1422
|
+
—
|
1423
|
+
<div class='inline'><p>
|
1424
|
+
The name of the newly created folder.
|
1425
|
+
</p>
|
1426
|
+
</div>
|
1427
|
+
|
1428
|
+
</li>
|
1429
|
+
|
1430
|
+
<li>
|
1431
|
+
|
1432
|
+
<span class='name'>shared</span>
|
1433
|
+
|
1434
|
+
|
1435
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
1436
|
+
|
1437
|
+
|
1438
|
+
|
1439
|
+
—
|
1440
|
+
<div class='inline'><p>
|
1441
|
+
The shared state of the new folder.
|
1442
|
+
</p>
|
1443
|
+
</div>
|
1444
|
+
|
1445
|
+
</li>
|
1446
|
+
|
1447
|
+
</ul>
|
1448
|
+
|
1449
|
+
</div><table class="source_code">
|
1450
|
+
<tr>
|
1451
|
+
<td>
|
1452
|
+
<pre class="lines">
|
1453
|
+
|
1454
|
+
|
1455
|
+
202
|
1456
|
+
203
|
1457
|
+
204</pre>
|
1458
|
+
</td>
|
1459
|
+
<td>
|
1460
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 202</span>
|
1461
|
+
|
1462
|
+
<span class='kw'>def</span> <span class='id create_folder'>create_folder</span><span class='lparen'>(</span><span class='id parent_id'>parent_id</span><span class='comma'>,</span> <span class='id name'>name</span><span class='comma'>,</span> <span class='id share'>share</span> <span class='op'>=</span> <span class='int'>0</span><span class='rparen'>)</span>
|
1463
|
+
<span class='id query_rest'>query_rest</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>create_ok</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:action</span> <span class='op'>=></span> <span class='symbol'>:create_folder</span><span class='comma'>,</span> <span class='symbol'>:parent_id</span> <span class='op'>=></span> <span class='id parent_id'>parent_id</span><span class='comma'>,</span> <span class='symbol'>:name</span> <span class='op'>=></span> <span class='id name'>name</span><span class='comma'>,</span> <span class='symbol'>:share</span> <span class='op'>=></span> <span class='id share'>share</span><span class='rparen'>)</span>
|
1464
|
+
<span class='kw'>end</span></pre>
|
1465
|
+
</td>
|
1466
|
+
</tr>
|
1467
|
+
</table>
|
1468
|
+
</div>
|
1469
|
+
|
1470
|
+
<div class="method_details ">
|
1471
|
+
<p class="signature " id="delete-instance_method">
|
1472
|
+
|
1473
|
+
- (<tt>Object</tt>) <strong>delete</strong>(target, target_id)
|
1474
|
+
|
1475
|
+
|
1476
|
+
|
1477
|
+
</p><div class="docstring">
|
1478
|
+
<div class="discussion">
|
1479
|
+
<p>
|
1480
|
+
Delete the item.
|
1481
|
+
</p>
|
1482
|
+
|
1483
|
+
|
1484
|
+
</div>
|
1485
|
+
</div>
|
1486
|
+
<div class="tags">
|
1487
|
+
<h3>Parameters:</h3>
|
1488
|
+
<ul class="param">
|
1489
|
+
|
1490
|
+
<li>
|
1491
|
+
|
1492
|
+
<span class='name'>target</span>
|
1493
|
+
|
1494
|
+
|
1495
|
+
<span class='type'>(<tt>"file"</tt>, <tt>"folder"</tt>)</span>
|
1496
|
+
|
1497
|
+
|
1498
|
+
|
1499
|
+
—
|
1500
|
+
<div class='inline'><p>
|
1501
|
+
The type of item.
|
1502
|
+
</p>
|
1503
|
+
</div>
|
1504
|
+
|
1505
|
+
</li>
|
1506
|
+
|
1507
|
+
<li>
|
1508
|
+
|
1509
|
+
<span class='name'>target_id</span>
|
1510
|
+
|
1511
|
+
|
1512
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1513
|
+
|
1514
|
+
|
1515
|
+
|
1516
|
+
—
|
1517
|
+
<div class='inline'><p>
|
1518
|
+
The id of the item to delete.
|
1519
|
+
</p>
|
1520
|
+
</div>
|
1521
|
+
|
1522
|
+
</li>
|
1523
|
+
|
1524
|
+
</ul>
|
1525
|
+
|
1526
|
+
</div><table class="source_code">
|
1527
|
+
<tr>
|
1528
|
+
<td>
|
1529
|
+
<pre class="lines">
|
1530
|
+
|
1531
|
+
|
1532
|
+
239
|
1533
|
+
240
|
1534
|
+
241</pre>
|
1535
|
+
</td>
|
1536
|
+
<td>
|
1537
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 239</span>
|
1538
|
+
|
1539
|
+
<span class='kw'>def</span> <span class='id delete'>delete</span><span class='lparen'>(</span><span class='id target'>target</span><span class='comma'>,</span> <span class='id target_id'>target_id</span><span class='rparen'>)</span>
|
1540
|
+
<span class='id query_rest'>query_rest</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>s_delete_node</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:action</span> <span class='op'>=></span> <span class='symbol'>:delete</span><span class='comma'>,</span> <span class='symbol'>:target</span> <span class='op'>=></span> <span class='id target'>target</span><span class='comma'>,</span> <span class='symbol'>:target_id</span> <span class='op'>=></span> <span class='id target_id'>target_id</span><span class='rparen'>)</span>
|
1541
|
+
<span class='kw'>end</span></pre>
|
1542
|
+
</td>
|
1543
|
+
</tr>
|
1544
|
+
</table>
|
1545
|
+
</div>
|
1546
|
+
|
1547
|
+
<div class="method_details ">
|
1548
|
+
<p class="signature " id="download-instance_method">
|
1549
|
+
|
1550
|
+
- (<tt>Object</tt>) <strong>download</strong>(path, file_id, version = nil)
|
1551
|
+
|
1552
|
+
|
1553
|
+
|
1554
|
+
</p><div class="docstring">
|
1555
|
+
<div class="discussion">
|
1556
|
+
|
1557
|
+
<div class="note notetag">
|
1558
|
+
<strong>Note:</strong>
|
1559
|
+
<div class='inline'><p>
|
1560
|
+
You cannot download folders.
|
1561
|
+
</p>
|
1562
|
+
</div>
|
1563
|
+
</div>
|
1564
|
+
|
1565
|
+
<p>
|
1566
|
+
Download the file to the given path.
|
1567
|
+
</p>
|
1568
|
+
|
1569
|
+
|
1570
|
+
</div>
|
1571
|
+
</div>
|
1572
|
+
<div class="tags">
|
1573
|
+
<h3>Parameters:</h3>
|
1574
|
+
<ul class="param">
|
1575
|
+
|
1576
|
+
<li>
|
1577
|
+
|
1578
|
+
<span class='name'>path</span>
|
1579
|
+
|
1580
|
+
|
1581
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1582
|
+
|
1583
|
+
|
1584
|
+
|
1585
|
+
—
|
1586
|
+
<div class='inline'><p>
|
1587
|
+
The path to write the file to.
|
1588
|
+
</p>
|
1589
|
+
</div>
|
1590
|
+
|
1591
|
+
</li>
|
1592
|
+
|
1593
|
+
<li>
|
1594
|
+
|
1595
|
+
<span class='name'>file_id</span>
|
1596
|
+
|
1597
|
+
|
1598
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1599
|
+
|
1600
|
+
|
1601
|
+
|
1602
|
+
—
|
1603
|
+
<div class='inline'><p>
|
1604
|
+
The file id to download.
|
1605
|
+
</p>
|
1606
|
+
</div>
|
1607
|
+
|
1608
|
+
</li>
|
1609
|
+
|
1610
|
+
<li>
|
1611
|
+
|
1612
|
+
<span class='name'>version</span>
|
1613
|
+
|
1614
|
+
|
1615
|
+
<span class='type'>(<tt>Optional</tt>, <tt>String</tt>)</span>
|
1616
|
+
|
1617
|
+
|
1618
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1619
|
+
|
1620
|
+
|
1621
|
+
—
|
1622
|
+
<div class='inline'><p>
|
1623
|
+
The version of the file to download.
|
1624
|
+
</p>
|
1625
|
+
</div>
|
1626
|
+
|
1627
|
+
</li>
|
1628
|
+
|
1629
|
+
</ul>
|
1630
|
+
|
1631
|
+
</div><table class="source_code">
|
1632
|
+
<tr>
|
1633
|
+
<td>
|
1634
|
+
<pre class="lines">
|
1635
|
+
|
1636
|
+
|
1637
|
+
266
|
1638
|
+
267
|
1639
|
+
268
|
1640
|
+
269
|
1641
|
+
270</pre>
|
1642
|
+
</td>
|
1643
|
+
<td>
|
1644
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 266</span>
|
1645
|
+
|
1646
|
+
<span class='kw'>def</span> <span class='id download'>download</span><span class='lparen'>(</span><span class='id path'>path</span><span class='comma'>,</span> <span class='id file_id'>file_id</span><span class='comma'>,</span> <span class='id version'>version</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1647
|
+
<span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id open'>open</span><span class='lparen'>(</span><span class='id path'>path</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>w</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id file'>file</span><span class='op'>|</span>
|
1648
|
+
<span class='id file'>file</span> <span class='op'><<</span> <span class='id query_download'>query_download</span><span class='lparen'>(</span><span class='lbracket'>[</span> <span class='id file_id'>file_id</span><span class='comma'>,</span> <span class='id version'>version</span> <span class='rbracket'>]</span><span class='rparen'>)</span> <span class='comment'># write the response directly to file
|
1649
|
+
</span> <span class='kw'>end</span>
|
1650
|
+
<span class='kw'>end</span></pre>
|
1651
|
+
</td>
|
1652
|
+
</tr>
|
1653
|
+
</table>
|
1654
|
+
</div>
|
1655
|
+
|
1656
|
+
<div class="method_details ">
|
1657
|
+
<p class="signature " id="get_account_info-instance_method">
|
1658
|
+
|
1659
|
+
- (<tt>Object</tt>) <strong>get_account_info</strong>
|
1660
|
+
|
1661
|
+
|
1662
|
+
|
1663
|
+
</p><div class="docstring">
|
1664
|
+
<div class="discussion">
|
1665
|
+
<p>
|
1666
|
+
Get the user’s account info.
|
1667
|
+
</p>
|
1668
|
+
|
1669
|
+
|
1670
|
+
</div>
|
1671
|
+
</div>
|
1672
|
+
<div class="tags">
|
1673
|
+
|
1674
|
+
</div><table class="source_code">
|
1675
|
+
<tr>
|
1676
|
+
<td>
|
1677
|
+
<pre class="lines">
|
1678
|
+
|
1679
|
+
|
1680
|
+
180
|
1681
|
+
181
|
1682
|
+
182</pre>
|
1683
|
+
</td>
|
1684
|
+
<td>
|
1685
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 180</span>
|
1686
|
+
|
1687
|
+
<span class='kw'>def</span> <span class='id get_account_info'>get_account_info</span>
|
1688
|
+
<span class='id query_rest'>query_rest</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>get_account_info_ok</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:action</span> <span class='op'>=></span> <span class='symbol'>:get_account_info</span><span class='rparen'>)</span>
|
1689
|
+
<span class='kw'>end</span></pre>
|
1690
|
+
</td>
|
1691
|
+
</tr>
|
1692
|
+
</table>
|
1693
|
+
</div>
|
1694
|
+
|
1695
|
+
<div class="method_details ">
|
1696
|
+
<p class="signature " id="get_account_tree-instance_method">
|
1697
|
+
|
1698
|
+
- (<tt>Object</tt>) <strong>get_account_tree</strong>(folder_id, *args)
|
1699
|
+
|
1700
|
+
|
1701
|
+
|
1702
|
+
</p><div class="docstring">
|
1703
|
+
<div class="discussion">
|
1704
|
+
|
1705
|
+
<div class="note todo">
|
1706
|
+
<strong>TODO:</strong>
|
1707
|
+
<div class='inline'><p>
|
1708
|
+
Use zip compression to save bandwidth.
|
1709
|
+
</p>
|
1710
|
+
</div>
|
1711
|
+
</div>
|
1712
|
+
|
1713
|
+
|
1714
|
+
<div class="note notetag">
|
1715
|
+
<strong>Note:</strong>
|
1716
|
+
<div class='inline'><p>
|
1717
|
+
This function can take a long time for large folders.
|
1718
|
+
</p>
|
1719
|
+
</div>
|
1720
|
+
</div>
|
1721
|
+
|
1722
|
+
<p>
|
1723
|
+
Get the entire tree of a given folder.
|
1724
|
+
</p>
|
1725
|
+
<p>
|
1726
|
+
TODO: document the possible arguments.
|
1727
|
+
</p>
|
1728
|
+
|
1729
|
+
|
1730
|
+
</div>
|
1731
|
+
</div>
|
1732
|
+
<div class="tags">
|
1733
|
+
<h3>Parameters:</h3>
|
1734
|
+
<ul class="param">
|
1735
|
+
|
1736
|
+
<li>
|
1737
|
+
|
1738
|
+
<span class='name'>folder_id</span>
|
1739
|
+
|
1740
|
+
|
1741
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1742
|
+
|
1743
|
+
|
1744
|
+
|
1745
|
+
—
|
1746
|
+
<div class='inline'><p>
|
1747
|
+
The id of the folder to use.
|
1748
|
+
</p>
|
1749
|
+
</div>
|
1750
|
+
|
1751
|
+
</li>
|
1752
|
+
|
1753
|
+
<li>
|
1754
|
+
|
1755
|
+
<span class='name'>args</span>
|
1756
|
+
|
1757
|
+
|
1758
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
1759
|
+
|
1760
|
+
|
1761
|
+
|
1762
|
+
—
|
1763
|
+
<div class='inline'><p>
|
1764
|
+
The arguments to pass along to get_account_tree.
|
1765
|
+
</p>
|
1766
|
+
</div>
|
1767
|
+
|
1768
|
+
</li>
|
1769
|
+
|
1770
|
+
</ul>
|
1771
|
+
|
1772
|
+
</div><table class="source_code">
|
1773
|
+
<tr>
|
1774
|
+
<td>
|
1775
|
+
<pre class="lines">
|
1776
|
+
|
1777
|
+
|
1778
|
+
193
|
1779
|
+
194
|
1780
|
+
195</pre>
|
1781
|
+
</td>
|
1782
|
+
<td>
|
1783
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 193</span>
|
1784
|
+
|
1785
|
+
<span class='kw'>def</span> <span class='id get_account_tree'>get_account_tree</span><span class='lparen'>(</span><span class='id folder_id'>folder_id</span><span class='comma'>,</span> <span class='op'>*</span><span class='id args'>args</span><span class='rparen'>)</span>
|
1786
|
+
<span class='id query_rest'>query_rest</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>listing_ok</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:action</span> <span class='op'>=></span> <span class='symbol'>:get_account_tree</span><span class='comma'>,</span> <span class='symbol'>:folder_id</span> <span class='op'>=></span> <span class='id folder_id'>folder_id</span><span class='comma'>,</span> <span class='symbol'>:params</span> <span class='op'>=></span> <span class='lbracket'>[</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>nozip</span><span class='tstring_end'>'</span></span> <span class='rbracket'>]</span> <span class='op'>+</span> <span class='id args'>args</span><span class='rparen'>)</span>
|
1787
|
+
<span class='kw'>end</span></pre>
|
1788
|
+
</td>
|
1789
|
+
</tr>
|
1790
|
+
</table>
|
1791
|
+
</div>
|
1792
|
+
|
1793
|
+
<div class="method_details ">
|
1794
|
+
<p class="signature " id="get_auth_token-instance_method">
|
1795
|
+
|
1796
|
+
- (<tt>Object</tt>) <strong>get_auth_token</strong>(ticket)
|
1797
|
+
|
1798
|
+
|
1799
|
+
|
1800
|
+
</p><div class="docstring">
|
1801
|
+
<div class="discussion">
|
1802
|
+
<p>
|
1803
|
+
Request an auth token given a ticket.
|
1804
|
+
</p>
|
1805
|
+
|
1806
|
+
|
1807
|
+
</div>
|
1808
|
+
</div>
|
1809
|
+
<div class="tags">
|
1810
|
+
<h3>Parameters:</h3>
|
1811
|
+
<ul class="param">
|
1812
|
+
|
1813
|
+
<li>
|
1814
|
+
|
1815
|
+
<span class='name'>ticket</span>
|
1816
|
+
|
1817
|
+
|
1818
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1819
|
+
|
1820
|
+
|
1821
|
+
|
1822
|
+
—
|
1823
|
+
<div class='inline'><p>
|
1824
|
+
the ticket to use.
|
1825
|
+
</p>
|
1826
|
+
</div>
|
1827
|
+
|
1828
|
+
</li>
|
1829
|
+
|
1830
|
+
</ul>
|
1831
|
+
|
1832
|
+
</div><table class="source_code">
|
1833
|
+
<tr>
|
1834
|
+
<td>
|
1835
|
+
<pre class="lines">
|
1836
|
+
|
1837
|
+
|
1838
|
+
147
|
1839
|
+
148
|
1840
|
+
149</pre>
|
1841
|
+
</td>
|
1842
|
+
<td>
|
1843
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 147</span>
|
1844
|
+
|
1845
|
+
<span class='kw'>def</span> <span class='id get_auth_token'>get_auth_token</span><span class='lparen'>(</span><span class='id ticket'>ticket</span><span class='rparen'>)</span>
|
1846
|
+
<span class='id query_rest'>query_rest</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>get_auth_token_ok</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:action</span> <span class='op'>=></span> <span class='symbol'>:get_auth_token</span><span class='comma'>,</span> <span class='symbol'>:ticket</span> <span class='op'>=></span> <span class='id ticket'>ticket</span><span class='rparen'>)</span>
|
1847
|
+
<span class='kw'>end</span></pre>
|
1848
|
+
</td>
|
1849
|
+
</tr>
|
1850
|
+
</table>
|
1851
|
+
</div>
|
1852
|
+
|
1853
|
+
<div class="method_details ">
|
1854
|
+
<p class="signature " id="get_file_info-instance_method">
|
1855
|
+
|
1856
|
+
- (<tt>Object</tt>) <strong>get_file_info</strong>(file_id)
|
1857
|
+
|
1858
|
+
|
1859
|
+
|
1860
|
+
</p><div class="docstring">
|
1861
|
+
<div class="discussion">
|
1862
|
+
<p>
|
1863
|
+
Get the file info.
|
1864
|
+
</p>
|
1865
|
+
|
1866
|
+
|
1867
|
+
</div>
|
1868
|
+
</div>
|
1869
|
+
<div class="tags">
|
1870
|
+
<h3>Parameters:</h3>
|
1871
|
+
<ul class="param">
|
1872
|
+
|
1873
|
+
<li>
|
1874
|
+
|
1875
|
+
<span class='name'>file_id</span>
|
1876
|
+
|
1877
|
+
|
1878
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1879
|
+
|
1880
|
+
|
1881
|
+
|
1882
|
+
—
|
1883
|
+
<div class='inline'><p>
|
1884
|
+
The file id to get info for.
|
1885
|
+
</p>
|
1886
|
+
</div>
|
1887
|
+
|
1888
|
+
</li>
|
1889
|
+
|
1890
|
+
</ul>
|
1891
|
+
|
1892
|
+
</div><table class="source_code">
|
1893
|
+
<tr>
|
1894
|
+
<td>
|
1895
|
+
<pre class="lines">
|
1896
|
+
|
1897
|
+
|
1898
|
+
246
|
1899
|
+
247
|
1900
|
+
248</pre>
|
1901
|
+
</td>
|
1902
|
+
<td>
|
1903
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 246</span>
|
1904
|
+
|
1905
|
+
<span class='kw'>def</span> <span class='id get_file_info'>get_file_info</span><span class='lparen'>(</span><span class='id file_id'>file_id</span><span class='rparen'>)</span>
|
1906
|
+
<span class='id query_rest'>query_rest</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>s_get_file_info</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:action</span> <span class='op'>=></span> <span class='symbol'>:get_file_info</span><span class='comma'>,</span> <span class='symbol'>:file_id</span> <span class='op'>=></span> <span class='id file_id'>file_id</span><span class='rparen'>)</span>
|
1907
|
+
<span class='kw'>end</span></pre>
|
1908
|
+
</td>
|
1909
|
+
</tr>
|
1910
|
+
</table>
|
1911
|
+
</div>
|
1912
|
+
|
1913
|
+
<div class="method_details ">
|
1914
|
+
<p class="signature " id="get_ticket-instance_method">
|
1915
|
+
|
1916
|
+
- (<tt>Object</tt>) <strong>get_ticket</strong>
|
1917
|
+
|
1918
|
+
|
1919
|
+
|
1920
|
+
</p><div class="docstring">
|
1921
|
+
<div class="discussion">
|
1922
|
+
<p>
|
1923
|
+
Request a ticket for authorization
|
1924
|
+
</p>
|
1925
|
+
|
1926
|
+
|
1927
|
+
</div>
|
1928
|
+
</div>
|
1929
|
+
<div class="tags">
|
1930
|
+
|
1931
|
+
</div><table class="source_code">
|
1932
|
+
<tr>
|
1933
|
+
<td>
|
1934
|
+
<pre class="lines">
|
1935
|
+
|
1936
|
+
|
1937
|
+
140
|
1938
|
+
141
|
1939
|
+
142</pre>
|
1940
|
+
</td>
|
1941
|
+
<td>
|
1942
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 140</span>
|
1943
|
+
|
1944
|
+
<span class='kw'>def</span> <span class='id get_ticket'>get_ticket</span>
|
1945
|
+
<span class='id query_rest'>query_rest</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>get_ticket_ok</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:action</span> <span class='op'>=></span> <span class='symbol'>:get_ticket</span><span class='rparen'>)</span>
|
1946
|
+
<span class='kw'>end</span></pre>
|
1947
|
+
</td>
|
1948
|
+
</tr>
|
1949
|
+
</table>
|
1950
|
+
</div>
|
1951
|
+
|
1952
|
+
<div class="method_details ">
|
1953
|
+
<p class="signature " id="handle_response-instance_method">
|
1954
|
+
|
1955
|
+
- (<tt>Hash</tt>) <strong>handle_response</strong>(response, expected = nil)
|
1956
|
+
|
1957
|
+
|
1958
|
+
|
1959
|
+
</p><div class="docstring">
|
1960
|
+
<div class="discussion">
|
1961
|
+
<p>
|
1962
|
+
Handle the response of the request.
|
1963
|
+
</p>
|
1964
|
+
|
1965
|
+
|
1966
|
+
</div>
|
1967
|
+
</div>
|
1968
|
+
<div class="tags">
|
1969
|
+
<h3>Parameters:</h3>
|
1970
|
+
<ul class="param">
|
1971
|
+
|
1972
|
+
<li>
|
1973
|
+
|
1974
|
+
<span class='name'>response</span>
|
1975
|
+
|
1976
|
+
|
1977
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1978
|
+
|
1979
|
+
|
1980
|
+
|
1981
|
+
—
|
1982
|
+
<div class='inline'><p>
|
1983
|
+
The parsed representation of the XML response.
|
1984
|
+
</p>
|
1985
|
+
</div>
|
1986
|
+
|
1987
|
+
</li>
|
1988
|
+
|
1989
|
+
<li>
|
1990
|
+
|
1991
|
+
<span class='name'>expected</span>
|
1992
|
+
|
1993
|
+
|
1994
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1995
|
+
|
1996
|
+
|
1997
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1998
|
+
|
1999
|
+
|
2000
|
+
—
|
2001
|
+
<div class='inline'><p>
|
2002
|
+
the normal status expected to be returned. If the actual status does not
|
2003
|
+
match, an exception is thrown.
|
2004
|
+
</p>
|
2005
|
+
</div>
|
2006
|
+
|
2007
|
+
</li>
|
2008
|
+
|
2009
|
+
</ul>
|
2010
|
+
<h3>Returns:</h3>
|
2011
|
+
<ul class="return">
|
2012
|
+
|
2013
|
+
<li>
|
2014
|
+
|
2015
|
+
|
2016
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
2017
|
+
|
2018
|
+
|
2019
|
+
|
2020
|
+
—
|
2021
|
+
<div class='inline'><p>
|
2022
|
+
The response if no errors were found.
|
2023
|
+
</p>
|
2024
|
+
</div>
|
2025
|
+
|
2026
|
+
</li>
|
2027
|
+
|
2028
|
+
</ul>
|
2029
|
+
<h3>Raises:</h3>
|
2030
|
+
<ul class="raise">
|
2031
|
+
|
2032
|
+
<li>
|
2033
|
+
|
2034
|
+
|
2035
|
+
<span class='type'>(<tt><span class='object_link'><a href="Api/Exception.html" title="Box::Api::Exception (class)">Exception</a></span></tt>, <tt><span class='object_link'><a href="Api/UnknownResponse.html" title="Box::Api::UnknownResponse (class)">UnknownResponse</a></span></tt>)</span>
|
2036
|
+
|
2037
|
+
|
2038
|
+
|
2039
|
+
—
|
2040
|
+
<div class='inline'><p>
|
2041
|
+
Raises an exception if the response status does not match the expected.
|
2042
|
+
This exception is determined by <span class='object_link'><a href="#get_exception-class_method" title="Box::Api.get_exception (method)">get_exception</a></span>
|
2043
|
+
</p>
|
2044
|
+
</div>
|
2045
|
+
|
2046
|
+
</li>
|
2047
|
+
|
2048
|
+
</ul>
|
2049
|
+
|
2050
|
+
</div><table class="source_code">
|
2051
|
+
<tr>
|
2052
|
+
<td>
|
2053
|
+
<pre class="lines">
|
2054
|
+
|
2055
|
+
|
2056
|
+
118
|
2057
|
+
119
|
2058
|
+
120
|
2059
|
+
121
|
2060
|
+
122
|
2061
|
+
123
|
2062
|
+
124
|
2063
|
+
125
|
2064
|
+
126
|
2065
|
+
127
|
2066
|
+
128
|
2067
|
+
129
|
2068
|
+
130
|
2069
|
+
131
|
2070
|
+
132
|
2071
|
+
133
|
2072
|
+
134</pre>
|
2073
|
+
</td>
|
2074
|
+
<td>
|
2075
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 118</span>
|
2076
|
+
|
2077
|
+
<span class='kw'>def</span> <span class='id handle_response'>handle_response</span><span class='lparen'>(</span><span class='id response'>response</span><span class='comma'>,</span> <span class='id expected'>expected</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
2078
|
+
<span class='kw'>if</span> <span class='id expected'>expected</span>
|
2079
|
+
<span class='kw'>begin</span>
|
2080
|
+
<span class='id status'>status</span> <span class='op'>=</span> <span class='id response'>response</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>response</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>status</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
2081
|
+
<span class='kw'>rescue</span>
|
2082
|
+
<span class='id raise'>raise</span> <span class='const'>UnknownResponse</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Unknown response: </span><span class='embexpr_beg'>#{</span> <span class='id response'>response</span> <span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
2083
|
+
<span class='kw'>end</span>
|
2084
|
+
|
2085
|
+
<span class='kw'>unless</span> <span class='id status'>status</span> <span class='op'>==</span> <span class='id expected'>expected</span> <span class='comment'># expected is the normal, successful status for this request
|
2086
|
+
</span> <span class='id exception'>exception</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id class'>class</span><span class='period'>.</span><span class='id get_exception'>get_exception</span><span class='lparen'>(</span><span class='id status'>status</span><span class='rparen'>)</span>
|
2087
|
+
<span class='id raise'>raise</span> <span class='id exception'>exception</span><span class='comma'>,</span> <span class='id status'>status</span>
|
2088
|
+
<span class='kw'>end</span>
|
2089
|
+
<span class='kw'>end</span>
|
2090
|
+
|
2091
|
+
<span class='id raise'>raise</span> <span class='const'>ErrorStatus</span><span class='comma'>,</span> <span class='id response'>response</span><span class='period'>.</span><span class='id code'>code</span> <span class='kw'>unless</span> <span class='id response'>response</span><span class='period'>.</span><span class='id success?'>success?</span> <span class='comment'># when the http return code is not normal
|
2092
|
+
</span> <span class='id response'>response</span>
|
2093
|
+
<span class='kw'>end</span></pre>
|
2094
|
+
</td>
|
2095
|
+
</tr>
|
2096
|
+
</table>
|
2097
|
+
</div>
|
2098
|
+
|
2099
|
+
<div class="method_details ">
|
2100
|
+
<p class="signature " id="logout-instance_method">
|
2101
|
+
|
2102
|
+
- (<tt>Object</tt>) <strong>logout</strong>
|
2103
|
+
|
2104
|
+
|
2105
|
+
|
2106
|
+
</p><div class="docstring">
|
2107
|
+
<div class="discussion">
|
2108
|
+
<p>
|
2109
|
+
Request the user be logged out.
|
2110
|
+
</p>
|
2111
|
+
|
2112
|
+
|
2113
|
+
</div>
|
2114
|
+
</div>
|
2115
|
+
<div class="tags">
|
2116
|
+
|
2117
|
+
</div><table class="source_code">
|
2118
|
+
<tr>
|
2119
|
+
<td>
|
2120
|
+
<pre class="lines">
|
2121
|
+
|
2122
|
+
|
2123
|
+
160
|
2124
|
+
161
|
2125
|
+
162</pre>
|
2126
|
+
</td>
|
2127
|
+
<td>
|
2128
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 160</span>
|
2129
|
+
|
2130
|
+
<span class='kw'>def</span> <span class='id logout'>logout</span>
|
2131
|
+
<span class='id query_rest'>query_rest</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>logout_ok</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:action</span> <span class='op'>=></span> <span class='symbol'>:logout</span><span class='rparen'>)</span>
|
2132
|
+
<span class='kw'>end</span></pre>
|
2133
|
+
</td>
|
2134
|
+
</tr>
|
2135
|
+
</table>
|
2136
|
+
</div>
|
2137
|
+
|
2138
|
+
<div class="method_details ">
|
2139
|
+
<p class="signature " id="move-instance_method">
|
2140
|
+
|
2141
|
+
- (<tt>Object</tt>) <strong>move</strong>(target, target_id, destination_id)
|
2142
|
+
|
2143
|
+
|
2144
|
+
|
2145
|
+
</p><div class="docstring">
|
2146
|
+
<div class="discussion">
|
2147
|
+
<p>
|
2148
|
+
Move the item to a new destination.
|
2149
|
+
</p>
|
2150
|
+
|
2151
|
+
|
2152
|
+
</div>
|
2153
|
+
</div>
|
2154
|
+
<div class="tags">
|
2155
|
+
<h3>Parameters:</h3>
|
2156
|
+
<ul class="param">
|
2157
|
+
|
2158
|
+
<li>
|
2159
|
+
|
2160
|
+
<span class='name'>target</span>
|
2161
|
+
|
2162
|
+
|
2163
|
+
<span class='type'>(<tt>"file"</tt>, <tt>"folder"</tt>)</span>
|
2164
|
+
|
2165
|
+
|
2166
|
+
|
2167
|
+
—
|
2168
|
+
<div class='inline'><p>
|
2169
|
+
The type of item.
|
2170
|
+
</p>
|
2171
|
+
</div>
|
2172
|
+
|
2173
|
+
</li>
|
2174
|
+
|
2175
|
+
<li>
|
2176
|
+
|
2177
|
+
<span class='name'>target_id</span>
|
2178
|
+
|
2179
|
+
|
2180
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2181
|
+
|
2182
|
+
|
2183
|
+
|
2184
|
+
—
|
2185
|
+
<div class='inline'><p>
|
2186
|
+
The id of the item to move.
|
2187
|
+
</p>
|
2188
|
+
</div>
|
2189
|
+
|
2190
|
+
</li>
|
2191
|
+
|
2192
|
+
<li>
|
2193
|
+
|
2194
|
+
<span class='name'>destination_id</span>
|
2195
|
+
|
2196
|
+
|
2197
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2198
|
+
|
2199
|
+
|
2200
|
+
|
2201
|
+
—
|
2202
|
+
<div class='inline'><p>
|
2203
|
+
The id of the parent to move to.
|
2204
|
+
</p>
|
2205
|
+
</div>
|
2206
|
+
|
2207
|
+
</li>
|
2208
|
+
|
2209
|
+
</ul>
|
2210
|
+
|
2211
|
+
</div><table class="source_code">
|
2212
|
+
<tr>
|
2213
|
+
<td>
|
2214
|
+
<pre class="lines">
|
2215
|
+
|
2216
|
+
|
2217
|
+
211
|
2218
|
+
212
|
2219
|
+
213</pre>
|
2220
|
+
</td>
|
2221
|
+
<td>
|
2222
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 211</span>
|
2223
|
+
|
2224
|
+
<span class='kw'>def</span> <span class='id move'>move</span><span class='lparen'>(</span><span class='id target'>target</span><span class='comma'>,</span> <span class='id target_id'>target_id</span><span class='comma'>,</span> <span class='id destination_id'>destination_id</span><span class='rparen'>)</span>
|
2225
|
+
<span class='id query_rest'>query_rest</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>s_move_node</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:action</span> <span class='op'>=></span> <span class='symbol'>:move</span><span class='comma'>,</span> <span class='symbol'>:target</span> <span class='op'>=></span> <span class='id target'>target</span><span class='comma'>,</span> <span class='symbol'>:target_id</span> <span class='op'>=></span> <span class='id target_id'>target_id</span><span class='comma'>,</span> <span class='symbol'>:destination_id</span> <span class='op'>=></span> <span class='id destination_id'>destination_id</span><span class='rparen'>)</span>
|
2226
|
+
<span class='kw'>end</span></pre>
|
2227
|
+
</td>
|
2228
|
+
</tr>
|
2229
|
+
</table>
|
2230
|
+
</div>
|
2231
|
+
|
2232
|
+
<div class="method_details ">
|
2233
|
+
<p class="signature " id="new_copy-instance_method">
|
2234
|
+
|
2235
|
+
- (<tt>Object</tt>) <strong>new_copy</strong>(path, file_id, name = nil)
|
2236
|
+
|
2237
|
+
|
2238
|
+
|
2239
|
+
</p><div class="docstring">
|
2240
|
+
<div class="discussion">
|
2241
|
+
<p>
|
2242
|
+
Upload a new copy of the given file.
|
2243
|
+
</p>
|
2244
|
+
<p>
|
2245
|
+
TODO: Verfiy this does what I think it does
|
2246
|
+
</p>
|
2247
|
+
|
2248
|
+
|
2249
|
+
</div>
|
2250
|
+
</div>
|
2251
|
+
<div class="tags">
|
2252
|
+
<h3>Parameters:</h3>
|
2253
|
+
<ul class="param">
|
2254
|
+
|
2255
|
+
<li>
|
2256
|
+
|
2257
|
+
<span class='name'>path</span>
|
2258
|
+
|
2259
|
+
|
2260
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2261
|
+
|
2262
|
+
|
2263
|
+
|
2264
|
+
—
|
2265
|
+
<div class='inline'><p>
|
2266
|
+
(see #upload)
|
2267
|
+
</p>
|
2268
|
+
</div>
|
2269
|
+
|
2270
|
+
</li>
|
2271
|
+
|
2272
|
+
<li>
|
2273
|
+
|
2274
|
+
<span class='name'>file_id</span>
|
2275
|
+
|
2276
|
+
|
2277
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2278
|
+
|
2279
|
+
|
2280
|
+
|
2281
|
+
—
|
2282
|
+
<div class='inline'><p>
|
2283
|
+
The id of the file to copy.
|
2284
|
+
</p>
|
2285
|
+
</div>
|
2286
|
+
|
2287
|
+
</li>
|
2288
|
+
|
2289
|
+
<li>
|
2290
|
+
|
2291
|
+
<span class='name'>name</span>
|
2292
|
+
|
2293
|
+
|
2294
|
+
<span class='type'>(<tt>Optional</tt>, <tt>String</tt>)</span>
|
2295
|
+
|
2296
|
+
|
2297
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
2298
|
+
|
2299
|
+
|
2300
|
+
—
|
2301
|
+
<div class='inline'><p>
|
2302
|
+
Use a new name as well.
|
2303
|
+
</p>
|
2304
|
+
</div>
|
2305
|
+
|
2306
|
+
</li>
|
2307
|
+
|
2308
|
+
</ul>
|
2309
|
+
|
2310
|
+
</div><table class="source_code">
|
2311
|
+
<tr>
|
2312
|
+
<td>
|
2313
|
+
<pre class="lines">
|
2314
|
+
|
2315
|
+
|
2316
|
+
296
|
2317
|
+
297
|
2318
|
+
298</pre>
|
2319
|
+
</td>
|
2320
|
+
<td>
|
2321
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 296</span>
|
2322
|
+
|
2323
|
+
<span class='kw'>def</span> <span class='id new_copy'>new_copy</span><span class='lparen'>(</span><span class='id path'>path</span><span class='comma'>,</span> <span class='id file_id'>file_id</span><span class='comma'>,</span> <span class='id name'>name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
2324
|
+
<span class='id query_upload'>query_upload</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>new_copy</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id file_id'>file_id</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>upload_ok</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:file</span> <span class='op'>=></span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='id path'>path</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='symbol'>:new_file_name</span> <span class='op'>=></span> <span class='id name'>name</span><span class='rparen'>)</span>
|
2325
|
+
<span class='kw'>end</span></pre>
|
2326
|
+
</td>
|
2327
|
+
</tr>
|
2328
|
+
</table>
|
2329
|
+
</div>
|
2330
|
+
|
2331
|
+
<div class="method_details ">
|
2332
|
+
<p class="signature " id="overwrite-instance_method">
|
2333
|
+
|
2334
|
+
- (<tt>Object</tt>) <strong>overwrite</strong>(path, file_id, name = nil)
|
2335
|
+
|
2336
|
+
|
2337
|
+
|
2338
|
+
</p><div class="docstring">
|
2339
|
+
<div class="discussion">
|
2340
|
+
<p>
|
2341
|
+
Overwrite the given file with a new one.
|
2342
|
+
</p>
|
2343
|
+
|
2344
|
+
|
2345
|
+
</div>
|
2346
|
+
</div>
|
2347
|
+
<div class="tags">
|
2348
|
+
<h3>Parameters:</h3>
|
2349
|
+
<ul class="param">
|
2350
|
+
|
2351
|
+
<li>
|
2352
|
+
|
2353
|
+
<span class='name'>path</span>
|
2354
|
+
|
2355
|
+
|
2356
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2357
|
+
|
2358
|
+
|
2359
|
+
|
2360
|
+
—
|
2361
|
+
<div class='inline'><p>
|
2362
|
+
(see #upload)
|
2363
|
+
</p>
|
2364
|
+
</div>
|
2365
|
+
|
2366
|
+
</li>
|
2367
|
+
|
2368
|
+
<li>
|
2369
|
+
|
2370
|
+
<span class='name'>file_id</span>
|
2371
|
+
|
2372
|
+
|
2373
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2374
|
+
|
2375
|
+
|
2376
|
+
|
2377
|
+
—
|
2378
|
+
<div class='inline'><p>
|
2379
|
+
Replace the file with this id.
|
2380
|
+
</p>
|
2381
|
+
</div>
|
2382
|
+
|
2383
|
+
</li>
|
2384
|
+
|
2385
|
+
<li>
|
2386
|
+
|
2387
|
+
<span class='name'>name</span>
|
2388
|
+
|
2389
|
+
|
2390
|
+
<span class='type'>(<tt>Optional</tt>, <tt>String</tt>)</span>
|
2391
|
+
|
2392
|
+
|
2393
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
2394
|
+
|
2395
|
+
|
2396
|
+
—
|
2397
|
+
<div class='inline'><p>
|
2398
|
+
Use a new name as well.
|
2399
|
+
</p>
|
2400
|
+
</div>
|
2401
|
+
|
2402
|
+
</li>
|
2403
|
+
|
2404
|
+
</ul>
|
2405
|
+
|
2406
|
+
</div><table class="source_code">
|
2407
|
+
<tr>
|
2408
|
+
<td>
|
2409
|
+
<pre class="lines">
|
2410
|
+
|
2411
|
+
|
2412
|
+
286
|
2413
|
+
287
|
2414
|
+
288</pre>
|
2415
|
+
</td>
|
2416
|
+
<td>
|
2417
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 286</span>
|
2418
|
+
|
2419
|
+
<span class='kw'>def</span> <span class='id overwrite'>overwrite</span><span class='lparen'>(</span><span class='id path'>path</span><span class='comma'>,</span> <span class='id file_id'>file_id</span><span class='comma'>,</span> <span class='id name'>name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
2420
|
+
<span class='id query_upload'>query_upload</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>overwrite</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id file_id'>file_id</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>upload_ok</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:file</span> <span class='op'>=></span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='id path'>path</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='symbol'>:file_name</span> <span class='op'>=></span> <span class='id name'>name</span><span class='rparen'>)</span>
|
2421
|
+
<span class='kw'>end</span></pre>
|
2422
|
+
</td>
|
2423
|
+
</tr>
|
2424
|
+
</table>
|
2425
|
+
</div>
|
2426
|
+
|
2427
|
+
<div class="method_details ">
|
2428
|
+
<p class="signature " id="query_download-instance_method">
|
2429
|
+
|
2430
|
+
- (<tt>Object</tt>) <strong>query_download</strong>(args, options = {})
|
2431
|
+
|
2432
|
+
|
2433
|
+
|
2434
|
+
</p><div class="docstring">
|
2435
|
+
<div class="discussion">
|
2436
|
+
<p>
|
2437
|
+
Make a download request.
|
2438
|
+
</p>
|
2439
|
+
|
2440
|
+
|
2441
|
+
</div>
|
2442
|
+
</div>
|
2443
|
+
<div class="tags">
|
2444
|
+
<h3>Parameters:</h3>
|
2445
|
+
<ul class="param">
|
2446
|
+
|
2447
|
+
<li>
|
2448
|
+
|
2449
|
+
<span class='name'>query</span>
|
2450
|
+
|
2451
|
+
|
2452
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2453
|
+
|
2454
|
+
|
2455
|
+
|
2456
|
+
—
|
2457
|
+
<div class='inline'><p>
|
2458
|
+
the operation to be performed (“download”).
|
2459
|
+
</p>
|
2460
|
+
</div>
|
2461
|
+
|
2462
|
+
</li>
|
2463
|
+
|
2464
|
+
<li>
|
2465
|
+
|
2466
|
+
<span class='name'>args</span>
|
2467
|
+
|
2468
|
+
|
2469
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
2470
|
+
|
2471
|
+
|
2472
|
+
|
2473
|
+
—
|
2474
|
+
<div class='inline'><p>
|
2475
|
+
an array of arguments to put in the url.
|
2476
|
+
</p>
|
2477
|
+
</div>
|
2478
|
+
|
2479
|
+
</li>
|
2480
|
+
|
2481
|
+
<li>
|
2482
|
+
|
2483
|
+
<span class='name'>options</span>
|
2484
|
+
|
2485
|
+
|
2486
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
2487
|
+
|
2488
|
+
|
2489
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
2490
|
+
|
2491
|
+
|
2492
|
+
—
|
2493
|
+
<div class='inline'><p>
|
2494
|
+
(see #query_rest)
|
2495
|
+
</p>
|
2496
|
+
</div>
|
2497
|
+
|
2498
|
+
</li>
|
2499
|
+
|
2500
|
+
</ul>
|
2501
|
+
<h3>Returns:</h3>
|
2502
|
+
<ul class="return">
|
2503
|
+
|
2504
|
+
<li>
|
2505
|
+
|
2506
|
+
|
2507
|
+
<span class='type'></span>
|
2508
|
+
|
2509
|
+
|
2510
|
+
|
2511
|
+
|
2512
|
+
<div class='inline'><p>
|
2513
|
+
The raw binary data of the file.
|
2514
|
+
</p>
|
2515
|
+
</div>
|
2516
|
+
|
2517
|
+
</li>
|
2518
|
+
|
2519
|
+
</ul>
|
2520
|
+
|
2521
|
+
</div><table class="source_code">
|
2522
|
+
<tr>
|
2523
|
+
<td>
|
2524
|
+
<pre class="lines">
|
2525
|
+
|
2526
|
+
|
2527
|
+
65
|
2528
|
+
66
|
2529
|
+
67
|
2530
|
+
68
|
2531
|
+
69</pre>
|
2532
|
+
</td>
|
2533
|
+
<td>
|
2534
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 65</span>
|
2535
|
+
|
2536
|
+
<span class='kw'>def</span> <span class='id query_download'>query_download</span><span class='lparen'>(</span><span class='id args'>args</span><span class='comma'>,</span> <span class='id options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
2537
|
+
<span class='comment'># produces: /download/<auth_token>/<arg1>/<arg2>/<etc>
|
2538
|
+
</span> <span class='id url'>url</span> <span class='op'>=</span> <span class='lbracket'>[</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span> <span class='ivar'>@base_url</span> <span class='rbrace'>}</span><span class='tstring_content'>/download</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='ivar'>@auth_token</span><span class='comma'>,</span> <span class='id args'>args</span> <span class='rbracket'>]</span><span class='period'>.</span><span class='id flatten'>flatten</span><span class='period'>.</span><span class='id compact'>compact</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
2539
|
+
<span class='id query_raw'>query_raw</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>get</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id url'>url</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id options'>options</span><span class='rparen'>)</span>
|
2540
|
+
<span class='kw'>end</span></pre>
|
2541
|
+
</td>
|
2542
|
+
</tr>
|
2543
|
+
</table>
|
2544
|
+
</div>
|
2545
|
+
|
2546
|
+
<div class="method_details ">
|
2547
|
+
<p class="signature " id="query_raw-instance_method">
|
2548
|
+
|
2549
|
+
- (<tt>Hash</tt>) <strong>query_raw</strong>(method, url, expected, options = {})
|
2550
|
+
|
2551
|
+
|
2552
|
+
|
2553
|
+
</p><div class="docstring">
|
2554
|
+
<div class="discussion">
|
2555
|
+
<p>
|
2556
|
+
Make a raw request.
|
2557
|
+
</p>
|
2558
|
+
<p>
|
2559
|
+
@note: HTTParty will automatically parse the response from its native
|
2560
|
+
</p>
|
2561
|
+
<pre class="code">
|
2562
|
+
XML to a nested hash/array structure.</pre>
|
2563
|
+
|
2564
|
+
|
2565
|
+
</div>
|
2566
|
+
</div>
|
2567
|
+
<div class="tags">
|
2568
|
+
<h3>Parameters:</h3>
|
2569
|
+
<ul class="param">
|
2570
|
+
|
2571
|
+
<li>
|
2572
|
+
|
2573
|
+
<span class='name'>method</span>
|
2574
|
+
|
2575
|
+
|
2576
|
+
<span class='type'>(<tt>'get'</tt>, <tt>'post'</tt>)</span>
|
2577
|
+
|
2578
|
+
|
2579
|
+
|
2580
|
+
—
|
2581
|
+
<div class='inline'><p>
|
2582
|
+
The HTTP method to use.
|
2583
|
+
</p>
|
2584
|
+
</div>
|
2585
|
+
|
2586
|
+
</li>
|
2587
|
+
|
2588
|
+
<li>
|
2589
|
+
|
2590
|
+
<span class='name'>url</span>
|
2591
|
+
|
2592
|
+
|
2593
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2594
|
+
|
2595
|
+
|
2596
|
+
|
2597
|
+
—
|
2598
|
+
<div class='inline'><p>
|
2599
|
+
The url to make the request.
|
2600
|
+
</p>
|
2601
|
+
</div>
|
2602
|
+
|
2603
|
+
</li>
|
2604
|
+
|
2605
|
+
<li>
|
2606
|
+
|
2607
|
+
<span class='name'>expected</span>
|
2608
|
+
|
2609
|
+
|
2610
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2611
|
+
|
2612
|
+
|
2613
|
+
|
2614
|
+
—
|
2615
|
+
<div class='inline'><p>
|
2616
|
+
(see #query_rest)
|
2617
|
+
</p>
|
2618
|
+
</div>
|
2619
|
+
|
2620
|
+
</li>
|
2621
|
+
|
2622
|
+
<li>
|
2623
|
+
|
2624
|
+
<span class='name'>options</span>
|
2625
|
+
|
2626
|
+
|
2627
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
2628
|
+
|
2629
|
+
|
2630
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
2631
|
+
|
2632
|
+
|
2633
|
+
—
|
2634
|
+
<div class='inline'><p>
|
2635
|
+
(see #query_rest)
|
2636
|
+
</p>
|
2637
|
+
</div>
|
2638
|
+
|
2639
|
+
</li>
|
2640
|
+
|
2641
|
+
</ul>
|
2642
|
+
<h3>Returns:</h3>
|
2643
|
+
<ul class="return">
|
2644
|
+
|
2645
|
+
<li>
|
2646
|
+
|
2647
|
+
|
2648
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
2649
|
+
|
2650
|
+
|
2651
|
+
|
2652
|
+
—
|
2653
|
+
<div class='inline'><p>
|
2654
|
+
A parsed version of the XML response.
|
2655
|
+
</p>
|
2656
|
+
</div>
|
2657
|
+
|
2658
|
+
</li>
|
2659
|
+
|
2660
|
+
</ul>
|
2661
|
+
|
2662
|
+
</div><table class="source_code">
|
2663
|
+
<tr>
|
2664
|
+
<td>
|
2665
|
+
<pre class="lines">
|
2666
|
+
|
2667
|
+
|
2668
|
+
98
|
2669
|
+
99
|
2670
|
+
100
|
2671
|
+
101
|
2672
|
+
102
|
2673
|
+
103
|
2674
|
+
104
|
2675
|
+
105
|
2676
|
+
106
|
2677
|
+
107</pre>
|
2678
|
+
</td>
|
2679
|
+
<td>
|
2680
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 98</span>
|
2681
|
+
|
2682
|
+
<span class='kw'>def</span> <span class='id query_raw'>query_raw</span><span class='lparen'>(</span><span class='id method'>method</span><span class='comma'>,</span> <span class='id url'>url</span><span class='comma'>,</span> <span class='id expected'>expected</span><span class='comma'>,</span> <span class='id options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
2683
|
+
<span class='id response'>response</span> <span class='op'>=</span> <span class='kw'>case</span> <span class='id method'>method</span>
|
2684
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>get</span><span class='tstring_end'>'</span></span>
|
2685
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id class'>class</span><span class='period'>.</span><span class='id get'>get</span><span class='lparen'>(</span><span class='id url'>url</span><span class='comma'>,</span> <span class='symbol'>:query</span> <span class='op'>=></span> <span class='ivar'>@default_params</span><span class='period'>.</span><span class='id merge'>merge</span><span class='lparen'>(</span><span class='id options'>options</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
2686
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>post</span><span class='tstring_end'>'</span></span>
|
2687
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id class'>class</span><span class='period'>.</span><span class='id post'>post</span><span class='lparen'>(</span><span class='id url'>url</span><span class='comma'>,</span> <span class='symbol'>:query</span> <span class='op'>=></span> <span class='ivar'>@default_params</span><span class='period'>.</span><span class='id merge'>merge</span><span class='lparen'>(</span><span class='id options'>options</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='symbol'>:format</span> <span class='op'>=></span> <span class='symbol'>:xml</span><span class='rparen'>)</span> <span class='comment'># known bug with api that only occurs with uploads, will be fixed soon
|
2688
|
+
</span> <span class='kw'>end</span>
|
2689
|
+
|
2690
|
+
<span class='id handle_response'>handle_response</span><span class='lparen'>(</span><span class='id response'>response</span><span class='comma'>,</span> <span class='id expected'>expected</span><span class='rparen'>)</span>
|
2691
|
+
<span class='kw'>end</span></pre>
|
2692
|
+
</td>
|
2693
|
+
</tr>
|
2694
|
+
</table>
|
2695
|
+
</div>
|
2696
|
+
|
2697
|
+
<div class="method_details ">
|
2698
|
+
<p class="signature " id="query_rest-instance_method">
|
2699
|
+
|
2700
|
+
- (<tt>Hash</tt>) <strong>query_rest</strong>(expected, options = {})
|
2701
|
+
|
2702
|
+
|
2703
|
+
|
2704
|
+
</p><div class="docstring">
|
2705
|
+
<div class="discussion">
|
2706
|
+
<p>
|
2707
|
+
Make a normal REST request.
|
2708
|
+
</p>
|
2709
|
+
|
2710
|
+
|
2711
|
+
</div>
|
2712
|
+
</div>
|
2713
|
+
<div class="tags">
|
2714
|
+
<h3>Parameters:</h3>
|
2715
|
+
<ul class="param">
|
2716
|
+
|
2717
|
+
<li>
|
2718
|
+
|
2719
|
+
<span class='name'>expected</span>
|
2720
|
+
|
2721
|
+
|
2722
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2723
|
+
|
2724
|
+
|
2725
|
+
|
2726
|
+
—
|
2727
|
+
<div class='inline'><p>
|
2728
|
+
the normal status expected to be returned. If the actual status does not
|
2729
|
+
match, an exception is thrown.
|
2730
|
+
</p>
|
2731
|
+
</div>
|
2732
|
+
|
2733
|
+
</li>
|
2734
|
+
|
2735
|
+
<li>
|
2736
|
+
|
2737
|
+
<span class='name'>options</span>
|
2738
|
+
|
2739
|
+
|
2740
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
2741
|
+
|
2742
|
+
|
2743
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
2744
|
+
|
2745
|
+
|
2746
|
+
—
|
2747
|
+
<div class='inline'><p>
|
2748
|
+
The parameters that wish to be passed in the request. These should
|
2749
|
+
coorespond to the api specifications, and will be passed along with the api
|
2750
|
+
key and auth token.
|
2751
|
+
</p>
|
2752
|
+
</div>
|
2753
|
+
|
2754
|
+
</li>
|
2755
|
+
|
2756
|
+
</ul>
|
2757
|
+
<h3>Returns:</h3>
|
2758
|
+
<ul class="return">
|
2759
|
+
|
2760
|
+
<li>
|
2761
|
+
|
2762
|
+
|
2763
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
2764
|
+
|
2765
|
+
|
2766
|
+
|
2767
|
+
—
|
2768
|
+
<div class='inline'><p>
|
2769
|
+
A parsed version of the XML response.
|
2770
|
+
</p>
|
2771
|
+
</div>
|
2772
|
+
|
2773
|
+
</li>
|
2774
|
+
|
2775
|
+
</ul>
|
2776
|
+
|
2777
|
+
</div><table class="source_code">
|
2778
|
+
<tr>
|
2779
|
+
<td>
|
2780
|
+
<pre class="lines">
|
2781
|
+
|
2782
|
+
|
2783
|
+
53
|
2784
|
+
54
|
2785
|
+
55</pre>
|
2786
|
+
</td>
|
2787
|
+
<td>
|
2788
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 53</span>
|
2789
|
+
|
2790
|
+
<span class='kw'>def</span> <span class='id query_rest'>query_rest</span><span class='lparen'>(</span><span class='id expected'>expected</span><span class='comma'>,</span> <span class='id options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
2791
|
+
<span class='id query_raw'>query_raw</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>get</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span> <span class='ivar'>@base_url</span> <span class='rbrace'>}</span><span class='tstring_content'>/rest</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id expected'>expected</span><span class='comma'>,</span> <span class='id options'>options</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>response</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
2792
|
+
<span class='kw'>end</span></pre>
|
2793
|
+
</td>
|
2794
|
+
</tr>
|
2795
|
+
</table>
|
2796
|
+
</div>
|
2797
|
+
|
2798
|
+
<div class="method_details ">
|
2799
|
+
<p class="signature " id="query_upload-instance_method">
|
2800
|
+
|
2801
|
+
- (<tt>Hash</tt>) <strong>query_upload</strong>(query, args, expected, options = {})
|
2802
|
+
|
2803
|
+
|
2804
|
+
|
2805
|
+
</p><div class="docstring">
|
2806
|
+
<div class="discussion">
|
2807
|
+
<p>
|
2808
|
+
Make an upload request.
|
2809
|
+
</p>
|
2810
|
+
|
2811
|
+
|
2812
|
+
</div>
|
2813
|
+
</div>
|
2814
|
+
<div class="tags">
|
2815
|
+
<h3>Parameters:</h3>
|
2816
|
+
<ul class="param">
|
2817
|
+
|
2818
|
+
<li>
|
2819
|
+
|
2820
|
+
<span class='name'>query</span>
|
2821
|
+
|
2822
|
+
|
2823
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2824
|
+
|
2825
|
+
|
2826
|
+
|
2827
|
+
—
|
2828
|
+
<div class='inline'><p>
|
2829
|
+
The operation to be performed.
|
2830
|
+
</p>
|
2831
|
+
</div>
|
2832
|
+
|
2833
|
+
</li>
|
2834
|
+
|
2835
|
+
<li>
|
2836
|
+
|
2837
|
+
<span class='name'>args</span>
|
2838
|
+
|
2839
|
+
|
2840
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
2841
|
+
|
2842
|
+
|
2843
|
+
|
2844
|
+
—
|
2845
|
+
<div class='inline'><p>
|
2846
|
+
(see #query_download)
|
2847
|
+
</p>
|
2848
|
+
</div>
|
2849
|
+
|
2850
|
+
</li>
|
2851
|
+
|
2852
|
+
<li>
|
2853
|
+
|
2854
|
+
<span class='name'>expected</span>
|
2855
|
+
|
2856
|
+
|
2857
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2858
|
+
|
2859
|
+
|
2860
|
+
|
2861
|
+
—
|
2862
|
+
<div class='inline'><p>
|
2863
|
+
(see #query_rest)
|
2864
|
+
</p>
|
2865
|
+
</div>
|
2866
|
+
|
2867
|
+
</li>
|
2868
|
+
|
2869
|
+
<li>
|
2870
|
+
|
2871
|
+
<span class='name'>options</span>
|
2872
|
+
|
2873
|
+
|
2874
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
2875
|
+
|
2876
|
+
|
2877
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
2878
|
+
|
2879
|
+
|
2880
|
+
—
|
2881
|
+
<div class='inline'><p>
|
2882
|
+
(see #query_rest)
|
2883
|
+
</p>
|
2884
|
+
</div>
|
2885
|
+
|
2886
|
+
</li>
|
2887
|
+
|
2888
|
+
</ul>
|
2889
|
+
<h3>Returns:</h3>
|
2890
|
+
<ul class="return">
|
2891
|
+
|
2892
|
+
<li>
|
2893
|
+
|
2894
|
+
|
2895
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
2896
|
+
|
2897
|
+
|
2898
|
+
|
2899
|
+
—
|
2900
|
+
<div class='inline'><p>
|
2901
|
+
A parsed version of the XML response.
|
2902
|
+
</p>
|
2903
|
+
</div>
|
2904
|
+
|
2905
|
+
</li>
|
2906
|
+
|
2907
|
+
</ul>
|
2908
|
+
|
2909
|
+
</div><table class="source_code">
|
2910
|
+
<tr>
|
2911
|
+
<td>
|
2912
|
+
<pre class="lines">
|
2913
|
+
|
2914
|
+
|
2915
|
+
80
|
2916
|
+
81
|
2917
|
+
82
|
2918
|
+
83
|
2919
|
+
84</pre>
|
2920
|
+
</td>
|
2921
|
+
<td>
|
2922
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 80</span>
|
2923
|
+
|
2924
|
+
<span class='kw'>def</span> <span class='id query_upload'>query_upload</span><span class='lparen'>(</span><span class='id query'>query</span><span class='comma'>,</span> <span class='id args'>args</span><span class='comma'>,</span> <span class='id expected'>expected</span><span class='comma'>,</span> <span class='id options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
2925
|
+
<span class='comment'># produces: /upload/<auth_token>/<arg1>/<arg2>/<etc>
|
2926
|
+
</span> <span class='id url'>url</span> <span class='op'>=</span> <span class='lbracket'>[</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span> <span class='ivar'>@upload_url</span> <span class='rbrace'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span> <span class='id query'>query</span> <span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='ivar'>@auth_token</span><span class='comma'>,</span> <span class='id args'>args</span> <span class='rbracket'>]</span><span class='period'>.</span><span class='id flatten'>flatten</span><span class='period'>.</span><span class='id compact'>compact</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
2927
|
+
<span class='id query_raw'>query_raw</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>post</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id url'>url</span><span class='comma'>,</span> <span class='id expected'>expected</span><span class='comma'>,</span> <span class='id options'>options</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>response</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
2928
|
+
<span class='kw'>end</span></pre>
|
2929
|
+
</td>
|
2930
|
+
</tr>
|
2931
|
+
</table>
|
2932
|
+
</div>
|
2933
|
+
|
2934
|
+
<div class="method_details ">
|
2935
|
+
<p class="signature " id="register_new_user-instance_method">
|
2936
|
+
|
2937
|
+
- (<tt>Object</tt>) <strong>register_new_user</strong>(email, password)
|
2938
|
+
|
2939
|
+
|
2940
|
+
|
2941
|
+
</p><div class="docstring">
|
2942
|
+
<div class="discussion">
|
2943
|
+
<p>
|
2944
|
+
Register a new user.
|
2945
|
+
</p>
|
2946
|
+
|
2947
|
+
|
2948
|
+
</div>
|
2949
|
+
</div>
|
2950
|
+
<div class="tags">
|
2951
|
+
<h3>Parameters:</h3>
|
2952
|
+
<ul class="param">
|
2953
|
+
|
2954
|
+
<li>
|
2955
|
+
|
2956
|
+
<span class='name'>email</span>
|
2957
|
+
|
2958
|
+
|
2959
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2960
|
+
|
2961
|
+
|
2962
|
+
|
2963
|
+
—
|
2964
|
+
<div class='inline'><p>
|
2965
|
+
The email address to use.
|
2966
|
+
</p>
|
2967
|
+
</div>
|
2968
|
+
|
2969
|
+
</li>
|
2970
|
+
|
2971
|
+
<li>
|
2972
|
+
|
2973
|
+
<span class='name'>password</span>
|
2974
|
+
|
2975
|
+
|
2976
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2977
|
+
|
2978
|
+
|
2979
|
+
|
2980
|
+
—
|
2981
|
+
<div class='inline'><p>
|
2982
|
+
The password to use.
|
2983
|
+
</p>
|
2984
|
+
</div>
|
2985
|
+
|
2986
|
+
</li>
|
2987
|
+
|
2988
|
+
</ul>
|
2989
|
+
|
2990
|
+
</div><table class="source_code">
|
2991
|
+
<tr>
|
2992
|
+
<td>
|
2993
|
+
<pre class="lines">
|
2994
|
+
|
2995
|
+
|
2996
|
+
168
|
2997
|
+
169
|
2998
|
+
170</pre>
|
2999
|
+
</td>
|
3000
|
+
<td>
|
3001
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 168</span>
|
3002
|
+
|
3003
|
+
<span class='kw'>def</span> <span class='id register_new_user'>register_new_user</span><span class='lparen'>(</span><span class='id email'>email</span><span class='comma'>,</span> <span class='id password'>password</span><span class='rparen'>)</span>
|
3004
|
+
<span class='id query_rest'>query_rest</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>successful_register</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:action</span> <span class='op'>=></span> <span class='symbol'>:register_new_user</span><span class='comma'>,</span> <span class='symbol'>:login</span> <span class='op'>=></span> <span class='id email'>email</span><span class='comma'>,</span> <span class='symbol'>:password</span> <span class='op'>=></span> <span class='id password'>password</span><span class='rparen'>)</span>
|
3005
|
+
<span class='kw'>end</span></pre>
|
3006
|
+
</td>
|
3007
|
+
</tr>
|
3008
|
+
</table>
|
3009
|
+
</div>
|
3010
|
+
|
3011
|
+
<div class="method_details ">
|
3012
|
+
<p class="signature " id="rename-instance_method">
|
3013
|
+
|
3014
|
+
- (<tt>Object</tt>) <strong>rename</strong>(target, target_id, new_name)
|
3015
|
+
|
3016
|
+
|
3017
|
+
|
3018
|
+
</p><div class="docstring">
|
3019
|
+
<div class="discussion">
|
3020
|
+
<p>
|
3021
|
+
Rename the item.
|
3022
|
+
</p>
|
3023
|
+
|
3024
|
+
|
3025
|
+
</div>
|
3026
|
+
</div>
|
3027
|
+
<div class="tags">
|
3028
|
+
<h3>Parameters:</h3>
|
3029
|
+
<ul class="param">
|
3030
|
+
|
3031
|
+
<li>
|
3032
|
+
|
3033
|
+
<span class='name'>target</span>
|
3034
|
+
|
3035
|
+
|
3036
|
+
<span class='type'>(<tt>"file"</tt>, <tt>"folder"</tt>)</span>
|
3037
|
+
|
3038
|
+
|
3039
|
+
|
3040
|
+
—
|
3041
|
+
<div class='inline'><p>
|
3042
|
+
The type of item.
|
3043
|
+
</p>
|
3044
|
+
</div>
|
3045
|
+
|
3046
|
+
</li>
|
3047
|
+
|
3048
|
+
<li>
|
3049
|
+
|
3050
|
+
<span class='name'>target_id</span>
|
3051
|
+
|
3052
|
+
|
3053
|
+
<span class='type'>(<tt>String</tt>)</span>
|
3054
|
+
|
3055
|
+
|
3056
|
+
|
3057
|
+
—
|
3058
|
+
<div class='inline'><p>
|
3059
|
+
The id of the item to rename.
|
3060
|
+
</p>
|
3061
|
+
</div>
|
3062
|
+
|
3063
|
+
</li>
|
3064
|
+
|
3065
|
+
<li>
|
3066
|
+
|
3067
|
+
<span class='name'>new_name</span>
|
3068
|
+
|
3069
|
+
|
3070
|
+
<span class='type'>(<tt>String</tt>)</span>
|
3071
|
+
|
3072
|
+
|
3073
|
+
|
3074
|
+
—
|
3075
|
+
<div class='inline'><p>
|
3076
|
+
The new name to be used.
|
3077
|
+
</p>
|
3078
|
+
</div>
|
3079
|
+
|
3080
|
+
</li>
|
3081
|
+
|
3082
|
+
</ul>
|
3083
|
+
|
3084
|
+
</div><table class="source_code">
|
3085
|
+
<tr>
|
3086
|
+
<td>
|
3087
|
+
<pre class="lines">
|
3088
|
+
|
3089
|
+
|
3090
|
+
231
|
3091
|
+
232
|
3092
|
+
233</pre>
|
3093
|
+
</td>
|
3094
|
+
<td>
|
3095
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 231</span>
|
3096
|
+
|
3097
|
+
<span class='kw'>def</span> <span class='id rename'>rename</span><span class='lparen'>(</span><span class='id target'>target</span><span class='comma'>,</span> <span class='id target_id'>target_id</span><span class='comma'>,</span> <span class='id new_name'>new_name</span><span class='rparen'>)</span>
|
3098
|
+
<span class='id query_rest'>query_rest</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>s_rename_node</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:action</span> <span class='op'>=></span> <span class='symbol'>:rename</span><span class='comma'>,</span> <span class='symbol'>:target</span> <span class='op'>=></span> <span class='id target'>target</span><span class='comma'>,</span> <span class='symbol'>:target_id</span> <span class='op'>=></span> <span class='id target_id'>target_id</span><span class='comma'>,</span> <span class='symbol'>:new_name</span> <span class='op'>=></span> <span class='id new_name'>new_name</span><span class='rparen'>)</span>
|
3099
|
+
<span class='kw'>end</span></pre>
|
3100
|
+
</td>
|
3101
|
+
</tr>
|
3102
|
+
</table>
|
3103
|
+
</div>
|
3104
|
+
|
3105
|
+
<div class="method_details ">
|
3106
|
+
<p class="signature " id="set_auth_token-instance_method">
|
3107
|
+
|
3108
|
+
- (<tt>Object</tt>) <strong>set_auth_token</strong>(auth_token)
|
3109
|
+
|
3110
|
+
|
3111
|
+
|
3112
|
+
</p><div class="docstring">
|
3113
|
+
<div class="discussion">
|
3114
|
+
<p>
|
3115
|
+
Add the auth token to every request.
|
3116
|
+
</p>
|
3117
|
+
|
3118
|
+
|
3119
|
+
</div>
|
3120
|
+
</div>
|
3121
|
+
<div class="tags">
|
3122
|
+
<h3>Parameters:</h3>
|
3123
|
+
<ul class="param">
|
3124
|
+
|
3125
|
+
<li>
|
3126
|
+
|
3127
|
+
<span class='name'>auth_token</span>
|
3128
|
+
|
3129
|
+
|
3130
|
+
<span class='type'>(<tt>String</tt>)</span>
|
3131
|
+
|
3132
|
+
|
3133
|
+
|
3134
|
+
—
|
3135
|
+
<div class='inline'><p>
|
3136
|
+
The auth token to add to every request.
|
3137
|
+
</p>
|
3138
|
+
</div>
|
3139
|
+
|
3140
|
+
</li>
|
3141
|
+
|
3142
|
+
</ul>
|
3143
|
+
|
3144
|
+
</div><table class="source_code">
|
3145
|
+
<tr>
|
3146
|
+
<td>
|
3147
|
+
<pre class="lines">
|
3148
|
+
|
3149
|
+
|
3150
|
+
154
|
3151
|
+
155
|
3152
|
+
156
|
3153
|
+
157</pre>
|
3154
|
+
</td>
|
3155
|
+
<td>
|
3156
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 154</span>
|
3157
|
+
|
3158
|
+
<span class='kw'>def</span> <span class='id set_auth_token'>set_auth_token</span><span class='lparen'>(</span><span class='id auth_token'>auth_token</span><span class='rparen'>)</span>
|
3159
|
+
<span class='ivar'>@auth_token</span> <span class='op'>=</span> <span class='id auth_token'>auth_token</span>
|
3160
|
+
<span class='ivar'>@default_params</span><span class='lbracket'>[</span><span class='symbol'>:auth_token</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id auth_token'>auth_token</span>
|
3161
|
+
<span class='kw'>end</span></pre>
|
3162
|
+
</td>
|
3163
|
+
</tr>
|
3164
|
+
</table>
|
3165
|
+
</div>
|
3166
|
+
|
3167
|
+
<div class="method_details ">
|
3168
|
+
<p class="signature " id="set_description-instance_method">
|
3169
|
+
|
3170
|
+
- (<tt>Object</tt>) <strong>set_description</strong>(target, target_id, description)
|
3171
|
+
|
3172
|
+
|
3173
|
+
|
3174
|
+
</p><div class="docstring">
|
3175
|
+
<div class="discussion">
|
3176
|
+
<p>
|
3177
|
+
Set the item description.
|
3178
|
+
</p>
|
3179
|
+
|
3180
|
+
|
3181
|
+
</div>
|
3182
|
+
</div>
|
3183
|
+
<div class="tags">
|
3184
|
+
<h3>Parameters:</h3>
|
3185
|
+
<ul class="param">
|
3186
|
+
|
3187
|
+
<li>
|
3188
|
+
|
3189
|
+
<span class='name'>target</span>
|
3190
|
+
|
3191
|
+
|
3192
|
+
<span class='type'>(<tt>"file"</tt>, <tt>"folder"</tt>)</span>
|
3193
|
+
|
3194
|
+
|
3195
|
+
|
3196
|
+
—
|
3197
|
+
<div class='inline'><p>
|
3198
|
+
The type of item.
|
3199
|
+
</p>
|
3200
|
+
</div>
|
3201
|
+
|
3202
|
+
</li>
|
3203
|
+
|
3204
|
+
<li>
|
3205
|
+
|
3206
|
+
<span class='name'>target_id</span>
|
3207
|
+
|
3208
|
+
|
3209
|
+
<span class='type'>(<tt>String</tt>)</span>
|
3210
|
+
|
3211
|
+
|
3212
|
+
|
3213
|
+
—
|
3214
|
+
<div class='inline'><p>
|
3215
|
+
The id of the item to describe.
|
3216
|
+
</p>
|
3217
|
+
</div>
|
3218
|
+
|
3219
|
+
</li>
|
3220
|
+
|
3221
|
+
<li>
|
3222
|
+
|
3223
|
+
<span class='name'>description</span>
|
3224
|
+
|
3225
|
+
|
3226
|
+
<span class='type'>(<tt>String</tt>)</span>
|
3227
|
+
|
3228
|
+
|
3229
|
+
|
3230
|
+
—
|
3231
|
+
<div class='inline'><p>
|
3232
|
+
The description to use.
|
3233
|
+
</p>
|
3234
|
+
</div>
|
3235
|
+
|
3236
|
+
</li>
|
3237
|
+
|
3238
|
+
</ul>
|
3239
|
+
|
3240
|
+
</div><table class="source_code">
|
3241
|
+
<tr>
|
3242
|
+
<td>
|
3243
|
+
<pre class="lines">
|
3244
|
+
|
3245
|
+
|
3246
|
+
255
|
3247
|
+
256
|
3248
|
+
257</pre>
|
3249
|
+
</td>
|
3250
|
+
<td>
|
3251
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 255</span>
|
3252
|
+
|
3253
|
+
<span class='kw'>def</span> <span class='id set_description'>set_description</span><span class='lparen'>(</span><span class='id target'>target</span><span class='comma'>,</span> <span class='id target_id'>target_id</span><span class='comma'>,</span> <span class='id description'>description</span><span class='rparen'>)</span>
|
3254
|
+
<span class='id query_rest'>query_rest</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>s_set_description</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:action</span> <span class='op'>=></span> <span class='symbol'>:set_description</span><span class='comma'>,</span> <span class='symbol'>:target</span> <span class='op'>=></span> <span class='id target'>target</span><span class='comma'>,</span> <span class='symbol'>:target_id</span> <span class='op'>=></span> <span class='id target_id'>target_id</span><span class='comma'>,</span> <span class='symbol'>:description</span> <span class='op'>=></span> <span class='id description'>description</span><span class='rparen'>)</span>
|
3255
|
+
<span class='kw'>end</span></pre>
|
3256
|
+
</td>
|
3257
|
+
</tr>
|
3258
|
+
</table>
|
3259
|
+
</div>
|
3260
|
+
|
3261
|
+
<div class="method_details ">
|
3262
|
+
<p class="signature " id="upload-instance_method">
|
3263
|
+
|
3264
|
+
- (<tt>Object</tt>) <strong>upload</strong>(path, folder_id, new_copy = false)
|
3265
|
+
|
3266
|
+
|
3267
|
+
|
3268
|
+
</p><div class="docstring">
|
3269
|
+
<div class="discussion">
|
3270
|
+
<p>
|
3271
|
+
Upload the file to the specified folder.
|
3272
|
+
</p>
|
3273
|
+
|
3274
|
+
|
3275
|
+
</div>
|
3276
|
+
</div>
|
3277
|
+
<div class="tags">
|
3278
|
+
<h3>Parameters:</h3>
|
3279
|
+
<ul class="param">
|
3280
|
+
|
3281
|
+
<li>
|
3282
|
+
|
3283
|
+
<span class='name'>path</span>
|
3284
|
+
|
3285
|
+
|
3286
|
+
<span class='type'>(<tt>String</tt>)</span>
|
3287
|
+
|
3288
|
+
|
3289
|
+
|
3290
|
+
—
|
3291
|
+
<div class='inline'><p>
|
3292
|
+
Upload the file at the given path.
|
3293
|
+
</p>
|
3294
|
+
</div>
|
3295
|
+
|
3296
|
+
</li>
|
3297
|
+
|
3298
|
+
<li>
|
3299
|
+
|
3300
|
+
<span class='name'>folder_id</span>
|
3301
|
+
|
3302
|
+
|
3303
|
+
<span class='type'>(<tt>String</tt>)</span>
|
3304
|
+
|
3305
|
+
|
3306
|
+
|
3307
|
+
—
|
3308
|
+
<div class='inline'><p>
|
3309
|
+
The folder id of the parent folder to use.
|
3310
|
+
</p>
|
3311
|
+
</div>
|
3312
|
+
|
3313
|
+
</li>
|
3314
|
+
|
3315
|
+
<li>
|
3316
|
+
|
3317
|
+
<span class='name'>new_copy</span>
|
3318
|
+
|
3319
|
+
|
3320
|
+
<span class='type'>(<tt>Optional</tt>, <tt>Boolean</tt>)</span>
|
3321
|
+
|
3322
|
+
|
3323
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
3324
|
+
|
3325
|
+
|
3326
|
+
—
|
3327
|
+
<div class='inline'><p>
|
3328
|
+
Upload a new copy instead of overwriting.
|
3329
|
+
</p>
|
3330
|
+
</div>
|
3331
|
+
|
3332
|
+
</li>
|
3333
|
+
|
3334
|
+
</ul>
|
3335
|
+
|
3336
|
+
</div><table class="source_code">
|
3337
|
+
<tr>
|
3338
|
+
<td>
|
3339
|
+
<pre class="lines">
|
3340
|
+
|
3341
|
+
|
3342
|
+
277
|
3343
|
+
278
|
3344
|
+
279</pre>
|
3345
|
+
</td>
|
3346
|
+
<td>
|
3347
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 277</span>
|
3348
|
+
|
3349
|
+
<span class='kw'>def</span> <span class='id upload'>upload</span><span class='lparen'>(</span><span class='id path'>path</span><span class='comma'>,</span> <span class='id folder_id'>folder_id</span><span class='comma'>,</span> <span class='id new_copy'>new_copy</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
3350
|
+
<span class='id query_upload'>query_upload</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>upload</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id folder_id'>folder_id</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>upload_ok</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:file</span> <span class='op'>=></span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='id path'>path</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='symbol'>:new_copy</span> <span class='op'>=></span> <span class='id new_copy'>new_copy</span><span class='rparen'>)</span>
|
3351
|
+
<span class='kw'>end</span></pre>
|
3352
|
+
</td>
|
3353
|
+
</tr>
|
3354
|
+
</table>
|
3355
|
+
</div>
|
3356
|
+
|
3357
|
+
<div class="method_details ">
|
3358
|
+
<p class="signature " id="verify_registration_email-instance_method">
|
3359
|
+
|
3360
|
+
- (<tt>Object</tt>) <strong>verify_registration_email</strong>(email)
|
3361
|
+
|
3362
|
+
|
3363
|
+
|
3364
|
+
</p><div class="docstring">
|
3365
|
+
<div class="discussion">
|
3366
|
+
<p>
|
3367
|
+
Verify a registration email.
|
3368
|
+
</p>
|
3369
|
+
|
3370
|
+
|
3371
|
+
</div>
|
3372
|
+
</div>
|
3373
|
+
<div class="tags">
|
3374
|
+
<h3>Parameters:</h3>
|
3375
|
+
<ul class="param">
|
3376
|
+
|
3377
|
+
<li>
|
3378
|
+
|
3379
|
+
<span class='name'>email</span>
|
3380
|
+
|
3381
|
+
|
3382
|
+
<span class='type'>(<tt>String</tt>)</span>
|
3383
|
+
|
3384
|
+
|
3385
|
+
|
3386
|
+
—
|
3387
|
+
<div class='inline'><p>
|
3388
|
+
The email address to check.
|
3389
|
+
</p>
|
3390
|
+
</div>
|
3391
|
+
|
3392
|
+
</li>
|
3393
|
+
|
3394
|
+
</ul>
|
3395
|
+
|
3396
|
+
</div><table class="source_code">
|
3397
|
+
<tr>
|
3398
|
+
<td>
|
3399
|
+
<pre class="lines">
|
3400
|
+
|
3401
|
+
|
3402
|
+
175
|
3403
|
+
176
|
3404
|
+
177</pre>
|
3405
|
+
</td>
|
3406
|
+
<td>
|
3407
|
+
<pre class="code"><span class="info file"># File 'lib/box/api.rb', line 175</span>
|
3408
|
+
|
3409
|
+
<span class='kw'>def</span> <span class='id verify_registration_email'>verify_registration_email</span><span class='lparen'>(</span><span class='id email'>email</span><span class='rparen'>)</span>
|
3410
|
+
<span class='id query_rest'>query_rest</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>email_ok</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:action</span> <span class='op'>=></span> <span class='symbol'>:verify_registration_email</span><span class='comma'>,</span> <span class='symbol'>:login</span> <span class='op'>=></span> <span class='id email'>email</span><span class='rparen'>)</span>
|
3411
|
+
<span class='kw'>end</span></pre>
|
3412
|
+
</td>
|
3413
|
+
</tr>
|
3414
|
+
</table>
|
3415
|
+
</div>
|
3416
|
+
|
3417
|
+
</div>
|
3418
|
+
|
3419
|
+
</div>
|
3420
|
+
|
3421
|
+
<div id="footer">
|
3422
|
+
Generated on Mon Aug 8 13:05:22 2011 by
|
3423
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
3424
|
+
0.7.2 (ruby-1.9.2).
|
3425
|
+
</div>
|
3426
|
+
|
3427
|
+
</body>
|
3428
|
+
</html>
|