box-api 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/Gemfile.lock +1 -1
  2. data/box-api.gemspec +1 -1
  3. data/doc/Box.html +5 -5
  4. data/doc/Box/Account.html +430 -188
  5. data/doc/Box/Api.html +731 -428
  6. data/doc/Box/Api/AccountExceeded.html +3 -3
  7. data/doc/Box/Api/EmailInvalid.html +6 -6
  8. data/doc/Box/Api/EmailTaken.html +3 -3
  9. data/doc/Box/Api/ErrorStatus.html +3 -3
  10. data/doc/Box/Api/Exception.html +3 -3
  11. data/doc/Box/Api/Generic.html +3 -3
  12. data/doc/Box/Api/InvalidFolder.html +6 -6
  13. data/doc/Box/Api/InvalidInput.html +3 -3
  14. data/doc/Box/Api/InvalidName.html +3 -3
  15. data/doc/Box/Api/NameTaken.html +3 -3
  16. data/doc/Box/Api/NoAccess.html +3 -3
  17. data/doc/Box/Api/NoParent.html +3 -3
  18. data/doc/Box/Api/NotAuthorized.html +3 -3
  19. data/doc/Box/Api/Restricted.html +6 -6
  20. data/doc/Box/Api/SizeExceeded.html +3 -3
  21. data/doc/Box/Api/Unknown.html +3 -3
  22. data/doc/Box/Api/UnknownResponse.html +6 -6
  23. data/doc/Box/Api/UploadFailed.html +6 -6
  24. data/doc/Box/Comment.html +560 -0
  25. data/doc/Box/File.html +318 -53
  26. data/doc/Box/Folder.html +298 -136
  27. data/doc/Box/Item.html +398 -348
  28. data/doc/_index.html +22 -7
  29. data/doc/class_list.html +1 -1
  30. data/doc/css/full_list.css +2 -0
  31. data/doc/css/style.css +2 -0
  32. data/doc/file.README.html +3 -3
  33. data/doc/frames.html +1 -1
  34. data/doc/index.html +3 -3
  35. data/doc/js/full_list.js +23 -6
  36. data/doc/method_list.html +233 -89
  37. data/doc/top-level-namespace.html +3 -3
  38. data/examples/files.rb +3 -5
  39. data/examples/login.rb +14 -18
  40. data/lib/box/account.rb +57 -16
  41. data/lib/box/api.rb +34 -1
  42. data/lib/box/api/exceptions.rb +3 -0
  43. data/lib/box/comment.rb +50 -0
  44. data/lib/box/file.rb +31 -0
  45. data/lib/box/folder.rb +57 -1
  46. data/lib/box/item.rb +20 -4
  47. data/spec/account_spec.rb +4 -0
  48. data/spec/file_spec.rb +37 -0
  49. data/spec/folder_spec.rb +78 -0
  50. data/spec/helper/account.rb +1 -1
  51. metadata +55 -61
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- box-api (0.1.9)
4
+ box-api (0.2.0)
5
5
  httmultiparty (~> 0.3.6)
6
6
 
7
7
  GEM
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "box-api"
3
- s.version = "0.1.9"
3
+ s.version = "0.2.0"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.authors = ["Box.net", "Luke Curley"]
6
6
  s.email = ["luke@box.net"]
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Module: Box
8
8
 
9
- &mdash; Documentation by YARD 0.7.2
9
+ &mdash; Documentation by YARD 0.7.3
10
10
 
11
11
  </title>
12
12
 
@@ -73,7 +73,7 @@
73
73
 
74
74
  <dt class="r1 last">Defined in:</dt>
75
75
  <dd class="r1 last">lib/box/api.rb<span class="defines">,<br />
76
- lib/box/item.rb,<br /> lib/box/file.rb,<br /> lib/box/folder.rb,<br /> lib/box/account.rb,<br /> lib/box/api/exceptions.rb</span>
76
+ lib/box/item.rb,<br /> lib/box/file.rb,<br /> lib/box/folder.rb,<br /> lib/box/comment.rb,<br /> lib/box/account.rb,<br /> lib/box/api/exceptions.rb</span>
77
77
  </dd>
78
78
 
79
79
  </dl>
@@ -85,7 +85,7 @@
85
85
 
86
86
 
87
87
 
88
- <strong class="classes">Classes:</strong> <span class='object_link'><a href="Box/Account.html" title="Box::Account (class)">Account</a></span>, <span class='object_link'><a href="Box/Api.html" title="Box::Api (class)">Api</a></span>, <span class='object_link'><a href="Box/File.html" title="Box::File (class)">File</a></span>, <span class='object_link'><a href="Box/Folder.html" title="Box::Folder (class)">Folder</a></span>, <span class='object_link'><a href="Box/Item.html" title="Box::Item (class)">Item</a></span>
88
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Box/Account.html" title="Box::Account (class)">Account</a></span>, <span class='object_link'><a href="Box/Api.html" title="Box::Api (class)">Api</a></span>, <span class='object_link'><a href="Box/Comment.html" title="Box::Comment (class)">Comment</a></span>, <span class='object_link'><a href="Box/File.html" title="Box::File (class)">File</a></span>, <span class='object_link'><a href="Box/Folder.html" title="Box::Folder (class)">Folder</a></span>, <span class='object_link'><a href="Box/Item.html" title="Box::Item (class)">Item</a></span>
89
89
 
90
90
 
91
91
  </p>
@@ -99,9 +99,9 @@
99
99
  </div>
100
100
 
101
101
  <div id="footer">
