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.
Files changed (50) hide show
  1. data/Gemfile.lock +1 -1
  2. data/box-api.gemspec +1 -1
  3. data/doc/Box.html +108 -0
  4. data/doc/Box/Account.html +1099 -0
  5. data/doc/Box/Api.html +3428 -0
  6. data/doc/Box/Api/AccountExceeded.html +130 -0
  7. data/doc/Box/Api/EmailInvalid.html +141 -0
  8. data/doc/Box/Api/EmailTaken.html +130 -0
  9. data/doc/Box/Api/ErrorStatus.html +130 -0
  10. data/doc/Box/Api/Exception.html +120 -0
  11. data/doc/Box/Api/Generic.html +130 -0
  12. data/doc/Box/Api/InvalidFolder.html +141 -0
  13. data/doc/Box/Api/InvalidInput.html +130 -0
  14. data/doc/Box/Api/InvalidName.html +130 -0
  15. data/doc/Box/Api/NameTaken.html +130 -0
  16. data/doc/Box/Api/NoAccess.html +130 -0
  17. data/doc/Box/Api/NoParent.html +130 -0
  18. data/doc/Box/Api/NotAuthorized.html +130 -0
  19. data/doc/Box/Api/Restricted.html +141 -0
  20. data/doc/Box/Api/SizeExceeded.html +130 -0
  21. data/doc/Box/Api/Unknown.html +130 -0
  22. data/doc/Box/Api/UnknownResponse.html +141 -0
  23. data/doc/Box/Api/UploadFailed.html +141 -0
  24. data/doc/Box/File.html +580 -0
  25. data/doc/Box/Folder.html +1078 -0
  26. data/doc/Box/Item.html +1884 -0
  27. data/doc/_index.html +342 -0
  28. data/doc/class_list.html +47 -0
  29. data/doc/css/common.css +1 -0
  30. data/doc/css/full_list.css +53 -0
  31. data/doc/css/style.css +320 -0
  32. data/doc/file.README.html +98 -0
  33. data/doc/file_list.html +49 -0
  34. data/doc/frames.html +13 -0
  35. data/doc/index.html +98 -0
  36. data/doc/js/app.js +205 -0
  37. data/doc/js/full_list.js +150 -0
  38. data/doc/js/jquery.js +16 -0
  39. data/doc/method_list.html +574 -0
  40. data/doc/top-level-namespace.html +103 -0
  41. data/examples/login.rb +4 -4
  42. data/lib/box/account.rb +168 -51
  43. data/lib/box/api.rb +174 -16
  44. data/lib/box/api/exceptions.rb +4 -0
  45. data/lib/box/file.rb +17 -4
  46. data/lib/box/folder.rb +85 -30
  47. data/lib/box/item.rb +89 -20
  48. data/spec/account_spec.rb +0 -4
  49. data/spec/folder_spec.rb +3 -9
  50. metadata +42 -4
