box-api 0.1.9 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/box-api.gemspec +1 -1
- data/doc/Box.html +5 -5
- data/doc/Box/Account.html +430 -188
- data/doc/Box/Api.html +731 -428
- data/doc/Box/Api/AccountExceeded.html +3 -3
- data/doc/Box/Api/EmailInvalid.html +6 -6
- data/doc/Box/Api/EmailTaken.html +3 -3
- data/doc/Box/Api/ErrorStatus.html +3 -3
- data/doc/Box/Api/Exception.html +3 -3
- data/doc/Box/Api/Generic.html +3 -3
- data/doc/Box/Api/InvalidFolder.html +6 -6
- data/doc/Box/Api/InvalidInput.html +3 -3
- data/doc/Box/Api/InvalidName.html +3 -3
- data/doc/Box/Api/NameTaken.html +3 -3
- data/doc/Box/Api/NoAccess.html +3 -3
- data/doc/Box/Api/NoParent.html +3 -3
- data/doc/Box/Api/NotAuthorized.html +3 -3
- data/doc/Box/Api/Restricted.html +6 -6
- data/doc/Box/Api/SizeExceeded.html +3 -3
- data/doc/Box/Api/Unknown.html +3 -3
- data/doc/Box/Api/UnknownResponse.html +6 -6
- data/doc/Box/Api/UploadFailed.html +6 -6
- data/doc/Box/Comment.html +560 -0
- data/doc/Box/File.html +318 -53
- data/doc/Box/Folder.html +298 -136
- data/doc/Box/Item.html +398 -348
- data/doc/_index.html +22 -7
- data/doc/class_list.html +1 -1
- data/doc/css/full_list.css +2 -0
- data/doc/css/style.css +2 -0
- data/doc/file.README.html +3 -3
- data/doc/frames.html +1 -1
- data/doc/index.html +3 -3
- data/doc/js/full_list.js +23 -6
- data/doc/method_list.html +233 -89
- data/doc/top-level-namespace.html +3 -3
- data/examples/files.rb +3 -5
- data/examples/login.rb +14 -18
- data/lib/box/account.rb +57 -16
- data/lib/box/api.rb +34 -1
- data/lib/box/api/exceptions.rb +3 -0
- data/lib/box/comment.rb +50 -0
- data/lib/box/file.rb +31 -0
- data/lib/box/folder.rb +57 -1
- data/lib/box/item.rb +20 -4
- data/spec/account_spec.rb +4 -0
- data/spec/file_spec.rb +37 -0
- data/spec/folder_spec.rb +78 -0
- data/spec/helper/account.rb +1 -1
- metadata +55 -61
data/doc/Box/Folder.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
Class: Box::Folder
|
|
8
8
|
|
|
9
|
-
— Documentation by YARD 0.7.
|
|
9
|
+
— Documentation by YARD 0.7.3
|
|
10
10
|
|
|
11
11
|
</title>
|
|
12
12
|
|
|
@@ -96,16 +96,16 @@
|
|
|
96
96
|
|
|
97
97
|
<h2>Overview</h2><div class="docstring">
|
|
98
98
|
<div class="discussion">
|
|
99
|
-
|
|
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>
|
|
99
|
+
|
|
100
|
+
<p>Represents a folder stored on Box. Any attributes or actions typical to a
|
|
101
|
+
Box folder can be accessed through this class.</p>
|
|
103
102
|
|
|
104
103
|
|
|
105
104
|
</div>
|
|
106
105
|
</div>
|
|
107
106
|
<div class="tags">
|
|
108
107
|
|
|
108
|
+
|
|
109
109
|
</div>
|
|
110
110
|
|
|
111
111
|
|
|
@@ -147,9 +147,8 @@ Box folder can be accessed through this class.
|
|
|
147
147
|
|
|
148
148
|
|
|
149
149
|
|
|
150
|
-
<span class="summary_desc"><div class='inline'
|
|
151
|
-
The string representation of this item
|
|
152
|
-
</p>
|
|
150
|
+
<span class="summary_desc"><div class='inline'>
|
|
151
|
+
<p>The string representation of this item.</p>
|
|
153
152
|
</div></span>
|
|
154
153
|
|
|
155
154
|
</li>
|
|
@@ -167,6 +166,29 @@ The string representation of this item.
|
|
|
167
166
|
<li class="public ">
|
|
168
167
|
<span class="summary_signature">
|
|
169
168
|
|
|
169
|
+
<a href="#at-instance_method" title="#at (instance method)">- (Item) <strong>at</strong>(target_path) </a>
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
</span>
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
<span class="summary_desc"><div class='inline'>
|
|
183
|
+
<p>Get the item at the given path.</p>
|
|
184
|
+
</div></span>
|
|
185
|
+
|
|
186
|
+
</li>
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
<li class="public ">
|
|
190
|
+
<span class="summary_signature">
|
|
191
|
+
|
|
170
192
|
<a href="#create-instance_method" title="#create (instance method)">- (Folder) <strong>create</strong>(name, share = 0) </a>
|
|
171
193
|
|
|
172
194
|
|
|
@@ -180,9 +202,8 @@ The string representation of this item.
|
|
|
180
202
|
|
|
181
203
|
|
|
182
204
|
|
|
183
|
-
<span class="summary_desc"><div class='inline'
|
|
184
|
-
Create a new folder using this folder as the parent
|
|
185
|
-
</p>
|
|
205
|
+
<span class="summary_desc"><div class='inline'>
|
|
206
|
+
<p>Create a new folder using this folder as the parent.</p>
|
|
186
207
|
</div></span>
|
|
187
208
|
|
|
188
209
|
</li>
|
|
@@ -204,9 +225,8 @@ Create a new folder using this folder as the parent.
|
|
|
204
225
|
|
|
205
226
|
|
|
206
227
|
|
|
207
|
-
<span class="summary_desc"><div class='inline'
|
|
208
|
-
Search for sub-items using criteria
|
|
209
|
-
</p>
|
|
228
|
+
<span class="summary_desc"><div class='inline'>
|
|
229
|
+
<p>Search for sub-items using criteria.</p>
|
|
210
230
|
</div></span>
|
|
211
231
|
|
|
212
232
|
</li>
|
|
@@ -228,9 +248,8 @@ Search for sub-items using criteria.
|
|
|
228
248
|
|
|
229
249
|
|
|
230
250
|
|
|
231
|
-
<span class="summary_desc"><div class='inline'
|
|
232
|
-
Consider the item cached
|
|
233
|
-
</p>
|
|
251
|
+
<span class="summary_desc"><div class='inline'>
|
|
252
|
+
<p>Consider the item cached.</p>
|
|
234
253
|
</div></span>
|
|
235
254
|
|
|
236
255
|
</li>
|
|
@@ -252,9 +271,8 @@ Consider the item cached.
|
|
|
252
271
|
|
|
253
272
|
|
|
254
273
|
|
|
255
|
-
<span class="summary_desc"><div class='inline'
|
|
256
|
-
Consider the tree cached
|
|
257
|
-
</p>
|
|
274
|
+
<span class="summary_desc"><div class='inline'>
|
|
275
|
+
<p>Consider the tree cached.</p>
|
|
258
276
|
</div></span>
|
|
259
277
|
|
|
260
278
|
</li>
|
|
@@ -276,9 +294,8 @@ Consider the tree cached.
|
|
|
276
294
|
|
|
277
295
|
|
|
278
296
|
|
|
279
|
-
<span class="summary_desc"><div class='inline'
|
|
280
|
-
Get the info for this item
|
|
281
|
-
</p>
|
|
297
|
+
<span class="summary_desc"><div class='inline'>
|
|
298
|
+
<p>Get the info for this item.</p>
|
|
282
299
|
</div></span>
|
|
283
300
|
|
|
284
301
|
</li>
|
|
@@ -300,9 +317,8 @@ Get the info for this item.
|
|
|
300
317
|
|
|
301
318
|
|
|
302
319
|
|
|
303
|
-
<span class="summary_desc"><div class='inline'
|
|
304
|
-
Get the tree for this folder
|
|
305
|
-
</p>
|
|
320
|
+
<span class="summary_desc"><div class='inline'>
|
|
321
|
+
<p>Get the tree for this folder.</p>
|
|
306
322
|
</div></span>
|
|
307
323
|
|
|
308
324
|
</li>
|
|
@@ -324,9 +340,8 @@ Get the tree for this folder.
|
|
|
324
340
|
|
|
325
341
|
|
|
326
342
|
|
|
327
|
-
<span class="summary_desc"><div class='inline'
|
|
328
|
-
Upload a new file using this folder as the parent
|
|
329
|
-
</p>
|
|
343
|
+
<span class="summary_desc"><div class='inline'>
|
|
344
|
+
<p>Upload a new file using this folder as the parent.</p>
|
|
330
345
|
</div></span>
|
|
331
346
|
|
|
332
347
|
</li>
|
|
@@ -344,7 +359,7 @@ Upload a new file using this folder as the parent.
|
|
|
344
359
|
|
|
345
360
|
|
|
346
361
|
<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#
|
|
362
|
+
<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#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#respond_to%3F-instance_method" title="Box::Item#respond_to? (method)">#respond_to?</a></span>, <span class='object_link'><a href="Item.html#set_description-instance_method" title="Box::Item#set_description (method)">#set_description</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
363
|
<div id="constructor_details" class="method_details_list">
|
|
349
364
|
<h2>Constructor Details</h2>
|
|
350
365
|
|
|
@@ -376,15 +391,15 @@ Upload a new file using this folder as the parent.
|
|
|
376
391
|
|
|
377
392
|
</p><div class="docstring">
|
|
378
393
|
<div class="discussion">
|
|
379
|
-
|
|
380
|
-
The string representation of this item
|
|
381
|
-
</p>
|
|
394
|
+
|
|
395
|
+
<p>The string representation of this item.</p>
|
|
382
396
|
|
|
383
397
|
|
|
384
398
|
</div>
|
|
385
399
|
</div>
|
|
386
400
|
<div class="tags">
|
|
387
|
-
|
|
401
|
+
|
|
402
|
+
<h3>Returns:</h3>
|
|
388
403
|
<ul class="return">
|
|
389
404
|
|
|
390
405
|
<li>
|
|
@@ -395,9 +410,8 @@ The string representation of this item.
|
|
|
395
410
|
|
|
396
411
|
|
|
397
412
|
—
|
|
398
|
-
<div class='inline'
|
|
399
|
-
The string representation of this item
|
|
400
|
-
</p>
|
|
413
|
+
<div class='inline'>
|
|
414
|
+
<p>The string representation of this item.</p>
|
|
401
415
|
</div>
|
|
402
416
|
|
|
403
417
|
</li>
|
|
@@ -428,7 +442,176 @@ The string representation of this item.
|
|
|
428
442
|
|
|
429
443
|
|
|
430
444
|
<div class="method_details first">
|
|
431
|
-
<p class="signature first" id="
|
|
445
|
+
<p class="signature first" id="at-instance_method">
|
|
446
|
+
|
|
447
|
+
- (<tt><span class='object_link'><a href="Item.html" title="Box::Item (class)">Item</a></span></tt>) <strong>at</strong>(target_path)
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
</p><div class="docstring">
|
|
452
|
+
<div class="discussion">
|
|
453
|
+
|
|
454
|
+
<p>Get the item at the given path.</p>
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
</div>
|
|
458
|
+
</div>
|
|
459
|
+
<div class="tags">
|
|
460
|
+
|
|
461
|
+
<div class="examples">
|
|
462
|
+
<h3>Examples:</h3>
|
|
463
|
+
|
|
464
|
+
<h4><div class='inline'>
|
|
465
|
+
<p>Find a folder based on its absolute path.</p>
|
|
466
|
+
</div></h4>
|
|
467
|
+
<pre class="example code"><span class='id folder'>folder</span><span class='period'>.</span><span class='id at'>at</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/box/is/awesome</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span></pre>
|
|
468
|
+
|
|
469
|
+
<h4><div class='inline'>
|
|
470
|
+
<p>Find a file based on a relative path.</p>
|
|
471
|
+
</div></h4>
|
|
472
|
+
<pre class="example code"><span class='id folder'>folder</span><span class='period'>.</span><span class='id at'>at</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>awesome/file.pdf</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span></pre>
|
|
473
|
+
|
|
474
|
+
<h4><div class='inline'>
|
|
475
|
+
<p>Find a folder using the parent.</p>
|
|
476
|
+
</div></h4>
|
|
477
|
+
<pre class="example code"><span class='id folder'>folder</span><span class='period'>.</span><span class='id at'>at</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>../other/folder</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span></pre>
|
|
478
|
+
|
|
479
|
+
</div>
|
|
480
|
+
<h3>Parameters:</h3>
|
|
481
|
+
<ul class="param">
|
|
482
|
+
|
|
483
|
+
<li>
|
|
484
|
+
|
|
485
|
+
<span class='name'>The</span>
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
—
|
|
493
|
+
<div class='inline'>
|
|
494
|
+
<p>path to search for. This follows the typical unix path syntax, in that the
|
|
495
|
+
root folder is '/'. Supports the dot sytax, where '.' is the current folder
|
|
496
|
+
and '..' is the parent folder.</p>
|
|
497
|
+
</div>
|
|
498
|
+
|
|
499
|
+
</li>
|
|
500
|
+
|
|
501
|
+
</ul>
|
|
502
|
+
|
|
503
|
+
<h3>Returns:</h3>
|
|
504
|
+
<ul class="return">
|
|
505
|
+
|
|
506
|
+
<li>
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
<span class='type'>(<tt><span class='object_link'><a href="Item.html" title="Box::Item (class)">Item</a></span></tt>)</span>
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
—
|
|
514
|
+
<div class='inline'>
|
|
515
|
+
<p>The item that exists at this path, or nil.</p>
|
|
516
|
+
</div>
|
|
517
|
+
|
|
518
|
+
</li>
|
|
519
|
+
|
|
520
|
+
</ul>
|
|
521
|
+
|
|
522
|
+
</div><table class="source_code">
|
|
523
|
+
<tr>
|
|
524
|
+
<td>
|
|
525
|
+
<pre class="lines">
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
142
|
|
529
|
+
143
|
|
530
|
+
144
|
|
531
|
+
145
|
|
532
|
+
146
|
|
533
|
+
147
|
|
534
|
+
148
|
|
535
|
+
149
|
|
536
|
+
150
|
|
537
|
+
151
|
|
538
|
+
152
|
|
539
|
+
153
|
|
540
|
+
154
|
|
541
|
+
155
|
|
542
|
+
156
|
|
543
|
+
157
|
|
544
|
+
158
|
|
545
|
+
159
|
|
546
|
+
160
|
|
547
|
+
161
|
|
548
|
+
162
|
|
549
|
+
163
|
|
550
|
+
164
|
|
551
|
+
165
|
|
552
|
+
166
|
|
553
|
+
167
|
|
554
|
+
168
|
|
555
|
+
169
|
|
556
|
+
170
|
|
557
|
+
171
|
|
558
|
+
172
|
|
559
|
+
173
|
|
560
|
+
174
|
|
561
|
+
175
|
|
562
|
+
176
|
|
563
|
+
177
|
|
564
|
+
178
|
|
565
|
+
179</pre>
|
|
566
|
+
</td>
|
|
567
|
+
<td>
|
|
568
|
+
<pre class="code"><span class="info file"># File 'lib/box/folder.rb', line 142</span>
|
|
569
|
+
|
|
570
|
+
<span class='kw'>def</span> <span class='id at'>at</span><span class='lparen'>(</span><span class='id target_path'>target_path</span><span class='rparen'>)</span>
|
|
571
|
+
<span class='comment'># start with this folder
|
|
572
|
+
</span> <span class='id current'>current</span> <span class='op'>=</span> <span class='kw'>self</span>
|
|
573
|
+
|
|
574
|
+
<span class='kw'>if</span> <span class='id target_path'>target_path</span><span class='period'>.</span><span class='id start_with?'>start_with?</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>
|
|
575
|
+
<span class='comment'># absolute path, find the root folder
|
|
576
|
+
</span> <span class='id current'>current</span> <span class='op'>=</span> <span class='id current'>current</span><span class='period'>.</span><span class='id parent'>parent</span> <span class='kw'>while</span> <span class='id current'>current</span><span class='period'>.</span><span class='id parent'>parent</span> <span class='op'>!=</span> <span class='kw'>nil</span>
|
|
577
|
+
<span class='kw'>end</span>
|
|
578
|
+
|
|
579
|
+
<span class='comment'># split each part of the target path
|
|
580
|
+
</span> <span class='id target_path'>target_path</span><span class='period'>.</span><span class='id split'>split</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><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id target_name'>target_name</span><span class='op'>|</span>
|
|
581
|
+
<span class='comment'># update current based on the target name
|
|
582
|
+
</span> <span class='id current'>current</span> <span class='op'>=</span> <span class='kw'>case</span> <span class='id target_name'>target_name</span>
|
|
583
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span>
|
|
584
|
+
<span class='comment'># no-op
|
|
585
|
+
</span> <span class='id current'>current</span>
|
|
586
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>..</span><span class='tstring_end'>"</span></span>
|
|
587
|
+
<span class='comment'># use the parent folder
|
|
588
|
+
</span> <span class='id parent'>parent</span>
|
|
589
|
+
<span class='kw'>else</span>
|
|
590
|
+
<span class='comment'># must be a file/folder name, so make sure this is a folder
|
|
591
|
+
</span> <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>unless</span> <span class='id current'>current</span> <span class='kw'>and</span> <span class='id current'>current</span><span class='period'>.</span><span class='id type'>type</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>folder</span><span class='tstring_end'>'</span></span>
|
|
592
|
+
|
|
593
|
+
<span class='comment'># search for an item with that name
|
|
594
|
+
</span> <span class='id current'>current</span><span class='period'>.</span><span class='id find'>find</span><span class='lparen'>(</span><span class='symbol'>:name</span> <span class='op'>=></span> <span class='id target_name'>target_name</span><span class='comma'>,</span> <span class='symbol'>:recursive</span> <span class='op'>=></span> <span class='kw'>false</span><span class='rparen'>)</span><span class='period'>.</span><span class='id first'>first</span>
|
|
595
|
+
<span class='kw'>end</span>
|
|
596
|
+
<span class='kw'>end</span>
|
|
597
|
+
|
|
598
|
+
<span class='kw'>if</span> <span class='id current'>current</span>
|
|
599
|
+
<span class='comment'># ends with a slash, so it has to be a folder
|
|
600
|
+
</span> <span class='kw'>if</span> <span class='id target_path'>target_path</span><span class='period'>.</span><span class='id end_with?'>end_with?</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> <span class='kw'>and</span> <span class='id current'>current</span><span class='period'>.</span><span class='id type'>type</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>folder</span><span class='tstring_end'>'</span></span>
|
|
601
|
+
<span class='comment'># get the folder with the same name (if it exists)
|
|
602
|
+
</span> <span class='id current'>current</span> <span class='op'>=</span> <span class='id parent'>parent</span><span class='period'>.</span><span class='id find'>find</span><span class='lparen'>(</span><span class='symbol'>:type</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>folder</span><span class='tstring_end'>'</span></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'>:recursive</span> <span class='op'>=></span> <span class='kw'>false</span><span class='rparen'>)</span><span class='period'>.</span><span class='id first'>first</span>
|
|
603
|
+
<span class='kw'>end</span>
|
|
604
|
+
<span class='kw'>end</span>
|
|
605
|
+
|
|
606
|
+
<span class='id current'>current</span>
|
|
607
|
+
<span class='kw'>end</span></pre>
|
|
608
|
+
</td>
|
|
609
|
+
</tr>
|
|
610
|
+
</table>
|
|
611
|
+
</div>
|
|
612
|
+
|
|
613
|
+
<div class="method_details ">
|
|
614
|
+
<p class="signature " id="create-instance_method">
|
|
432
615
|
|
|
433
616
|
- (<tt><span class='object_link'><a href="" title="Box::Folder (class)">Folder</a></span></tt>) <strong>create</strong>(name, share = 0)
|
|
434
617
|
|
|
@@ -436,9 +619,8 @@ The string representation of this item.
|
|
|
436
619
|
|
|
437
620
|
</p><div class="docstring">
|
|
438
621
|
<div class="discussion">
|
|
439
|
-
|
|
440
|
-
Create a new folder using this folder as the parent
|
|
441
|
-
</p>
|
|
622
|
+
|
|
623
|
+
<p>Create a new folder using this folder as the parent.</p>
|
|
442
624
|
|
|
443
625
|
|
|
444
626
|
</div>
|
|
@@ -457,9 +639,8 @@ Create a new folder using this folder as the parent.
|
|
|
457
639
|
|
|
458
640
|
|
|
459
641
|
—
|
|
460
|
-
<div class='inline'
|
|
461
|
-
The name of the new folder
|
|
462
|
-
</p>
|
|
642
|
+
<div class='inline'>
|
|
643
|
+
<p>The name of the new folder.</p>
|
|
463
644
|
</div>
|
|
464
645
|
|
|
465
646
|
</li>
|
|
@@ -476,14 +657,14 @@ The name of the new folder.
|
|
|
476
657
|
|
|
477
658
|
|
|
478
659
|
—
|
|
479
|
-
<div class='inline'
|
|
480
|
-
The shared status of the new folder. Defaults to not being shared
|
|
481
|
-
</p>
|
|
660
|
+
<div class='inline'>
|
|
661
|
+
<p>The shared status of the new folder. Defaults to not being shared.</p>
|
|
482
662
|
</div>
|
|
483
663
|
|
|
484
664
|
</li>
|
|
485
665
|
|
|
486
666
|
</ul>
|
|
667
|
+
|
|
487
668
|
<h3>Returns:</h3>
|
|
488
669
|
<ul class="return">
|
|
489
670
|
|
|
@@ -495,9 +676,8 @@ The shared status of the new folder. Defaults to not being shared.
|
|
|
495
676
|
|
|
496
677
|
|
|
497
678
|
—
|
|
498
|
-
<div class='inline'
|
|
499
|
-
The new folder
|
|
500
|
-
</p>
|
|
679
|
+
<div class='inline'>
|
|
680
|
+
<p>The new folder.</p>
|
|
501
681
|
</div>
|
|
502
682
|
|
|
503
683
|
</li>
|
|
@@ -545,28 +725,24 @@ The new folder.
|
|
|
545
725
|
|
|
546
726
|
<div class="note notetag">
|
|
547
727
|
<strong>Note:</strong>
|
|
548
|
-
<div class='inline'
|
|
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>
|
|
728
|
+
<div class='inline'>
|
|
729
|
+
<p>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
|
|
730
|
+
folders.</p>
|
|
552
731
|
</div>
|
|
553
732
|
</div>
|
|
554
733
|
|
|
555
734
|
<div class="note notetag">
|
|
556
735
|
<strong>Note:</strong>
|
|
557
|
-
<div class='inline'
|
|
558
|
-
Any item method (as a symbol) can be used as criteria, which could cause
|
|
559
|
-
major problems if used improperly
|
|
560
|
-
</p>
|
|
736
|
+
<div class='inline'>
|
|
737
|
+
<p>Any item method (as a symbol) can be used as criteria, which could cause
|
|
738
|
+
major problems if used improperly.</p>
|
|
561
739
|
</div>
|
|
562
740
|
</div>
|
|
563
741
|
|
|
564
|
-
|
|
565
|
-
Search for sub-items using criteria
|
|
566
|
-
|
|
567
|
-
<p>
|
|
568
|
-
TODO: Lookup YARD syntax for options hash.
|
|
569
|
-
</p>
|
|
742
|
+
|
|
743
|
+
<p>Search for sub-items using criteria.</p>
|
|
744
|
+
|
|
745
|
+
<p>TODO: Lookup YARD syntax for options hash.</p>
|
|
570
746
|
|
|
571
747
|
|
|
572
748
|
</div>
|
|
@@ -576,21 +752,18 @@ TODO: Lookup YARD syntax for options hash.
|
|
|
576
752
|
<div class="examples">
|
|
577
753
|
<h3>Examples:</h3>
|
|
578
754
|
|
|
579
|
-
<h4><div class='inline'
|
|
580
|
-
Find all sub-items with the name
|
|
581
|
-
</p>
|
|
755
|
+
<h4><div class='inline'>
|
|
756
|
+
<p>Find all sub-items with the name 'README'</p>
|
|
582
757
|
</div></h4>
|
|
583
758
|
<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'>=></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
759
|
|
|
585
|
-
<h4><div class='inline'
|
|
586
|
-
Recusively find a sub-item with the given path
|
|
587
|
-
</p>
|
|
760
|
+
<h4><div class='inline'>
|
|
761
|
+
<p>Recusively find a sub-item with the given path.</p>
|
|
588
762
|
</div></h4>
|
|
589
763
|
<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'>=></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'>=></span> <span class='kw'>true</span><span class='rparen'>)</span></pre>
|
|
590
764
|
|
|
591
|
-
<h4><div class='inline'
|
|
592
|
-
Recursively find all files with a given sha1
|
|
593
|
-
</p>
|
|
765
|
+
<h4><div class='inline'>
|
|
766
|
+
<p>Recursively find all files with a given sha1.</p>
|
|
594
767
|
</div></h4>
|
|
595
768
|
<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'>=></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'>=></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'>=></span> <span class='kw'>true</span><span class='rparen'>)</span></pre>
|
|
596
769
|
|
|
@@ -608,16 +781,16 @@ Recursively find all files with a given sha1.
|
|
|
608
781
|
|
|
609
782
|
|
|
610
783
|
—
|
|
611
|
-
<div class='inline'
|
|
612
|
-
The hash of criteria to use. Each key of the criteria will be called on
|
|
784
|
+
<div class='inline'>
|
|
785
|
+
<p>The hash of criteria to use. Each key of the criteria will be called on
|
|
613
786
|
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>
|
|
787
|
+
<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.</p>
|
|
616
788
|
</div>
|
|
617
789
|
|
|
618
790
|
</li>
|
|
619
791
|
|
|
620
792
|
</ul>
|
|
793
|
+
|
|
621
794
|
<h3>Returns:</h3>
|
|
622
795
|
<ul class="return">
|
|
623
796
|
|
|
@@ -629,9 +802,8 @@ each sub-item and tested for equality. This lets you use any method of
|
|
|
629
802
|
|
|
630
803
|
|
|
631
804
|
—
|
|
632
|
-
<div class='inline'
|
|
633
|
-
An array of all sub-items that matched the criteria
|
|
634
|
-
</p>
|
|
805
|
+
<div class='inline'>
|
|
806
|
+
<p>An array of all sub-items that matched the criteria.</p>
|
|
635
807
|
</div>
|
|
636
808
|
|
|
637
809
|
</li>
|
|
@@ -678,16 +850,16 @@ An array of all sub-items that matched the criteria.
|
|
|
678
850
|
|
|
679
851
|
</p><div class="docstring">
|
|
680
852
|
<div class="discussion">
|
|
681
|
-
|
|
682
|
-
Consider the item cached. This prevents an additional api when we know the
|
|
683
|
-
item is fully fetched
|
|
684
|
-
</p>
|
|
853
|
+
|
|
854
|
+
<p>Consider the item cached. This prevents an additional api when we know the
|
|
855
|
+
item is fully fetched.</p>
|
|
685
856
|
|
|
686
857
|
|
|
687
858
|
</div>
|
|
688
859
|
</div>
|
|
689
860
|
<div class="tags">
|
|
690
861
|
|
|
862
|
+
|
|
691
863
|
</div><table class="source_code">
|
|
692
864
|
<tr>
|
|
693
865
|
<td>
|
|
@@ -698,7 +870,8 @@ item is fully fetched.
|
|
|
698
870
|
106
|
|
699
871
|
107
|
|
700
872
|
108
|
|
701
|
-
109
|
|
873
|
+
109
|
|
874
|
+
110</pre>
|
|
702
875
|
</td>
|
|
703
876
|
<td>
|
|
704
877
|
<pre class="code"><span class="info file"># File 'lib/box/folder.rb', line 105</span>
|
|
@@ -706,6 +879,7 @@ item is fully fetched.
|
|
|
706
879
|
<span class='kw'>def</span> <span class='id force_cached_info'>force_cached_info</span>
|
|
707
880
|
<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
881
|
<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>
|
|
882
|
+
|
|
709
883
|
<span class='kw'>super</span>
|
|
710
884
|
<span class='kw'>end</span></pre>
|
|
711
885
|
</td>
|
|
@@ -722,23 +896,22 @@ item is fully fetched.
|
|
|
722
896
|
|
|
723
897
|
</p><div class="docstring">
|
|
724
898
|
<div class="discussion">
|
|
725
|
-
|
|
726
|
-
Consider the tree cached. This prevents an additional api when we know the
|
|
727
|
-
item is fully fetched
|
|
728
|
-
</p>
|
|
899
|
+
|
|
900
|
+
<p>Consider the tree cached. This prevents an additional api when we know the
|
|
901
|
+
item is fully fetched.</p>
|
|
729
902
|
|
|
730
903
|
|
|
731
904
|
</div>
|
|
732
905
|
</div>
|
|
733
906
|
<div class="tags">
|
|
734
907
|
|
|
908
|
+
|
|
735
909
|
</div><table class="source_code">
|
|
736
910
|
<tr>
|
|
737
911
|
<td>
|
|
738
912
|
<pre class="lines">
|
|
739
913
|
|
|
740
914
|
|
|
741
|
-
113
|
|
742
915
|
114
|
|
743
916
|
115
|
|
744
917
|
116
|
|
@@ -748,19 +921,16 @@ item is fully fetched.
|
|
|
748
921
|
120
|
|
749
922
|
121
|
|
750
923
|
122
|
|
751
|
-
123
|
|
752
|
-
124</pre>
|
|
924
|
+
123</pre>
|
|
753
925
|
</td>
|
|
754
926
|
<td>
|
|
755
|
-
<pre class="code"><span class="info file"># File 'lib/box/folder.rb', line
|
|
927
|
+
<pre class="code"><span class="info file"># File 'lib/box/folder.rb', line 114</span>
|
|
756
928
|
|
|
757
929
|
<span class='kw'>def</span> <span class='id force_cached_tree'>force_cached_tree</span>
|
|
758
930
|
<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
931
|
|
|
761
|
-
<span class='id
|
|
762
|
-
|
|
763
|
-
<span class='kw'>end</span>
|
|
932
|
+
<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>
|
|
933
|
+
<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>
|
|
764
934
|
|
|
765
935
|
<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
936
|
<span class='id folder'>folder</span><span class='period'>.</span><span class='id force_cached_tree'>force_cached_tree</span>
|
|
@@ -780,14 +950,12 @@ item is fully fetched.
|
|
|
780
950
|
|
|
781
951
|
</p><div class="docstring">
|
|
782
952
|
<div class="discussion">
|
|
783
|
-
|
|
784
|
-
Get the info for this item. Uses a cached copy if avaliable, or else it is
|
|
785
|
-
fetched from the api
|
|
786
|
-
|
|
787
|
-
<p>
|
|
788
|
-
|
|
789
|
-
if fetching deeper than that.
|
|
790
|
-
</p>
|
|
953
|
+
|
|
954
|
+
<p>Get the info for this item. Uses a cached copy if avaliable, or else it is
|
|
955
|
+
fetched from the api.</p>
|
|
956
|
+
|
|
957
|
+
<p>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
|
|
958
|
+
if fetching deeper than that.</p>
|
|
791
959
|
|
|
792
960
|
|
|
793
961
|
</div>
|
|
@@ -808,14 +976,14 @@ if fetching deeper than that.
|
|
|
808
976
|
|
|
809
977
|
|
|
810
978
|
—
|
|
811
|
-
<div class='inline'
|
|
812
|
-
Does not use the cached copy if true
|
|
813
|
-
</p>
|
|
979
|
+
<div class='inline'>
|
|
980
|
+
<p>Does not use the cached copy if true.</p>
|
|
814
981
|
</div>
|
|
815
982
|
|
|
816
983
|
</li>
|
|
817
984
|
|
|
818
985
|
</ul>
|
|
986
|
+
|
|
819
987
|
<h3>Returns:</h3>
|
|
820
988
|
<ul class="return">
|
|
821
989
|
|
|
@@ -827,9 +995,8 @@ Does not use the cached copy if true.
|
|
|
827
995
|
|
|
828
996
|
|
|
829
997
|
—
|
|
830
|
-
<div class='inline'
|
|
831
|
-
self
|
|
832
|
-
</p>
|
|
998
|
+
<div class='inline'>
|
|
999
|
+
<p>self</p>
|
|
833
1000
|
</div>
|
|
834
1001
|
|
|
835
1002
|
</li>
|
|
@@ -879,19 +1046,17 @@ self
|
|
|
879
1046
|
|
|
880
1047
|
<div class="note notetag">
|
|
881
1048
|
<strong>Note:</strong>
|
|
882
|
-
<div class='inline'
|
|
883
|
-
Fetching the tree can take a long time for large folders. There is a
|
|
1049
|
+
<div class='inline'>
|
|
1050
|
+
<p>Fetching the tree can take a long time for large folders. There is a
|
|
884
1051
|
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>
|
|
1052
|
+
one most relevant for your application.</p>
|
|
887
1053
|
</div>
|
|
888
1054
|
</div>
|
|
889
1055
|
|
|
890
|
-
|
|
891
|
-
Get the tree for this folder. The tree includes all sub folders and files,
|
|
1056
|
+
|
|
1057
|
+
<p>Get the tree for this folder. The tree includes all sub folders and files,
|
|
892
1058
|
including their info. Uses a cached copy if avaliable, or else it is
|
|
893
|
-
fetched from the api
|
|
894
|
-
</p>
|
|
1059
|
+
fetched from the api.</p>
|
|
895
1060
|
|
|
896
1061
|
|
|
897
1062
|
</div>
|
|
@@ -912,14 +1077,14 @@ fetched from the api.
|
|
|
912
1077
|
|
|
913
1078
|
|
|
914
1079
|
—
|
|
915
|
-
<div class='inline'
|
|
916
|
-
Does not use the cached copy if true
|
|
917
|
-
</p>
|
|
1080
|
+
<div class='inline'>
|
|
1081
|
+
<p>Does not use the cached copy if true.</p>
|
|
918
1082
|
</div>
|
|
919
1083
|
|
|
920
1084
|
</li>
|
|
921
1085
|
|
|
922
1086
|
</ul>
|
|
1087
|
+
|
|
923
1088
|
<h3>Returns:</h3>
|
|
924
1089
|
<ul class="return">
|
|
925
1090
|
|
|
@@ -931,9 +1096,8 @@ Does not use the cached copy if true.
|
|
|
931
1096
|
|
|
932
1097
|
|
|
933
1098
|
—
|
|
934
|
-
<div class='inline'
|
|
935
|
-
self
|
|
936
|
-
</p>
|
|
1099
|
+
<div class='inline'>
|
|
1100
|
+
<p>self</p>
|
|
937
1101
|
</div>
|
|
938
1102
|
|
|
939
1103
|
</li>
|
|
@@ -986,9 +1150,8 @@ self
|
|
|
986
1150
|
|
|
987
1151
|
</p><div class="docstring">
|
|
988
1152
|
<div class="discussion">
|
|
989
|
-
|
|
990
|
-
Upload a new file using this folder as the parent
|
|
991
|
-
</p>
|
|
1153
|
+
|
|
1154
|
+
<p>Upload a new file using this folder as the parent</p>
|
|
992
1155
|
|
|
993
1156
|
|
|
994
1157
|
</div>
|
|
@@ -1007,14 +1170,14 @@ Upload a new file using this folder as the parent
|
|
|
1007
1170
|
|
|
1008
1171
|
|
|
1009
1172
|
—
|
|
1010
|
-
<div class='inline'
|
|
1011
|
-
The path of the file on disk to upload
|
|
1012
|
-
</p>
|
|
1173
|
+
<div class='inline'>
|
|
1174
|
+
<p>The path of the file on disk to upload.</p>
|
|
1013
1175
|
</div>
|
|
1014
1176
|
|
|
1015
1177
|
</li>
|
|
1016
1178
|
|
|
1017
1179
|
</ul>
|
|
1180
|
+
|
|
1018
1181
|
<h3>Returns:</h3>
|
|
1019
1182
|
<ul class="return">
|
|
1020
1183
|
|
|
@@ -1026,9 +1189,8 @@ The path of the file on disk to upload.
|
|
|
1026
1189
|
|
|
1027
1190
|
|
|
1028
1191
|
—
|
|
1029
|
-
<div class='inline'
|
|
1030
|
-
The new file
|
|
1031
|
-
</p>
|
|
1192
|
+
<div class='inline'>
|
|
1193
|
+
<p>The new file.</p>
|
|
1032
1194
|
</div>
|
|
1033
1195
|
|
|
1034
1196
|
</li>
|
|
@@ -1069,9 +1231,9 @@ The new file.
|
|
|
1069
1231
|
</div>
|
|
1070
1232
|
|
|
1071
1233
|
<div id="footer">
|
|
1072
|
-
Generated on
|
|
1234
|
+
Generated on Tue Nov 8 15:32:23 2011 by
|
|
1073
1235
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
1074
|
-
0.7.
|
|
1236
|
+
0.7.3 (ruby-1.9.3).
|
|
1075
1237
|
</div>
|
|
1076
1238
|
|
|
1077
1239
|
</body>
|