102
- Generated on Mon Aug 8 13:05:22 2011 by
102
+ Generated on Tue Nov 8 15:32:23 2011 by
103
103
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
104
- 0.7.2 (ruby-1.9.2).
104
+ 0.7.3 (ruby-1.9.3).
105
105
  </div>
106
106
 
107
107
  </body>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Class: Box::Account
8
8
 
9
- &mdash; Documentation by YARD 0.7.2
9
+ &mdash; Documentation by YARD 0.7.3
10
10
 
11
11
  </title>
12
12
 
@@ -94,18 +94,18 @@
94
94
 
95
95
  <h2>Overview</h2><div class="docstring">
96
96
  <div class="discussion">
97
- <p>
98
- Represents an account on Box. In order to use the Box api, the user must
97
+
98
+ <p>Represents an account on Box. In order to use the Box api, the user must
99
99
  first grant the application permission to use their account. This is done
100
100
  in the <span class='object_link'><a href="#authorize-instance_method" title="Box::Account#authorize (method)">#authorize</a></span> function. Once an account has been authorized, it can
101
- access all of the details and information stored on that account.
102
- </p>
101
+ access all of the details and information stored on that account.</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
  <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
@@ -130,9 +130,8 @@ access all of the details and information stored on that account.
130
130
 
131
131
 
132
132
 
133
- <span class="summary_desc"><div class='inline'><p>
134
- The auth token if authorization was successful.
135
- </p>
133
+ <span class="summary_desc"><div class='inline'>
134
+ <p>The auth token if authorization was successful.</p>
136
135
  </div></span>
137
136
 
138
137
  </li>
@@ -154,7 +153,7 @@ The auth token if authorization was successful.
154
153
  <li class="public ">
155
154
  <span class="summary_signature">
156
155
 
157
- <a href="#authorize-instance_method" title="#authorize (instance method)">- (Boolean) <strong>authorize</strong>(auth_token = nil) {|authorize_url| ... }</a>
156
+ <a href="#authorize-instance_method" title="#authorize (instance method)">- (Boolean) <strong>authorize</strong>(details = nil) {|authorize_url| ... }</a>
158
157
 
159
158
 
160
159
 
@@ -167,10 +166,9 @@ The auth token if authorization was successful.
167
166
 
168
167
 
169
168
 
170
- <span class="summary_desc"><div class='inline'><p>
171
- Authorize the account using the given auth token, or request permission
172
- from the user to let this application use their account.
173
- </p>
169
+ <span class="summary_desc"><div class='inline'>
170
+ <p>Authorize the account using the given auth token/ticket, or request
171
+ permission from the user to let this application use their account.</p>
174
172
  </div></span>
175
173
 
176
174
  </li>
@@ -192,9 +190,8 @@ from the user to let this application use their account.
192
190
 
193
191
 
194
192
 
195
- <span class="summary_desc"><div class='inline'><p>
196
- Is the account authorized?.
197
- </p>
193
+ <span class="summary_desc"><div class='inline'>
194
+ <p>Is the account authorized?.</p>
198
195
  </div></span>
199
196
 
200
197
  </li>
@@ -216,9 +213,8 @@ Is the account authorized?.
216
213
 
217
214
 
218
215
 
219
- <span class="summary_desc"><div class='inline'><p>
220
- Return the account details.
221
- </p>
216
+ <span class="summary_desc"><div class='inline'>
217
+ <p>Return the account details.</p>
222
218
  </div></span>
223
219
 
224
220
  </li>
@@ -242,9 +238,8 @@ Return the account details.
242
238
 
243
239
 
244
240
 
245
- <span class="summary_desc"><div class='inline'><p>
246
- Creates an account object using the given Box api key.
247
- </p>
241
+ <span class="summary_desc"><div class='inline'>
242
+ <p>Creates an account object using the given Box api key.</p>
248
243
  </div></span>
249
244
 
250
245
  </li>
@@ -266,9 +261,31 @@ Creates an account object using the given Box api key.
266
261
 
267
262
 
268
263
 
269
- <span class="summary_desc"><div class='inline'><p>
270
- Log out of the account and invalidate the auth token.
271
- </p>
264
+ <span class="summary_desc"><div class='inline'>
265
+ <p>Log out of the account and invalidate the auth token.</p>
266
+ </div></span>
267
+
268
+ </li>
269
+
270
+
271
+ <li class="public ">
272
+ <span class="summary_signature">
273
+
274
+ <a href="#method_missing-instance_method" title="#method_missing (instance method)">- (Object) <strong>method_missing</strong>(sym, *args, &amp;block) </a>
275
+
276
+
277
+
278
+ </span>
279
+
280
+
281
+
282
+
283
+
284
+
285
+
286
+
287
+ <span class="summary_desc"><div class='inline'>
288
+ <p>Provides an easy way to access this account's info.</p>
272
289
  </div></span>
273
290
 
274
291
  </li>
@@ -290,11 +307,31 @@ Log out of the account and invalidate the auth token.
290
307
 
291
308
 
292
309
 
293
- <span class="summary_desc"><div class='inline'><p>
294
- Register a new account on the Box website with the given details.
295
- </p>
310
+ <span class="summary_desc"><div class='inline'>
311
+ <p>Register a new account on the Box website with the given details.</p>
296
312
  </div></span>
297
313
 
314
+ </li>
315
+
316
+
317
+ <li class="public ">
318
+ <span class="summary_signature">
319
+
320
+ <a href="#respond_to%3F-instance_method" title="#respond_to? (instance method)">- (Boolean) <strong>respond_to?</strong>(sym) </a>
321
+
322
+
323
+
324
+ </span>
325
+
326
+
327
+
328
+
329
+
330
+
331
+
332
+
333
+ <span class="summary_desc"><div class='inline'></div></span>
334
+
298
335
  </li>