@@ -0,0 +1,1078 @@
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::Folder
8
+
9
+ &mdash; 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 (F)</a> &raquo;
37
+ <span class='title'><span class='object_link'><a href="../Box.html" title="Box (module)">Box</a></span></span>
38
+ &raquo;
39
+ <span class="title">Folder</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::Folder
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"><span class='object_link'><a href="Item.html" title="Box::Item (class)">Item</a></span></span>
70
+
71
+ <ul class="fullTree">
72
+ <li>Object</li>
73
+
74
+ <li class="next"><span class='object_link'><a href="Item.html" title="Box::Item (class)">Item</a></span></li>
75
+
76
+ <li class="next">Box::Folder</li>
77
+
78
+ </ul>
79
+ <a href="#" class="inheritanceTree">show all</a>
80
+
81
+ </dd>
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+ <dt class="r2 last">Defined in:</dt>
92
+ <dd class="r2 last">lib/box/folder.rb</dd>
93
+
94
+ </dl>
95
+ <div class="clear"></div>
96
+
97
+ <h2>Overview</h2><div class="docstring">
98
+ <div class="discussion">
99
+ <p>
100
+ Represents a folder stored on Box. Any attributes or actions typical to a
101
+ Box folder can be accessed through this class.
102
+ </p>
103
+
104
+
105
+ </div>
106
+ </div>
107
+ <div class="tags">
108
+
109
+ </div>
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+ <h2>Instance Attribute Summary</h2>
121
+
122
+ <h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Item.html" title="Box::Item (class)">Item</a></span></h3>
123
+ <p class="inherited"><span class='object_link'><a href="Item.html#api-instance_method" title="Box::Item#api (method)">api</a></span>, <span class='object_link'><a href="Item.html#data-instance_method" title="Box::Item#data (method)">data</a></span>, <span class='object_link'><a href="Item.html#parent-instance_method" title="Box::Item#parent (method)">parent</a></span></p>
124
+
125
+
126
+
127
+ <h2>
128
+ Class Method Summary
129
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
130
+ </h2>
131
+
132
+ <ul class="summary">
133
+
134
+ <li class="public ">
135
+ <span class="summary_signature">
136
+
137
+ <a href="#type-class_method" title="type (class method)">+ (String) <strong>type</strong> </a>
138
+
139
+
140
+
141
+ </span>
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+ <span class="summary_desc"><div class='inline'><p>
151
+ The string representation of this item.
152
+ </p>
153
+ </div></span>
154
+
155
+ </li>
156
+
157
+
158
+ </ul>
159
+
160
+ <h2>
161
+ Instance Method Summary
162
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
163
+ </h2>
164
+
165
+ <ul class="summary">
166
+
167
+ <li class="public ">
168
+ <span class="summary_signature">
169
+
170
+ <a href="#create-instance_method" title="#create (instance method)">- (Folder) <strong>create</strong>(name, share = 0) </a>
171
+
172
+
173
+
174
+ </span>
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+ <span class="summary_desc"><div class='inline'><p>
184
+ Create a new folder using this folder as the parent.
185
+ </p>
186
+ </div></span>
187
+
188
+ </li>
189
+
190
+
191
+ <li class="public ">
192
+ <span class="summary_signature">
193
+
194
+ <a href="#find-instance_method" title="#find (instance method)">- (Array) <strong>find</strong>(criteria) </a>
195
+
196
+
197
+
198
+ </span>
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+ <span class="summary_desc"><div class='inline'><p>
208
+ Search for sub-items using criteria.
209
+ </p>
210
+ </div></span>
211
+
212
+ </li>
213
+
214
+
215
+ <li class="public ">
216
+ <span class="summary_signature">
217
+
218
+ <a href="#force_cached_info-instance_method" title="#force_cached_info (instance method)">- (Object) <strong>force_cached_info</strong> </a>
219
+
220
+
221
+
222
+ </span>
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+ <span class="summary_desc"><div class='inline'><p>
232
+ Consider the item cached.
233
+ </p>
234
+ </div></span>
235
+
236
+ </li>
237
+
238
+
239
+ <li class="public ">
240
+ <span class="summary_signature">
241
+
242
+ <a href="#force_cached_tree-instance_method" title="#force_cached_tree (instance method)">- (Object) <strong>force_cached_tree</strong> </a>
243
+
244
+
245
+
246
+ </span>
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+
255
+ <span class="summary_desc"><div class='inline'><p>
256
+ Consider the tree cached.
257
+ </p>
258
+ </div></span>
259
+
260
+ </li>
261
+
262
+
263
+ <li class="public ">
264
+ <span class="summary_signature">
265
+
266
+ <a href="#info-instance_method" title="#info (instance method)">- (Item) <strong>info</strong>(refresh = false) </a>
267
+
268
+
269
+
270
+ </span>
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+ <span class="summary_desc"><div class='inline'><p>
280
+ Get the info for this item.
281
+ </p>
282
+ </div></span>
283
+
284
+ </li>
285
+
286
+
287
+ <li class="public ">
288
+ <span class="summary_signature">
289
+
290
+ <a href="#tree-instance_method" title="#tree (instance method)">- (Folder) <strong>tree</strong>(refresh = false) </a>
291
+
292
+
293
+
294
+ </span>
295
+
296
+
297
+
298
+
299
+
300
+
301
+
302
+
303
+ <span class="summary_desc"><div class='inline'><p>
304
+ Get the tree for this folder.
305
+ </p>
306
+ </div></span>
307
+
308
+ </li>
309
+
310
+
311
+ <li class="public ">
312
+ <span class="summary_signature">
313
+
314
+ <a href="#upload-instance_method" title="#upload (instance method)">- (File) <strong>upload</strong>(path) </a>
315
+
316
+
317
+
318
+ </span>
319
+
320
+
321
+
322
+
323
+
324
+
325
+
326
+
327
+ <span class="summary_desc"><div class='inline'><p>
328
+ Upload a new file using this folder as the parent.
329
+ </p>
330
+ </div></span>
331
+
332
+ </li>
333
+
334
+
335
+ </ul>
336
+
337
+
338
+
339
+
340
+
341
+
342
+
343
+
344
+
345
+
346
+ <h3 class="inherited">Methods inherited from <span class='object_link'><a href="Item.html" title="Box::Item (class)">Item</a></span></h3>
347
+ <p class="inherited"><span class='object_link'><a href="Item.html#copy-instance_method" title="Box::Item#copy (method)">#copy</a></span>, <span class='object_link'><a href="Item.html#delete-instance_method" title="Box::Item#delete (method)">#delete</a></span>, <span class='object_link'><a href="Item.html#description-instance_method" title="Box::Item#description (method)">#description</a></span>, <span class='object_link'><a href="Item.html#id-instance_method" title="Box::Item#id (method)">#id</a></span>, <span class='object_link'><a href="Item.html#initialize-instance_method" title="Box::Item#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="Item.html#method_missing-instance_method" title="Box::Item#method_missing (method)">#method_missing</a></span>, <span class='object_link'><a href="Item.html#move-instance_method" title="Box::Item#move (method)">#move</a></span>, <span class='object_link'><a href="Item.html#path-instance_method" title="Box::Item#path (method)">#path</a></span>, <span class='object_link'><a href="Item.html#rename-instance_method" title="Box::Item#rename (method)">#rename</a></span>, <span class='object_link'><a href="Item.html#type-instance_method" title="Box::Item#type (method)">#type</a></span>, <span class='object_link'><a href="Item.html#types-instance_method" title="Box::Item#types (method)">#types</a></span>, <span class='object_link'><a href="Item.html#types-class_method" title="Box::Item.types (method)">types</a></span></p>
348
+ <div id="constructor_details" class="method_details_list">
349
+ <h2>Constructor Details</h2>
350
+
351
+ <p class="notice">This class inherits a constructor from <span class='object_link'><a href="Item.html#initialize-instance_method" title="Box::Item#initialize (method)">Box::Item</a></span></p>
352
+
353
+ </div>
354
+ <div id="method_missing_details" class="method_details_list">
355
+ <h2>Dynamic Method Handling</h2>
356
+ <p class="notice super">
357
+ This class handles dynamic methods through the <tt>method_missing</tt> method
358
+
359
+ in the class <span class='object_link'><a href="Item.html#method_missing-instance_method" title="Box::Item#method_missing (method)">Box::Item</a></span>
360
+
361
+ </p>
362
+
363
+ </div>
364
+
365
+
366
+ <div id="class_method_details" class="method_details_list">
367
+ <h2>Class Method Details</h2>
368
+
369
+
370
+ <div class="method_details first">
371
+ <p class="signature first" id="type-class_method">
372
+
373
+ + (<tt>String</tt>) <strong>type</strong>
374
+
375
+
376
+
377
+ </p><div class="docstring">
378
+ <div class="discussion">
379
+ <p>
380
+ The string representation of this item.
381
+ </p>
382
+
383
+
384
+ </div>
385
+ </div>
386
+ <div class="tags">
387
+ <h3>Returns:</h3>
388
+ <ul class="return">
389
+
390
+ <li>
391
+
392
+
393
+ <span class='type'>(<tt>String</tt>)</span>
394
+
395
+
396
+
397
+ &mdash;
398
+ <div class='inline'><p>
399
+ The string representation of this item.
400
+ </p>
401
+ </div>
402
+
403
+ </li>
404
+
405
+ </ul>
406
+
407
+ </div><table class="source_code">
408
+ <tr>
409
+ <td>
410
+ <pre class="lines">
411
+
412
+
413
+ 10</pre>
414
+ </td>
415
+ <td>
416
+ <pre class="code"><span class="info file"># File 'lib/box/folder.rb', line 10</span>
417
+
418
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id type'>type</span><span class='semicolon'>;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>folder</span><span class='tstring_end'>'</span></span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
419
+ </td>
420
+ </tr>
421
+ </table>
422
+ </div>
423
+
424
+ </div>
425
+
426
+ <div id="instance_method_details" class="method_details_list">
427
+ <h2>Instance Method Details</h2>
428
+
429
+
430
+ <div class="method_details first">
431
+ <p class="signature first" id="create-instance_method">
432
+
433
+ - (<tt><span class='object_link'><a href="" title="Box::Folder (class)">Folder</a></span></tt>) <strong>create</strong>(name, share = 0)
434
+
435
+
436
+
437
+ </p><div class="docstring">
438
+ <div class="discussion">
439
+ <p>
440
+ Create a new folder using this folder as the parent.
441
+ </p>
442
+
443
+
444
+ </div>
445
+ </div>
446
+ <div class="tags">
447
+ <h3>Parameters:</h3>
448
+ <ul class="param">
449
+
450
+ <li>
451
+
452
+ <span class='name'>name</span>
453
+
454
+
455
+ <span class='type'>(<tt>String</tt>)</span>
456
+
457
+
458
+
459
+ &mdash;
460
+ <div class='inline'><p>
461
+ The name of the new folder.
462
+ </p>
463
+ </div>
464
+
465
+ </li>
466
+
467
+ <li>
468
+
469
+ <span class='name'>share</span>
470
+
471
+
472
+ <span class='type'>(<tt>Integer</tt>)</span>
473
+
474
+
475
+ <em class="default">(defaults to: <tt>0</tt>)</em>
476
+
477
+
478
+ &mdash;
479
+ <div class='inline'><p>
480
+ The shared status of the new folder. Defaults to not being shared.
481
+ </p>
482
+ </div>
483
+
484
+ </li>
485
+
486
+ </ul>
487
+ <h3>Returns:</h3>
488
+ <ul class="return">
489
+
490
+ <li>
491
+
492
+
493
+ <span class='type'>(<tt><span class='object_link'><a href="" title="Box::Folder (class)">Folder</a></span></tt>)</span>
494
+
495
+
496
+
497
+ &mdash;
498
+ <div class='inline'><p>
499
+ The new folder.
500
+ </p>
501
+ </div>
502
+
503
+ </li>
504
+
505
+ </ul>
506
+
507
+ </div><table class="source_code">
508
+ <tr>
509
+ <td>
510
+ <pre class="lines">
511
+
512
+
513
+ 52
514
+ 53
515
+ 54
516
+ 55
517
+ 56
518
+ 57
519
+ 58</pre>
520
+ </td>
521
+ <td>
522
+ <pre class="code"><span class="info file"># File 'lib/box/folder.rb', line 52</span>
523
+
524
+ <span class='kw'>def</span> <span class='id create'>create</span><span class='lparen'>(</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>
525
+ <span class='id info'>info</span> <span class='op'>=</span> <span class='ivar'>@api</span><span class='period'>.</span><span class='id create_folder'>create_folder</span><span class='lparen'>(</span><span class='id id'>id</span><span class='comma'>,</span> <span class='id name'>name</span><span class='comma'>,</span> <span class='id share'>share</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>folder</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
526
+
527
+ <span class='id delete_info'>delete_info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>folders</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
528
+
529
+ <span class='const'>Box</span><span class='op'>::</span><span class='const'>Folder</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='id api'>api</span><span class='comma'>,</span> <span class='kw'>self</span><span class='comma'>,</span> <span class='id info'>info</span><span class='rparen'>)</span>
530
+ <span class='kw'>end</span></pre>
531
+ </td>
532
+ </tr>
533
+ </table>
534
+ </div>
535
+
536
+ <div class="method_details ">
537
+ <p class="signature " id="find-instance_method">
538
+
539
+ - (<tt>Array</tt>) <strong>find</strong>(criteria)
540
+
541
+
542
+
543
+ </p><div class="docstring">
544
+ <div class="discussion">
545
+
546
+ <div class="note notetag">
547
+ <strong>Note:</strong>
548
+ <div class='inline'><p>
549
+ The recursive option will call <span class='object_link'><a href="#tree-instance_method" title="Box::Folder#tree (method)">#tree</a></span>, which can be slow for large
550
+ folders.
551
+ </p>
552
+ </div>
553
+ </div>
554
+
555
+ <div class="note notetag">
556
+ <strong>Note:</strong>
557
+ <div class='inline'><p>
558
+ Any item method (as a symbol) can be used as criteria, which could cause
559
+ major problems if used improperly.
560
+ </p>
561
+ </div>
562
+ </div>
563
+
564
+ <p>
565
+ Search for sub-items using criteria.
566
+ </p>
567
+ <p>
568
+ TODO: Lookup YARD syntax for options hash.
569
+ </p>
570
+
571
+
572
+ </div>
573
+ </div>
574
+ <div class="tags">
575
+
576
+ <div class="examples">
577
+ <h3>Examples:</h3>
578
+
579
+ <h4><div class='inline'><p>
580
+ Find all sub-items with the name &#8216;README&#8217;
581
+ </p>
582
+ </div></h4>
583
+ <pre class="example code"><span class='id folder'>folder</span><span class='period'>.</span><span class='id search'>search</span><span class='lparen'>(</span><span class='symbol'>:name</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>README</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span></pre>
584
+
585
+ <h4><div class='inline'><p>
586
+ Recusively find a sub-item with the given path.
587
+ </p>
588
+ </div></h4>
589
+ <pre class="example code"><span class='id folder'>folder</span><span class='period'>.</span><span class='id search'>search</span><span class='lparen'>(</span><span class='symbol'>:path</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/test/file.mp4</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:recursive</span> <span class='op'>=&gt;</span> <span class='kw'>true</span><span class='rparen'>)</span></pre>
590
+
591
+ <h4><div class='inline'><p>
592
+ Recursively find all files with a given sha1.
593
+ </p>
594
+ </div></h4>
595
+ <pre class="example code"><span class='id folder'>folder</span><span class='period'>.</span><span class='id search'>search</span><span class='lparen'>(</span><span class='symbol'>:type</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>file</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:sha1</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>abcdefg</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:recursive</span> <span class='op'>=&gt;</span> <span class='kw'>true</span><span class='rparen'>)</span></pre>
596
+
597
+ </div>
598
+ <h3>Parameters:</h3>
599
+ <ul class="param">
600
+
601
+ <li>
602
+
603
+ <span class='name'>criteria</span>
604
+
605
+
606
+ <span class='type'>(<tt>Hash</tt>)</span>
607
+
608
+
609
+
610
+ &mdash;
611
+ <div class='inline'><p>
612
+ The hash of criteria to use. Each key of the criteria will be called on
613
+ each sub-item and tested for equality. This lets you use any method of
614
+ <span class='object_link'><a href="Item.html" title="Box::Item (class)">Item</a></span>, <span class='object_link'><a href="" title="Box::Folder (class)">Box::Folder</a></span>, and <span class='object_link'><a href="File.html" title="Box::File (class)">Box::File</a></span> as the criteria.
615
+ </p>
616
+ </div>
617
+
618
+ </li>
619
+
620
+ </ul>
621
+ <h3>Returns:</h3>
622
+ <ul class="return">
623
+
624
+ <li>
625
+
626
+
627
+ <span class='type'>(<tt>Array</tt>)</span>
628
+
629
+
630
+
631
+ &mdash;
632
+ <div class='inline'><p>
633
+ An array of all sub-items that matched the criteria.
634
+ </p>
635
+ </div>
636
+
637
+ </li>
638
+
639
+ </ul>
640
+
641
+ </div><table class="source_code">
642
+ <tr>
643
+ <td>
644
+ <pre class="lines">
645
+
646
+
647
+ 95
648
+ 96
649
+ 97
650
+ 98
651
+ 99
652
+ 100
653
+ 101
654
+ 102</pre>
655
+ </td>
656
+ <td>
657
+ <pre class="code"><span class="info file"># File 'lib/box/folder.rb', line 95</span>
658
+
659
+ <span class='kw'>def</span> <span class='id find'>find</span><span class='lparen'>(</span><span class='id criteria'>criteria</span><span class='rparen'>)</span>
660
+ <span class='id recursive'>recursive</span> <span class='op'>=</span> <span class='id criteria'>criteria</span><span class='period'>.</span><span class='id delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:recursive</span><span class='rparen'>)</span>
661
+ <span class='id recursive'>recursive</span> <span class='op'>=</span> <span class='kw'>false</span> <span class='kw'>if</span> <span class='id recursive'>recursive</span> <span class='op'>==</span> <span class='kw'>nil</span> <span class='comment'># default to false for performance reasons
662
+ </span>
663
+ <span class='id tree'>tree</span> <span class='kw'>if</span> <span class='id recursive'>recursive</span> <span class='comment'># get the full tree
664
+ </span>
665
+ <span class='id find!'>find!</span><span class='lparen'>(</span><span class='id criteria'>criteria</span><span class='comma'>,</span> <span class='id recursive'>recursive</span><span class='rparen'>)</span>
666
+ <span class='kw'>end</span></pre>
667
+ </td>
668
+ </tr>
669
+ </table>
670
+ </div>
671
+
672
+ <div class="method_details ">
673
+ <p class="signature " id="force_cached_info-instance_method">
674
+
675
+ - (<tt>Object</tt>) <strong>force_cached_info</strong>
676
+
677
+
678
+
679
+ </p><div class="docstring">
680
+ <div class="discussion">
681
+ <p>
682
+ Consider the item cached. This prevents an additional api when we know the
683
+ item is fully fetched.
684
+ </p>
685
+
686
+
687
+ </div>
688
+ </div>
689
+ <div class="tags">
690
+
691
+ </div><table class="source_code">
692
+ <tr>
693
+ <td>
694
+ <pre class="lines">
695
+
696
+
697
+ 105
698
+ 106
699
+ 107
700
+ 108
701
+ 109</pre>
702
+ </td>
703
+ <td>
704
+ <pre class="code"><span class="info file"># File 'lib/box/folder.rb', line 105</span>
705
+
706
+ <span class='kw'>def</span> <span class='id force_cached_info'>force_cached_info</span>
707
+ <span class='id create_sub_items'>create_sub_items</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='const'>Box</span><span class='op'>::</span><span class='const'>Folder</span><span class='rparen'>)</span>
708
+ <span class='id create_sub_items'>create_sub_items</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='const'>Box</span><span class='op'>::</span><span class='const'>File</span><span class='rparen'>)</span>
709
+ <span class='kw'>super</span>
710
+ <span class='kw'>end</span></pre>
711
+ </td>
712
+ </tr>
713
+ </table>
714
+ </div>
715
+
716
+ <div class="method_details ">
717
+ <p class="signature " id="force_cached_tree-instance_method">
718
+
719
+ - (<tt>Object</tt>) <strong>force_cached_tree</strong>
720
+
721
+
722
+
723
+ </p><div class="docstring">
724
+ <div class="discussion">
725
+ <p>
726
+ Consider the tree cached. This prevents an additional api when we know the
727
+ item is fully fetched.
728
+ </p>
729
+
730
+
731
+ </div>
732
+ </div>
733
+ <div class="tags">
734
+
735
+ </div><table class="source_code">
736
+ <tr>
737
+ <td>
738
+ <pre class="lines">
739
+
740
+
741
+ 113
742
+ 114
743
+ 115
744
+ 116
745
+ 117
746
+ 118
747
+ 119
748
+ 120
749
+ 121
750
+ 122
751
+ 123
752
+ 124</pre>
753
+ </td>
754
+ <td>
755
+ <pre class="code"><span class="info file"># File 'lib/box/folder.rb', line 113</span>
756
+
757
+ <span class='kw'>def</span> <span class='id force_cached_tree'>force_cached_tree</span>
758
+ <span class='ivar'>@cached_tree</span> <span class='op'>=</span> <span class='kw'>true</span>
759
+ <span class='id force_cached_info'>force_cached_info</span>
760
+
761
+ <span class='id files'>files</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id file'>file</span><span class='op'>|</span>
762
+ <span class='id file'>file</span><span class='period'>.</span><span class='id force_cached_info'>force_cached_info</span>
763
+ <span class='kw'>end</span>
764
+
765
+ <span class='id folders'>folders</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id folder'>folder</span><span class='op'>|</span>
766
+ <span class='id folder'>folder</span><span class='period'>.</span><span class='id force_cached_tree'>force_cached_tree</span>
767
+ <span class='kw'>end</span>
768
+ <span class='kw'>end</span></pre>
769
+ </td>
770
+ </tr>
771
+ </table>
772
+ </div>
773
+
774
+ <div class="method_details ">
775
+ <p class="signature " id="info-instance_method">
776
+
777
+ - (<tt><span class='object_link'><a href="Item.html" title="Box::Item (class)">Item</a></span></tt>) <strong>info</strong>(refresh = false)
778
+
779
+
780
+
781
+ </p><div class="docstring">
782
+ <div class="discussion">
783
+ <p>
784
+ Get the info for this item. Uses a cached copy if avaliable, or else it is
785
+ fetched from the api.
786
+ </p>
787
+ <p>
788
+ Files and folders will only be one-level deep, and <span class='object_link'><a href="#tree-instance_method" title="Box::Folder#tree (method)">#tree</a></span> should be used
789
+ if fetching deeper than that.
790
+ </p>
791
+
792
+
793
+ </div>
794
+ </div>
795
+ <div class="tags">
796
+ <h3>Parameters:</h3>
797
+ <ul class="param">
798
+
799
+ <li>
800
+
801
+ <span class='name'>refresh</span>
802
+
803
+
804
+ <span class='type'>(<tt>Boolean</tt>)</span>
805
+
806
+
807
+ <em class="default">(defaults to: <tt>false</tt>)</em>
808
+
809
+
810
+ &mdash;
811
+ <div class='inline'><p>
812
+ Does not use the cached copy if true.
813
+ </p>
814
+ </div>
815
+
816
+ </li>
817
+
818
+ </ul>
819
+ <h3>Returns:</h3>
820
+ <ul class="return">
821
+
822
+ <li>
823
+
824
+
825
+ <span class='type'>(<tt><span class='object_link'><a href="Item.html" title="Box::Item (class)">Item</a></span></tt>)</span>
826
+
827
+
828
+
829
+ &mdash;
830
+ <div class='inline'><p>
831
+ self
832
+ </p>
833
+ </div>
834
+
835
+ </li>
836
+
837
+ </ul>
838
+
839
+ </div><table class="source_code">
840
+ <tr>
841
+ <td>
842
+ <pre class="lines">
843
+
844
+
845
+ 15
846
+ 16
847
+ 17
848
+ 18
849
+ 19
850
+ 20
851
+ 21
852
+ 22</pre>
853
+ </td>
854
+ <td>
855
+ <pre class="code"><span class="info file"># File 'lib/box/folder.rb', line 15</span>
856
+
857
+ <span class='kw'>def</span> <span class='id info'>info</span><span class='lparen'>(</span><span class='id refresh'>refresh</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
858
+ <span class='kw'>return</span> <span class='kw'>self</span> <span class='kw'>if</span> <span class='ivar'>@cached_info</span> <span class='kw'>and</span> <span class='kw'>not</span> <span class='id refresh'>refresh</span>
859
+
860
+ <span class='id create_sub_items'>create_sub_items</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='const'>Box</span><span class='op'>::</span><span class='const'>Folder</span><span class='rparen'>)</span>
861
+ <span class='id create_sub_items'>create_sub_items</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='const'>Box</span><span class='op'>::</span><span class='const'>File</span><span class='rparen'>)</span>
862
+
863
+ <span class='kw'>super</span>
864
+ <span class='kw'>end</span></pre>
865
+ </td>
866
+ </tr>
867
+ </table>
868
+ </div>
869
+
870
+ <div class="method_details ">
871
+ <p class="signature " id="tree-instance_method">
872
+
873
+ - (<tt><span class='object_link'><a href="" title="Box::Folder (class)">Folder</a></span></tt>) <strong>tree</strong>(refresh = false)
874
+
875
+
876
+
877
+ </p><div class="docstring">
878
+ <div class="discussion">
879
+
880
+ <div class="note notetag">
881
+ <strong>Note:</strong>
882
+ <div class='inline'><p>
883
+ Fetching the tree can take a long time for large folders. There is a
884
+ trade-off between one <span class='object_link'><a href="#tree-instance_method" title="Box::Folder#tree (method)">#tree</a></span> call and multiple <span class='object_link'><a href="#info-instance_method" title="Box::Folder#info (method)">#info</a></span> calls, so use the
885
+ one most relevant for your application.
886
+ </p>
887
+ </div>
888
+ </div>
889
+
890
+ <p>
891
+ Get the tree for this folder. The tree includes all sub folders and files,
892
+ including their info. Uses a cached copy if avaliable, or else it is
893
+ fetched from the api.
894
+ </p>
895
+
896
+
897
+ </div>
898
+ </div>
899
+ <div class="tags">
900
+ <h3>Parameters:</h3>
901
+ <ul class="param">
902
+
903
+ <li>
904
+
905
+ <span class='name'>refresh</span>
906
+
907
+
908
+ <span class='type'>(<tt>Boolean</tt>)</span>
909
+
910
+
911
+ <em class="default">(defaults to: <tt>false</tt>)</em>
912
+
913
+
914
+ &mdash;
915
+ <div class='inline'><p>
916
+ Does not use the cached copy if true.
917
+ </p>
918
+ </div>
919
+
920
+ </li>
921
+
922
+ </ul>
923
+ <h3>Returns:</h3>
924
+ <ul class="return">
925
+
926
+ <li>
927
+
928
+
929
+ <span class='type'>(<tt><span class='object_link'><a href="" title="Box::Folder (class)">Folder</a></span></tt>)</span>
930
+
931
+
932
+
933
+ &mdash;
934
+ <div class='inline'><p>
935
+ self
936
+ </p>
937
+ </div>
938
+
939
+ </li>
940
+
941
+ </ul>
942
+
943
+ </div><table class="source_code">
944
+ <tr>
945
+ <td>
946
+ <pre class="lines">
947
+
948
+
949
+ 34
950
+ 35
951
+ 36
952
+ 37
953
+ 38
954
+ 39
955
+ 40
956
+ 41
957
+ 42
958
+ 43
959
+ 44</pre>
960
+ </td>
961
+ <td>
962
+ <pre class="code"><span class="info file"># File 'lib/box/folder.rb', line 34</span>
963
+
964
+ <span class='kw'>def</span> <span class='id tree'>tree</span><span class='lparen'>(</span><span class='id refresh'>refresh</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
965
+ <span class='kw'>return</span> <span class='kw'>self</span> <span class='kw'>if</span> <span class='ivar'>@cached_tree</span> <span class='kw'>and</span> <span class='kw'>not</span> <span class='id refresh'>refresh</span>
966
+
967
+ <span class='ivar'>@cached_info</span> <span class='op'>=</span> <span class='kw'>true</span> <span class='comment'># count the info as cached as well
968
+ </span> <span class='ivar'>@cached_tree</span> <span class='op'>=</span> <span class='kw'>true</span>
969
+
970
+ <span class='id update_info'>update_info</span><span class='lparen'>(</span><span class='id get_tree'>get_tree</span><span class='rparen'>)</span>
971
+ <span class='id force_cached_tree'>force_cached_tree</span>
972
+
973
+ <span class='kw'>self</span>
974
+ <span class='kw'>end</span></pre>
975
+ </td>
976
+ </tr>
977
+ </table>
978
+ </div>
979
+
980
+ <div class="method_details ">
981
+ <p class="signature " id="upload-instance_method">
982
+
983
+ - (<tt><span class='object_link'><a href="File.html" title="Box::File (class)">File</a></span></tt>) <strong>upload</strong>(path)
984
+
985
+
986
+
987
+ </p><div class="docstring">
988
+ <div class="discussion">
989
+ <p>
990
+ Upload a new file using this folder as the parent
991
+ </p>
992
+
993
+
994
+ </div>
995
+ </div>
996
+ <div class="tags">
997
+ <h3>Parameters:</h3>
998
+ <ul class="param">
999
+
1000
+ <li>
1001
+
1002
+ <span class='name'>path</span>
1003
+
1004
+
1005
+ <span class='type'>(<tt>String</tt>)</span>
1006
+
1007
+
1008
+
1009
+ &mdash;
1010
+ <div class='inline'><p>
1011
+ The path of the file on disk to upload.
1012
+ </p>
1013
+ </div>
1014
+
1015
+ </li>
1016
+
1017
+ </ul>
1018
+ <h3>Returns:</h3>
1019
+ <ul class="return">
1020
+
1021
+ <li>
1022
+
1023
+
1024
+ <span class='type'>(<tt><span class='object_link'><a href="File.html" title="Box::File (class)">File</a></span></tt>)</span>
1025
+
1026
+
1027
+
1028
+ &mdash;
1029
+ <div class='inline'><p>
1030
+ The new file.
1031
+ </p>
1032
+ </div>
1033
+
1034
+ </li>
1035
+
1036
+ </ul>
1037
+
1038
+ </div><table class="source_code">
1039
+ <tr>
1040
+ <td>
1041
+ <pre class="lines">
1042
+
1043
+
1044
+ 64
1045
+ 65
1046
+ 66
1047
+ 67
1048
+ 68
1049
+ 69
1050
+ 70</pre>
1051
+ </td>
1052
+ <td>
1053
+ <pre class="code"><span class="info file"># File 'lib/box/folder.rb', line 64</span>
1054
+
1055
+ <span class='kw'>def</span> <span class='id upload'>upload</span><span class='lparen'>(</span><span class='id path'>path</span><span class='rparen'>)</span>
1056
+ <span class='id info'>info</span> <span class='op'>=</span> <span class='ivar'>@api</span><span class='period'>.</span><span class='id upload'>upload</span><span class='lparen'>(</span><span class='id path'>path</span><span class='comma'>,</span> <span class='id id'>id</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>files</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'>file</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
1057
+
1058
+ <span class='id delete_info'>delete_info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>files</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
1059
+
1060
+ <span class='const'>Box</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 api'>api</span><span class='comma'>,</span> <span class='kw'>self</span><span class='comma'>,</span> <span class='id info'>info</span><span class='rparen'>)</span>
1061
+ <span class='kw'>end</span></pre>
1062
+ </td>
1063
+ </tr>
1064
+ </table>
1065
+ </div>
1066
+
1067
+ </div>
1068
+
1069
+ </div>
1070
+
1071
+ <div id="footer">
1072
+ Generated on Mon Aug 8 13:05:22 2011 by
1073
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1074
+ 0.7.2 (ruby-1.9.2).
1075
+ </div>
1076
+
1077
+ </body>
1078
+ </html>