299
336
 
300
337
 
@@ -314,9 +351,31 @@ Register a new account on the Box website with the given details.
314
351
 
315
352
 
316
353
 
317
- <span class="summary_desc"><div class='inline'><p>
318
- Get the root folder of the account.
319
- </p>
354
+ <span class="summary_desc"><div class='inline'>
355
+ <p>Get the root folder of the account.</p>
356
+ </div></span>
357
+
358
+ </li>
359
+
360
+
361
+ <li class="public ">
362
+ <span class="summary_signature">
363
+
364
+ <a href="#ticket-instance_method" title="#ticket (instance method)">- (String) <strong>ticket</strong> </a>
365
+
366
+
367
+
368
+ </span>
369
+
370
+
371
+
372
+
373
+
374
+
375
+
376
+
377
+ <span class="summary_desc"><div class='inline'>
378
+ <p>Get the cached ticket or request a new one from the Box api.</p>
320
379
  </div></span>
321
380
 
322
381
  </li>
@@ -337,10 +396,9 @@ Get the root folder of the account.
337
396
 
338
397
  </p><div class="docstring">
339
398
  <div class="discussion">
340
- <p>
341
- Creates an account object using the given Box api key. You can then
342
- <span class='object_link'><a href="#register-instance_method" title="Box::Account#register (method)">#register</a></span> a new account or <span class='object_link'><a href="#authorize-instance_method" title="Box::Account#authorize (method)">#authorize</a></span> an existing account.
343
- </p>
399
+
400
+ <p>Creates an account object using the given Box api key. You can then
401
+ <span class='object_link'><a href="#register-instance_method" title="Box::Account#register (method)">#register</a></span> a new account or <span class='object_link'><a href="#authorize-instance_method" title="Box::Account#authorize (method)">#authorize</a></span> an existing account.</p>
344
402
 
345
403
 
346
404
  </div>
@@ -359,15 +417,15 @@ Creates an account object using the given Box api key. You can then
359
417
 
360
418
 
361
419
  &mdash;
362
- <div class='inline'><p>
363
- the api key to use for the Box api.
364
- </p>
420
+ <div class='inline'>
421
+ <p>the api key to use for the Box api.</p>
365
422
  </div>
366
423
 
367
424
  </li>
368
425
 
369
426
  </ul>
370
427
 
428
+
371
429
  </div><table class="source_code">
372
430
  <tr>
373
431
  <td>
@@ -395,6 +453,75 @@ the api key to use for the Box api.
395
453
  </table>
396
454
  </div>
397
455
 
456
+ </div>
457
+ <div id="method_missing_details" class="method_details_list">
458
+ <h2>Dynamic Method Handling</h2>
459
+ <p class="notice this">
460
+ This class handles dynamic methods through the <tt>method_missing</tt> method
461
+
462
+ </p>
463
+
464
+ <div class="method_details first">
465
+ <p class="signature first" id="method_missing-instance_method">
466
+
467
+ - (<tt>Object</tt>) <strong>method_missing</strong>(sym, *args, &amp;block)
468
+
469
+
470
+
471
+ </p><div class="docstring">
472
+ <div class="discussion">
473
+
474
+ <p>Provides an easy way to access this account's info.</p>
475
+
476
+
477
+ </div>
478
+ </div>
479
+ <div class="tags">
480
+
481
+ <div class="examples">
482
+ <h3>Examples:</h3>
483
+
484
+ <h4><div class='inline'></div></h4>
485
+ <pre class="example code"><span class='id account'>account</span><span class='period'>.</span><span class='id login'>login</span> <span class='comment'># returns @info['login']</span></pre>
486
+
487
+ </div>
488
+
489
+
490
+ </div><table class="source_code">
491
+ <tr>
492
+ <td>
493
+ <pre class="lines">
494
+
495
+
496
+ 184
497
+ 185
498
+ 186
499
+ 187
500
+ 188
501
+ 189
502
+ 190
503
+ 191
504
+ 192
505
+ 193</pre>
506
+ </td>
507
+ <td>
508
+ <pre class="code"><span class="info file"># File 'lib/box/account.rb', line 184</span>
509
+
510
+ <span class='kw'>def</span> <span class='id method_missing'>method_missing</span><span class='lparen'>(</span><span class='id sym'>sym</span><span class='comma'>,</span> <span class='op'>*</span><span class='id args'>args</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id block'>block</span><span class='rparen'>)</span>
511
+ <span class='kw'>super</span> <span class='kw'>unless</span> <span class='id authorized?'>authorized?</span>
512
+
513
+ <span class='comment'># TODO: Use symbols instead of strings
514
+ </span> <span class='id str'>str</span> <span class='op'>=</span> <span class='id sym'>sym</span><span class='period'>.</span><span class='id to_s'>to_s</span>
515
+
516
+ <span class='kw'>return</span> <span class='ivar'>@info</span><span class='lbracket'>[</span><span class='id str'>str</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='ivar'>@info</span><span class='period'>.</span><span class='id key?'>key?</span><span class='lparen'>(</span><span class='id str'>str</span><span class='rparen'>)</span>
517
+
518
+ <span class='kw'>super</span>
519
+ <span class='kw'>end</span></pre>
520
+ </td>
521
+ </tr>
522
+ </table>
523
+ </div>
524
+
398
525
  </div>
399
526
 
400
527
  <div id="instance_attr_details" class="attr_details">
@@ -412,15 +539,15 @@ the api key to use for the Box api.
412
539
 
413
540
  </p><div class="docstring">
414
541
  <div class="discussion">
415
- <p>
416
- The auth token if authorization was successful.
417
- </p>
542
+
543
+ <p>The auth token if authorization was successful.</p>
418
544
 
419
545
 
420
546
  </div>
421
547
  </div>
422
548
  <div class="tags">
423
- <h3>Returns:</h3>
549
+
550
+ <h3>Returns:</h3>
424
551
  <ul class="return">
425
552
 
426
553
  <li>
@@ -431,9 +558,8 @@ The auth token if authorization was successful.
431
558
 
432
559
 
433
560
  &mdash;
434
- <div class='inline'><p>
435
- The auth token if authorization was successful.
436
- </p>
561
+ <div class='inline'>
562
+ <p>The auth token if authorization was successful.</p>
437
563
  </div>
438
564
 
439
565
  </li>
@@ -471,22 +597,27 @@ The auth token if authorization was successful.
471
597
  <div class="method_details first">
472
598
  <p class="signature first" id="authorize-instance_method">
473
599
 
474
- - (<tt>Boolean</tt>) <strong>authorize</strong>(auth_token = nil) {|authorize_url| ... }
600
+ - (<tt>Boolean</tt>) <strong>authorize</strong>(details = nil) {|authorize_url| ... }
475
601
 
476
602
 
477
603
 
478
604
  </p><div class="docstring">
479
605
  <div class="discussion">
480
- <p>
481
- Authorize the account using the given auth token, or request permission
482
- from the user to let this application use their account.
483
- </p>
484
- <p>
485
- An auth token can be reused from previous authorizations provided the user
486
- doesn&#8217;t log out, and significantly speeds up the process. If the auth
487
- token if invalid or not provided, the account tries to log in normally and
488
- requires the user to log in and provide access for their account.
489
- </p>
606
+
607
+ <p>Authorize the account using the given auth token/ticket, or request
608
+ permission from the user to let this application use their account.</p>
609
+
610
+ <p>An auth token can be reused from previous authorizations provided the user
611
+ doesn't log out, and significantly speeds up the process. If the auth token
612
+ if invalid or not provided, the account tries to log in normally and
613
+ requires the user to log in and provide access for their account.</p>
614
+
615
+ <p>A ticket can be used for applications that do not block on the user, such
616
+ as a website, where specifying a redirection url is not possible.</p>
617
+
618
+ <p>In order to maintain backwards compatibility, a ticket can only be
619
+ specified in the hash syntax, while an auth token can be used in either the
620
+ hash or string syntax.</p>
490
621
 
491
622
 
492
623
  </div>
@@ -496,9 +627,8 @@ requires the user to log in and provide access for their account.
496
627
  <div class="examples">
497
628
  <h3>Examples:</h3>
498
629
 
499
- <h4><div class='inline'><p>
500
- Authorize an account without a saved auth token.
501
- </p>
630
+ <h4><div class='inline'>
631
+ <p>Authorize an account without a saved auth token.</p>
502
632
  </div></h4>
503
633
  <pre class="example code"><span class='id account'>account</span><span class='period'>.</span><span class='id authorize'>authorize</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id auth_url'>auth_url</span><span class='op'>|</span>
504
634
  <span class='id puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Please visit </span><span class='embexpr_beg'>#{</span> <span class='id auth_url'>auth_url</span> <span class='rbrace'>}</span><span class='tstring_content'> and enter your account infomation</span><span class='tstring_end'>&quot;</span></span>
@@ -506,19 +636,17 @@ Authorize an account without a saved auth token.
506
636
  <span class='id gets'>gets</span> <span class='comment'># wait for the enter key to be pressed
507
637
  </span><span class='kw'>end</span></pre>
508
638
 
509
- <h4><div class='inline'><p>
510
- Authorize an account using an existing auth token.
511
- </p>
639
+ <h4><div class='inline'>
640
+ <p>Authorize an account using an existing auth token.</p>
512
641
  </div></h4>
513
642
  <pre class="example code"><span class='id auth_token'>auth_token</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>saved auth token</span><span class='tstring_end'>&quot;</span></span> <span class='comment'># load from file ideally
514
- </span><span class='id account'>account</span><span class='period'>.</span><span class='id authorize'>authorize</span><span class='lparen'>(</span><span class='id auth_token'>auth_token</span><span class='rparen'>)</span></pre>
643
+ </span><span class='id account'>account</span><span class='period'>.</span><span class='id authorize'>authorize</span><span class='lparen'>(</span><span class='symbol'>:auth_token</span> <span class='op'>=&gt;</span> <span class='id auth_token'>auth_token</span><span class='rparen'>)</span></pre>
515
644
 
516
- <h4><div class='inline'><p>
517
- Combining the above two for the best functionality.
518
- </p>
645
+ <h4><div class='inline'>
646
+ <p>Combining the above two for the best functionality.</p>
519
647
  </div></h4>
520
648
  <pre class="example code"><span class='id auth_token'>auth_token</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>saved auth token</span><span class='tstring_end'>&quot;</span></span> <span class='comment'># load from file if possible
521
- </span><span class='id account'>account</span><span class='period'>.</span><span class='id authorize'>authorize</span><span class='lparen'>(</span><span class='id auth_token'>auth_token</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id auth_url'>auth_url</span><span class='op'>|</span>
649
+ </span><span class='id account'>account</span><span class='period'>.</span><span class='id authorize'>authorize</span><span class='lparen'>(</span><span class='symbol'>:auth_token</span> <span class='op'>=&gt;</span> <span class='id auth_token'>auth_token</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id auth_url'>auth_url</span><span class='op'>|</span>
522
650
  <span class='comment'># auth token was invalid or nil, have the user visit auth_url
523
651
  </span><span class='kw'>end</span></pre>
524
652
 
@@ -528,24 +656,27 @@ Combining the above two for the best functionality.
528
656
 
529
657
  <li>
530
658
 
531
- <span class='name'>auth_token</span>
659
+ <span class='name'>details</span>
532
660
 
533
661
 
534
- <span class='type'>(<tt>Optional</tt>, <tt>String</tt>)</span>
662
+ <span class='type'>(<tt>Optional</tt>, <tt>String</tt>, <tt>Hash{:ticket,:auth_token =&gt; String}</tt>)</span>
535
663
 
536
664
 
537
665
  <em class="default">(defaults to: <tt>nil</tt>)</em>
538
666
 
539
667
 
540
668
  &mdash;
541
- <div class='inline'><p>
542
- Uses an existing token or requests a new one if nil.
543
- </p>
669
+ <div class='inline'>
670
+ <p>Uses an existing auth token or ticket. If nil, a new ticket will be
671
+ generated and used. If a String, it is assumed to be an auth_token
672
+ (depreciated). If a Hash, then any values of the :ticket and :auth_token
673
+ keys will be used to authenticate.</p>
544
674
  </div>
545
675
 
546
676
  </li>
547
677
 
548
678
  </ul>
679
+
549
680
  <h3>Yields:</h3>
550
681
  <ul class="yield">
551
682
 
@@ -557,11 +688,10 @@ Uses an existing token or requests a new one if nil.
557
688
 
558
689
 
559
690
  &mdash;
560
- <div class='inline'><p>
561
- This block called when the user has not yet granted this application
691
+ <div class='inline'>
692
+ <p>This block called when the user has not yet granted this application
562
693
  permission to use their account. You must have the user navigate to the
563
- passed url and authorize this app before continuing.
564
- </p>
694
+ passed url and authorize this app before continuing.</p>
565
695
  </div>
566
696
 
567
697
  </li>
@@ -578,9 +708,8 @@ passed url and authorize this app before continuing.
578
708
 
579
709
 
580
710
  &mdash;
581
- <div class='inline'><p>
582
- Whether the user is authorized.
583
- </p>
711
+ <div class='inline'>
712
+ <p>Whether the user is authorized.</p>
584
713
  </div>
585
714
 
586
715
  </li>
@@ -593,16 +722,6 @@ Whether the user is authorized.
593
722
  <pre class="lines">
594
723
 
595
724
 
596
- 79
597
- 80
598
- 81
599
- 82
600
- 83
601
- 84
602
- 85
603
- 86
604
- 87
605
- 88
606
725
  89
607
726
  90
608
727
  91
@@ -611,12 +730,40 @@ Whether the user is authorized.
611
730
  94
612
731
  95
613
732
  96
614
- 97</pre>
733
+ 97
734
+ 98
735
+ 99
736
+ 100
737
+ 101
738
+ 102
739
+ 103
740
+ 104
741
+ 105
742
+ 106
743
+ 107
744
+ 108
745
+ 109
746
+ 110
747
+ 111
748
+ 112
749
+ 113
750
+ 114
751
+ 115
752
+ 116</pre>
615
753
  </td>
616
754
  <td>
617
- <pre class="code"><span class="info file"># File 'lib/box/account.rb', line 79</span>
755
+ <pre class="code"><span class="info file"># File 'lib/box/account.rb', line 89</span>
756
+
757
+ <span class='kw'>def</span> <span class='id authorize'>authorize</span><span class='lparen'>(</span><span class='id details'>details</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
758
+ <span class='comment'># for backwards compatibility
759
+ </span> <span class='kw'>if</span> <span class='id details'>details</span><span class='period'>.</span><span class='id is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span>
760
+ <span class='id auth_token'>auth_token</span> <span class='op'>=</span> <span class='id details'>details</span><span class='lbracket'>[</span><span class='symbol'>:auth_token</span><span class='rbracket'>]</span>
761
+ <span class='id ticket'>ticket</span> <span class='op'>=</span> <span class='id details'>details</span><span class='lbracket'>[</span><span class='symbol'>:ticket</span><span class='rbracket'>]</span>
762
+ <span class='kw'>else</span>
763
+ <span class='id auth_token'>auth_token</span> <span class='op'>=</span> <span class='id details'>details</span>
764
+ <span class='id ticket'>ticket</span> <span class='op'>=</span> <span class='kw'>nil</span>
765
+ <span class='kw'>end</span>
618
766
 
619
- <span class='kw'>def</span> <span class='id authorize'>authorize</span><span class='lparen'>(</span><span class='id auth_token'>auth_token</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
620
767
  <span class='comment'># use a saved auth token if it is given
621
768
  </span> <span class='kw'>if</span> <span class='id auth_token'>auth_token</span>
622
769
  <span class='kw'>return</span> <span class='kw'>true</span> <span class='kw'>if</span> <span class='id authorize_token'>authorize_token</span><span class='lparen'>(</span><span class='id auth_token'>auth_token</span><span class='rparen'>)</span>
@@ -624,12 +771,12 @@ Whether the user is authorized.
624
771
 
625
772
  <span class='comment'># the auth token either failed or was not provided
626
773
  </span> <span class='comment'># we must try to authorize a ticket, and call the block if that fails
627
- </span> <span class='kw'>if</span> <span class='kw'>not</span> <span class='id authorize_ticket'>authorize_ticket</span> <span class='kw'>and</span> <span class='id block_given?'>block_given?</span>
774
+ </span> <span class='kw'>if</span> <span class='kw'>not</span> <span class='id authorize_ticket'>authorize_ticket</span><span class='lparen'>(</span><span class='id ticket'>ticket</span><span class='rparen'>)</span> <span class='kw'>and</span> <span class='id block_given?'>block_given?</span>
628
775
  <span class='comment'># the supplied block should instruct the user to visit this url
629
- </span> <span class='kw'>yield</span> <span class='id authorize_url'>authorize_url</span>
776
+ </span> <span class='kw'>yield</span> <span class='id authorize_url'>authorize_url</span><span class='lparen'>(</span><span class='id ticket'>ticket</span><span class='rparen'>)</span>
630
777
 
631
778
  <span class='comment'># try authorizing once more
632
- </span> <span class='id authorize_ticket'>authorize_ticket</span>
779
+ </span> <span class='id authorize_ticket'>authorize_ticket</span><span class='lparen'>(</span><span class='id ticket'>ticket</span><span class='rparen'>)</span>
633
780
  <span class='kw'>end</span>
634
781
 
635
782
  <span class='comment'># return our authorized status
@@ -649,15 +796,15 @@ Whether the user is authorized.
649
796
 
650
797
  </p><div class="docstring">
651
798
  <div class="discussion">
652
- <p>
653
- Is the account authorized?
654
- </p>
799
+
800
+ <p>Is the account authorized?</p>
655
801
 
656
802
 
657
803
  </div>
658
804
  </div>
659
805
  <div class="tags">
660
- <h3>Returns:</h3>
806
+
807
+ <h3>Returns:</h3>
661
808
  <ul class="return">
662
809
 
663
810
  <li>
@@ -668,9 +815,8 @@ Is the account authorized?
668
815
 
669
816
 
670
817
  &mdash;
671
- <div class='inline'><p>
672
- Is the account authorized?
673
- </p>
818
+ <div class='inline'>
819
+ <p>Is the account authorized?</p>
674
820
  </div>
675
821
 
676
822
  </li>
@@ -683,12 +829,12 @@ Is the account authorized?
683
829
  <pre class="lines">
684
830
 
685
831
 
686
- 151
687
- 152
688
- 153</pre>
832
+ 170
833
+ 171
834
+ 172</pre>
689
835
  </td>
690
836
  <td>
691
- <pre class="code"><span class="info file"># File 'lib/box/account.rb', line 151</span>
837
+ <pre class="code"><span class="info file"># File 'lib/box/account.rb', line 170</span>
692
838
 
693
839
  <span class='kw'>def</span> <span class='id authorized?'>authorized?</span>
694
840
  <span class='ivar'>@info</span> <span class='op'>!=</span> <span class='kw'>nil</span>
@@ -707,13 +853,11 @@ Is the account authorized?
707
853
 
708
854
  </p><div class="docstring">
709
855
  <div class="discussion">
710
- <p>
711
- Return the account details. A cached copy will be used if avaliable, and
712
- requested if it is not.
713
- </p>
714
- <p>
715
- TODO: Add url to Box api documentation, and provide the current fields.
716
- </p>
856
+
857
+ <p>Return the account details. A cached copy will be used if avaliable, and
858
+ requested if it is not.</p>
859
+
860
+ <p>TODO: Add url to Box api documentation, and provide the current fields.</p>
717
861
 
718
862
 
719
863
  </div>
@@ -734,14 +878,14 @@ TODO: Add url to Box api documentation, and provide the current fields.
734
878
 
735
879
 
736
880
  &mdash;
737
- <div class='inline'><p>
738
- Will not use the cached version if true.
739
- </p>
881
+ <div class='inline'>
882
+ <p>Will not use the cached version if true.</p>
740
883
  </div>
741
884
 
742
885
  </li>
743
886
 
744
887
  </ul>
888
+
745
889
  <h3>Returns:</h3>
746
890
  <ul class="return">
747
891
 
@@ -753,11 +897,10 @@ Will not use the cached version if true.
753
897
 
754
898
 
755
899
  &mdash;
756
- <div class='inline'><p>
757
- A hash containing all of the user&#8217;s account details, or nil if they
758
- are not authorized. Please see the Box api documentation for information
759
- about each field.
760
- </p>
900
+ <div class='inline'>
901
+ <p>A hash containing all of the user's account details, or nil if they are not
902
+ authorized. Please see the Box api documentation for information about each
903
+ field.</p>
761
904
  </div>
762
905
 
763
906
  </li>
@@ -770,20 +913,20 @@ about each field.
770
913
  <pre class="lines">
771
914
 
772
915
 
773
- 127
774
- 128
775
- 129
776
- 130
777
- 131
778
- 132
779
- 133
780
- 134
781
- 135
782
- 136
783
- 137</pre>
916
+ 146
917
+ 147
918
+ 148
919
+ 149
920
+ 150
921
+ 151
922
+ 152
923
+ 153
924
+ 154
925
+ 155
926
+ 156</pre>
784
927
  </td>
785
928
  <td>
786
- <pre class="code"><span class="info file"># File 'lib/box/account.rb', line 127</span>
929
+ <pre class="code"><span class="info file"># File 'lib/box/account.rb', line 146</span>
787
930
 
788
931
  <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>
789
932
  <span class='kw'>return</span> <span class='ivar'>@info</span> <span class='kw'>if</span> <span class='ivar'>@info</span> <span class='kw'>and</span> <span class='kw'>not</span> <span class='id refresh'>refresh</span>
@@ -813,22 +956,21 @@ about each field.
813
956
 
814
957
  <div class="note notetag">
815
958
  <strong>Note:</strong>
816
- <div class='inline'><p>
817
- The user will have to re-authorize if they wish to use this application,
818
- and the auth token will no longer work.
819
- </p>
959
+ <div class='inline'>
960
+ <p>The user will have to re-authorize if they wish to use this application,
961
+ and the auth token will no longer work.</p>
820
962
  </div>
821
963
  </div>
822
964
 
823
- <p>
824
- Log out of the account and invalidate the auth token.
825
- </p>
965
+
966
+ <p>Log out of the account and invalidate the auth token.</p>
826
967
 
827
968
 
828
969
  </div>
829
970
  </div>
830
971
  <div class="tags">
831
- <h3>Returns:</h3>
972
+
973
+ <h3>Returns:</h3>
832
974
  <ul class="return">
833
975
 
834
976
  <li>
@@ -839,9 +981,8 @@ Log out of the account and invalidate the auth token.
839
981
 
840
982
 
841
983
  &mdash;
842
- <div class='inline'><p>
843
- Whether logout was successful.
844
- </p>
984
+ <div class='inline'>
985
+ <p>Whether logout was successful.</p>
845
986
  </div>
846
987
 
847
988
  </li>
@@ -854,19 +995,19 @@ Whether logout was successful.
854
995
  <pre class="lines">
855
996
 
856
997
 
857
- 106
858
- 107
859
- 108
860
- 109
861
- 110
862
- 111
863
- 112
864
- 113
865
- 114
866
- 115</pre>
998
+ 125
999
+ 126
1000
+ 127
1001
+ 128
1002
+ 129
1003
+ 130
1004
+ 131
1005
+ 132
1006
+ 133
1007
+ 134</pre>
867
1008
  </td>
868
1009
  <td>
869
- <pre class="code"><span class="info file"># File 'lib/box/account.rb', line 106</span>
1010
+ <pre class="code"><span class="info file"># File 'lib/box/account.rb', line 125</span>
870
1011
 
871
1012
  <span class='kw'>def</span> <span class='id logout'>logout</span>
872
1013
  <span class='kw'>begin</span>
@@ -892,9 +1033,8 @@ Whether logout was successful.
892
1033
 
893
1034
  </p><div class="docstring">
894
1035
  <div class="discussion">
895
- <p>
896
- Register a new account on the Box website with the given details.
897
- </p>
1036
+
1037
+ <p>Register a new account on the Box website with the given details.</p>
898
1038
 
899
1039
 
900
1040
  </div>
@@ -913,9 +1053,8 @@ Register a new account on the Box website with the given details.
913
1053
 
914
1054
 
915
1055
  &mdash;
916
- <div class='inline'><p>
917
- The email address to create the account with
918
- </p>
1056
+ <div class='inline'>
1057
+ <p>The email address to create the account with</p>
919
1058
  </div>
920
1059
 
921
1060
  </li>
@@ -930,14 +1069,14 @@ The email address to create the account with
930
1069
 
931
1070
 
932
1071
  &mdash;
933
- <div class='inline'><p>
934
- The password to create the account with
935
- </p>
1072
+ <div class='inline'>
1073
+ <p>The password to create the account with</p>
936
1074
  </div>
937
1075
 
938
1076
  </li>
939
1077
 
940
1078
  </ul>
1079
+
941
1080
  <h3>Returns:</h3>
942
1081
  <ul class="return">
943
1082
 
@@ -949,9 +1088,8 @@ The password to create the account with
949
1088
 
950
1089
 
951
1090
  &mdash;
952
- <div class='inline'><p>
953
- Whether registration was successful.
954
- </p>
1091
+ <div class='inline'>
1092
+ <p>Whether registration was successful.</p>
955
1093
  </div>
956
1094
 
957
1095
  </li>
@@ -968,9 +1106,8 @@ Whether registration was successful.
968
1106
 
969
1107
 
970
1108
  &mdash;
971
- <div class='inline'><p>
972
- The email address was invalid
973
- </p>
1109
+ <div class='inline'>
1110
+ <p>The email address was invalid</p>
974
1111
  </div>
975
1112
 
976
1113
  </li>
@@ -983,9 +1120,8 @@ The email address was invalid
983
1120
 
984
1121
 
985
1122
  &mdash;
986
- <div class='inline'><p>
987
- The email address was taken
988
- </p>
1123
+ <div class='inline'>
1124
+ <p>The email address was taken</p>
989
1125
  </div>
990
1126
 
991
1127
  </li>
@@ -1021,6 +1157,56 @@ The email address was taken
1021
1157
  </td>
1022
1158
  </tr>
1023
1159
  </table>
1160
+ </div>
1161
+
1162
+ <div class="method_details ">
1163
+ <p class="signature " id="respond_to?-instance_method">
1164
+
1165
+ - (<tt>Boolean</tt>) <strong>respond_to?</strong>(sym)
1166
+
1167
+
1168
+
1169
+ </p><div class="docstring">
1170
+ <div class="discussion">
1171
+
1172
+
1173
+ </div>
1174
+ </div>
1175
+ <div class="tags">
1176
+
1177
+ <h3>Returns:</h3>
1178
+ <ul class="return">
1179
+
1180
+ <li>
1181
+
1182
+
1183
+ <span class='type'>(<tt>Boolean</tt>)</span>
1184
+
1185
+
1186
+
1187
+ </li>
1188
+
1189
+ </ul>
1190
+
1191
+ </div><table class="source_code">
1192
+ <tr>
1193
+ <td>
1194
+ <pre class="lines">
1195
+
1196
+
1197
+ 195
1198
+ 196
1199
+ 197</pre>
1200
+ </td>
1201
+ <td>
1202
+ <pre class="code"><span class="info file"># File 'lib/box/account.rb', line 195</span>
1203
+
1204
+ <span class='kw'>def</span> <span class='id respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id sym'>sym</span><span class='rparen'>)</span>
1205
+ <span class='ivar'>@info</span><span class='period'>.</span><span class='id key?'>key?</span><span class='lparen'>(</span><span class='id sym'>sym</span><span class='period'>.</span><span class='id to_s'>to_s</span><span class='rparen'>)</span> <span class='kw'>or</span> <span class='kw'>super</span>
1206
+ <span class='kw'>end</span></pre>
1207
+ </td>
1208
+ </tr>
1209
+ </table>
1024
1210
  </div>
1025
1211
 
1026
1212
  <div class="method_details ">
@@ -1032,17 +1218,17 @@ The email address was taken
1032
1218
 
1033
1219
  </p><div class="docstring">
1034
1220
  <div class="discussion">
1035
- <p>
1036
- Get the root folder of the account. You can use this <span class='object_link'><a href="Folder.html" title="Box::Folder (class)">Folder</a></span> object to
1221
+
1222
+ <p>Get the root folder of the account. You can use this <span class='object_link'><a href="Folder.html" title="Box::Folder (class)">Folder</a></span> object to
1037
1223
  access all sub items within the account. This folder is lazy loaded, and a
1038
- network request will be made if/when the data is requested.
1039
- </p>
1224
+ network request will be made if/when the data is requested.</p>
1040
1225
 
1041
1226
 
1042
1227
  </div>
1043
1228
  </div>
1044
1229
  <div class="tags">
1045
- <h3>Returns:</h3>
1230
+
1231
+ <h3>Returns:</h3>
1046
1232
  <ul class="return">
1047
1233
 
1048
1234
  <li>
@@ -1053,9 +1239,8 @@ network request will be made if/when the data is requested.
1053
1239
 
1054
1240
 
1055
1241
  &mdash;
1056
- <div class='inline'><p>
1057
- A folder object representing the root folder.
1058
- </p>
1242
+ <div class='inline'>
1243
+ <p>A folder object representing the root folder.</p>
1059
1244
  </div>
1060
1245
 
1061
1246
  </li>
@@ -1068,13 +1253,13 @@ A folder object representing the root folder.
1068
1253
  <pre class="lines">
1069
1254
 
1070
1255
 
1071
- 145
1072
- 146
1073
- 147
1074
- 148</pre>
1256
+ 164
1257
+ 165
1258
+ 166
1259
+ 167</pre>
1075
1260
  </td>
1076
1261
  <td>
1077
- <pre class="code"><span class="info file"># File 'lib/box/account.rb', line 145</span>
1262
+ <pre class="code"><span class="info file"># File 'lib/box/account.rb', line 164</span>
1078
1263
 
1079
1264
  <span class='kw'>def</span> <span class='id root'>root</span>
1080
1265
  <span class='kw'>return</span> <span class='ivar'>@root</span> <span class='kw'>if</span> <span class='ivar'>@root</span>
@@ -1083,6 +1268,63 @@ A folder object representing the root folder.
1083
1268
  </td>
1084
1269
  </tr>
1085
1270
  </table>
1271
+ </div>
1272
+
1273
+ <div class="method_details ">
1274
+ <p class="signature " id="ticket-instance_method">
1275
+
1276
+ - (<tt>String</tt>) <strong>ticket</strong>
1277
+
1278
+
1279
+
1280
+ </p><div class="docstring">
1281
+ <div class="discussion">
1282
+
1283
+ <p>Get the cached ticket or request a new one from the Box api.</p>
1284
+
1285
+
1286
+ </div>
1287
+ </div>
1288
+ <div class="tags">
1289
+
1290
+ <h3>Returns:</h3>
1291
+ <ul class="return">
1292
+
1293
+ <li>
1294
+
1295
+
1296
+ <span class='type'>(<tt>String</tt>)</span>
1297
+
1298
+
1299
+
1300
+ &mdash;
1301
+ <div class='inline'>
1302
+ <p>The authorization ticket.</p>
1303
+ </div>
1304
+
1305
+ </li>
1306
+
1307
+ </ul>
1308
+
1309
+ </div><table class="source_code">
1310
+ <tr>
1311
+ <td>
1312
+ <pre class="lines">
1313
+
1314
+
1315
+ 176
1316
+ 177
1317
+ 178</pre>
1318
+ </td>
1319
+ <td>
1320
+ <pre class="code"><span class="info file"># File 'lib/box/account.rb', line 176</span>
1321
+
1322
+ <span class='kw'>def</span> <span class='id ticket'>ticket</span>
1323
+ <span class='ivar'>@ticket</span> <span class='op'>||=</span> <span class='ivar'>@api</span><span class='period'>.</span><span class='id get_ticket'>get_ticket</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>ticket</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
1324
+ <span class='kw'>end</span></pre>
1325
+ </td>
1326
+ </tr>
1327
+ </table>
1086
1328
  </div>
1087
1329
 
1088
1330
  </div>
@@ -1090,9 +1332,9 @@ A folder object representing the root folder.
1090
1332
  </div>
1091
1333
 
1092
1334
  <div id="footer">
1093
- Generated on Mon Aug 8 13:05:22 2011 by
1335
+ Generated on Tue Nov 8 15:32:23 2011 by
1094
1336
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1095
- 0.7.2 (ruby-1.9.2).
1337
+ 0.7.3 (ruby-1.9.3).
1096
1338
  </div>
1097
1339
 
1098
1340
  </body>