box-api 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/box-api.gemspec +1 -1
- data/doc/Box.html +108 -0
- data/doc/Box/Account.html +1099 -0
- data/doc/Box/Api.html +3428 -0
- data/doc/Box/Api/AccountExceeded.html +130 -0
- data/doc/Box/Api/EmailInvalid.html +141 -0
- data/doc/Box/Api/EmailTaken.html +130 -0
- data/doc/Box/Api/ErrorStatus.html +130 -0
- data/doc/Box/Api/Exception.html +120 -0
- data/doc/Box/Api/Generic.html +130 -0
- data/doc/Box/Api/InvalidFolder.html +141 -0
- data/doc/Box/Api/InvalidInput.html +130 -0
- data/doc/Box/Api/InvalidName.html +130 -0
- data/doc/Box/Api/NameTaken.html +130 -0
- data/doc/Box/Api/NoAccess.html +130 -0
- data/doc/Box/Api/NoParent.html +130 -0
- data/doc/Box/Api/NotAuthorized.html +130 -0
- data/doc/Box/Api/Restricted.html +141 -0
- data/doc/Box/Api/SizeExceeded.html +130 -0
- data/doc/Box/Api/Unknown.html +130 -0
- data/doc/Box/Api/UnknownResponse.html +141 -0
- data/doc/Box/Api/UploadFailed.html +141 -0
- data/doc/Box/File.html +580 -0
- data/doc/Box/Folder.html +1078 -0
- data/doc/Box/Item.html +1884 -0
- data/doc/_index.html +342 -0
- data/doc/class_list.html +47 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +53 -0
- data/doc/css/style.css +320 -0
- data/doc/file.README.html +98 -0
- data/doc/file_list.html +49 -0
- data/doc/frames.html +13 -0
- data/doc/index.html +98 -0
- data/doc/js/app.js +205 -0
- data/doc/js/full_list.js +150 -0
- data/doc/js/jquery.js +16 -0
- data/doc/method_list.html +574 -0
- data/doc/top-level-namespace.html +103 -0
- data/examples/login.rb +4 -4
- data/lib/box/account.rb +168 -51
- data/lib/box/api.rb +174 -16
- data/lib/box/api/exceptions.rb +4 -0
- data/lib/box/file.rb +17 -4
- data/lib/box/folder.rb +85 -30
- data/lib/box/item.rb +89 -20
- data/spec/account_spec.rb +0 -4
- data/spec/folder_spec.rb +3 -9
- metadata +42 -4
data/Gemfile.lock
CHANGED
data/box-api.gemspec
CHANGED
data/doc/Box.html
ADDED
@@ -0,0 +1,108 @@
|
|
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
|
+
Module: Box
|
8
|
+
|
9
|
+
— Documentation by YARD 0.7.2
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
relpath = '';
|
19
|
+
if (relpath != '') relpath += '/';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
25
|
+
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<div id="header">
|
34
|
+
<div id="menu">
|
35
|
+
|
36
|
+
<a href="_index.html">Index (B)</a> »
|
37
|
+
|
38
|
+
|
39
|
+
<span class="title">Box</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>Module: Box
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
<dt class="r1 last">Defined in:</dt>
|
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>
|
77
|
+
</dd>
|
78
|
+
|
79
|
+
</dl>
|
80
|
+
<div class="clear"></div>
|
81
|
+
|
82
|
+
<h2>Defined Under Namespace</h2>
|
83
|
+
<p class="children">
|
84
|
+
|
85
|
+
|
86
|
+
|
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>
|
89
|
+
|
90
|
+
|
91
|
+
</p>
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
</div>
|
100
|
+
|
101
|
+
<div id="footer">
|
102
|
+
Generated on Mon Aug 8 13:05:22 2011 by
|
103
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
104
|
+
0.7.2 (ruby-1.9.2).
|
105
|
+
</div>
|
106
|
+
|
107
|
+
</body>
|
108
|
+
</html>
|
@@ -0,0 +1,1099 @@
|
|
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::Account
|
8
|
+
|
9
|
+
— Documentation by YARD 0.7.2
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
relpath = '..';
|
19
|
+
if (relpath != '') relpath += '/';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
25
|
+
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<div id="header">
|
34
|
+
<div id="menu">
|
35
|
+
|
36
|
+
<a href="../_index.html">Index (A)</a> »
|
37
|
+
<span class='title'><span class='object_link'><a href="../Box.html" title="Box (module)">Box</a></span></span>
|
38
|
+
»
|
39
|
+
<span class="title">Account</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::Account
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
<dt class="r1">Inherits:</dt>
|
68
|
+
<dd class="r1">
|
69
|
+
<span class="inheritName">Object</span>
|
70
|
+
|
71
|
+
<ul class="fullTree">
|
72
|
+
<li>Object</li>
|
73
|
+
|
74
|
+
<li class="next">Box::Account</li>
|
75
|
+
|
76
|
+
</ul>
|
77
|
+
<a href="#" class="inheritanceTree">show all</a>
|
78
|
+
|
79
|
+
</dd>
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
<dt class="r2 last">Defined in:</dt>
|
90
|
+
<dd class="r2 last">lib/box/account.rb</dd>
|
91
|
+
|
92
|
+
</dl>
|
93
|
+
<div class="clear"></div>
|
94
|
+
|
95
|
+
<h2>Overview</h2><div class="docstring">
|
96
|
+
<div class="discussion">
|
97
|
+
<p>
|
98
|
+
Represents an account on Box. In order to use the Box api, the user must
|
99
|
+
first grant the application permission to use their account. This is done
|
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>
|
103
|
+
|
104
|
+
|
105
|
+
</div>
|
106
|
+
</div>
|
107
|
+
<div class="tags">
|
108
|
+
|
109
|
+
</div>
|
110
|
+
|
111
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
112
|
+
<ul class="summary">
|
113
|
+
|
114
|
+
<li class="public ">
|
115
|
+
<span class="summary_signature">
|
116
|
+
|
117
|
+
<a href="#auth_token-instance_method" title="#auth_token (instance method)">- (String) <strong>auth_token</strong> </a>
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
</span>
|
122
|
+
|
123
|
+
|
124
|
+
<span class="note title readonly">readonly</span>
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<span class="summary_desc"><div class='inline'><p>
|
134
|
+
The auth token if authorization was successful.
|
135
|
+
</p>
|
136
|
+
</div></span>
|
137
|
+
|
138
|
+
</li>
|
139
|
+
|
140
|
+
|
141
|
+
</ul>
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
<h2>
|
148
|
+
Instance Method Summary
|
149
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
150
|
+
</h2>
|
151
|
+
|
152
|
+
<ul class="summary">
|
153
|
+
|
154
|
+
<li class="public ">
|
155
|
+
<span class="summary_signature">
|
156
|
+
|
157
|
+
<a href="#authorize-instance_method" title="#authorize (instance method)">- (Boolean) <strong>authorize</strong>(auth_token = nil) {|authorize_url| ... }</a>
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
</span>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
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>
|
174
|
+
</div></span>
|
175
|
+
|
176
|
+
</li>
|
177
|
+
|
178
|
+
|
179
|
+
<li class="public ">
|
180
|
+
<span class="summary_signature">
|
181
|
+
|
182
|
+
<a href="#authorized%3F-instance_method" title="#authorized? (instance method)">- (Boolean) <strong>authorized?</strong> </a>
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
</span>
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
<span class="summary_desc"><div class='inline'><p>
|
196
|
+
Is the account authorized?.
|
197
|
+
</p>
|
198
|
+
</div></span>
|
199
|
+
|
200
|
+
</li>
|
201
|
+
|
202
|
+
|
203
|
+
<li class="public ">
|
204
|
+
<span class="summary_signature">
|
205
|
+
|
206
|
+
<a href="#info-instance_method" title="#info (instance method)">- (Hash) <strong>info</strong>(refresh = false) </a>
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
</span>
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
<span class="summary_desc"><div class='inline'><p>
|
220
|
+
Return the account details.
|
221
|
+
</p>
|
222
|
+
</div></span>
|
223
|
+
|
224
|
+
</li>
|
225
|
+
|
226
|
+
|
227
|
+
<li class="public ">
|
228
|
+
<span class="summary_signature">
|
229
|
+
|
230
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Account) <strong>initialize</strong>(api) </a>
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
</span>
|
235
|
+
|
236
|
+
<span class="note title constructor">constructor</span>
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
<span class="summary_desc"><div class='inline'><p>
|
246
|
+
Creates an account object using the given Box api key.
|
247
|
+
</p>
|
248
|
+
</div></span>
|
249
|
+
|
250
|
+
</li>
|
251
|
+
|
252
|
+
|
253
|
+
<li class="public ">
|
254
|
+
<span class="summary_signature">
|
255
|
+
|
256
|
+
<a href="#logout-instance_method" title="#logout (instance method)">- (Boolean) <strong>logout</strong> </a>
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
</span>
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
<span class="summary_desc"><div class='inline'><p>
|
270
|
+
Log out of the account and invalidate the auth token.
|
271
|
+
</p>
|
272
|
+
</div></span>
|
273
|
+
|
274
|
+
</li>
|
275
|
+
|
276
|
+
|
277
|
+
<li class="public ">
|
278
|
+
<span class="summary_signature">
|
279
|
+
|
280
|
+
<a href="#register-instance_method" title="#register (instance method)">- (Boolean) <strong>register</strong>(email, password) </a>
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
</span>
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
<span class="summary_desc"><div class='inline'><p>
|
294
|
+
Register a new account on the Box website with the given details.
|
295
|
+
</p>
|
296
|
+
</div></span>
|
297
|
+
|
298
|
+
</li>
|
299
|
+
|
300
|
+
|
301
|
+
<li class="public ">
|
302
|
+
<span class="summary_signature">
|
303
|
+
|
304
|
+
<a href="#root-instance_method" title="#root (instance method)">- (Folder) <strong>root</strong> </a>
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
</span>
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
<span class="summary_desc"><div class='inline'><p>
|
318
|
+
Get the root folder of the account.
|
319
|
+
</p>
|
320
|
+
</div></span>
|
321
|
+
|
322
|
+
</li>
|
323
|
+
|
324
|
+
|
325
|
+
</ul>
|
326
|
+
|
327
|
+
|
328
|
+
<div id="constructor_details" class="method_details_list">
|
329
|
+
<h2>Constructor Details</h2>
|
330
|
+
|
331
|
+
<div class="method_details first">
|
332
|
+
<p class="signature first" id="initialize-instance_method">
|
333
|
+
|
334
|
+
- (<tt><span class='object_link'><a href="" title="Box::Account (class)">Account</a></span></tt>) <strong>initialize</strong>(api)
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
</p><div class="docstring">
|
339
|
+
<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>
|
344
|
+
|
345
|
+
|
346
|
+
</div>
|
347
|
+
</div>
|
348
|
+
<div class="tags">
|
349
|
+
<h3>Parameters:</h3>
|
350
|
+
<ul class="param">
|
351
|
+
|
352
|
+
<li>
|
353
|
+
|
354
|
+
<span class='name'>api</span>
|
355
|
+
|
356
|
+
|
357
|
+
<span class='type'>(<tt>String</tt>, <tt><span class='object_link'><a href="Api.html" title="Box::Api (class)">Api</a></span></tt>)</span>
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
—
|
362
|
+
<div class='inline'><p>
|
363
|
+
the api key to use for the Box api.
|
364
|
+
</p>
|
365
|
+
</div>
|
366
|
+
|
367
|
+
</li>
|
368
|
+
|
369
|
+
</ul>
|
370
|
+
|
371
|
+
</div><table class="source_code">
|
372
|
+
<tr>
|
373
|
+
<td>
|
374
|
+
<pre class="lines">
|
375
|
+
|
376
|
+
|
377
|
+
20
|
378
|
+
21
|
379
|
+
22
|
380
|
+
23
|
381
|
+
24
|
382
|
+
25</pre>
|
383
|
+
</td>
|
384
|
+
<td>
|
385
|
+
<pre class="code"><span class="info file"># File 'lib/box/account.rb', line 20</span>
|
386
|
+
|
387
|
+
<span class='kw'>def</span> <span class='id initialize'>initialize</span><span class='lparen'>(</span><span class='id api'>api</span><span class='rparen'>)</span>
|
388
|
+
<span class='ivar'>@api</span> <span class='op'>=</span> <span class='kw'>case</span>
|
389
|
+
<span class='kw'>when</span> <span class='id api'>api</span><span class='period'>.</span><span class='id class'>class</span> <span class='op'>==</span> <span class='const'>Box</span><span class='op'>::</span><span class='const'>Api</span><span class='semicolon'>;</span> <span class='id api'>api</span> <span class='comment'># use the api object as passed in
|
390
|
+
</span> <span class='kw'>else</span><span class='semicolon'>;</span> <span class='const'>Box</span><span class='op'>::</span><span class='const'>Api</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='id api'>api</span><span class='rparen'>)</span> <span class='comment'># allows user to pass in a string
|
391
|
+
</span> <span class='kw'>end</span>
|
392
|
+
<span class='kw'>end</span></pre>
|
393
|
+
</td>
|
394
|
+
</tr>
|
395
|
+
</table>
|
396
|
+
</div>
|
397
|
+
|
398
|
+
</div>
|
399
|
+
|
400
|
+
<div id="instance_attr_details" class="attr_details">
|
401
|
+
<h2>Instance Attribute Details</h2>
|
402
|
+
|
403
|
+
|
404
|
+
<span id=""></span>
|
405
|
+
<span id="auth_token-instance_method"></span>
|
406
|
+
<div class="method_details first">
|
407
|
+
<p class="signature first" id="auth_token-instance_method">
|
408
|
+
|
409
|
+
- (<tt>String</tt>) <strong>auth_token</strong> <span class="extras">(readonly)</span>
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
</p><div class="docstring">
|
414
|
+
<div class="discussion">
|
415
|
+
<p>
|
416
|
+
The auth token if authorization was successful.
|
417
|
+
</p>
|
418
|
+
|
419
|
+
|
420
|
+
</div>
|
421
|
+
</div>
|
422
|
+
<div class="tags">
|
423
|
+
<h3>Returns:</h3>
|
424
|
+
<ul class="return">
|
425
|
+
|
426
|
+
<li>
|
427
|
+
|
428
|
+
|
429
|
+
<span class='type'>(<tt>String</tt>)</span>
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
—
|
434
|
+
<div class='inline'><p>
|
435
|
+
The auth token if authorization was successful.
|
436
|
+
</p>
|
437
|
+
</div>
|
438
|
+
|
439
|
+
</li>
|
440
|
+
|
441
|
+
</ul>
|
442
|
+
|
443
|
+
</div><table class="source_code">
|
444
|
+
<tr>
|
445
|
+
<td>
|
446
|
+
<pre class="lines">
|
447
|
+
|
448
|
+
|
449
|
+
13
|
450
|
+
14
|
451
|
+
15</pre>
|
452
|
+
</td>
|
453
|
+
<td>
|
454
|
+
<pre class="code"><span class="info file"># File 'lib/box/account.rb', line 13</span>
|
455
|
+
|
456
|
+
<span class='kw'>def</span> <span class='id auth_token'>auth_token</span>
|
457
|
+
<span class='ivar'>@auth_token</span>
|
458
|
+
<span class='kw'>end</span></pre>
|
459
|
+
</td>
|
460
|
+
</tr>
|
461
|
+
</table>
|
462
|
+
</div>
|
463
|
+
|
464
|
+
</div>
|
465
|
+
|
466
|
+
|
467
|
+
<div id="instance_method_details" class="method_details_list">
|
468
|
+
<h2>Instance Method Details</h2>
|
469
|
+
|
470
|
+
|
471
|
+
<div class="method_details first">
|
472
|
+
<p class="signature first" id="authorize-instance_method">
|
473
|
+
|
474
|
+
- (<tt>Boolean</tt>) <strong>authorize</strong>(auth_token = nil) {|authorize_url| ... }
|
475
|
+
|
476
|
+
|
477
|
+
|
478
|
+
</p><div class="docstring">
|
479
|
+
<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’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>
|
490
|
+
|
491
|
+
|
492
|
+
</div>
|
493
|
+
</div>
|
494
|
+
<div class="tags">
|
495
|
+
|
496
|
+
<div class="examples">
|
497
|
+
<h3>Examples:</h3>
|
498
|
+
|
499
|
+
<h4><div class='inline'><p>
|
500
|
+
Authorize an account without a saved auth token.
|
501
|
+
</p>
|
502
|
+
</div></h4>
|
503
|
+
<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
|
+
<span class='id puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</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'>"</span></span>
|
505
|
+
<span class='id puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Press the enter key once you have done this.</span><span class='tstring_end'>"</span></span>
|
506
|
+
<span class='id gets'>gets</span> <span class='comment'># wait for the enter key to be pressed
|
507
|
+
</span><span class='kw'>end</span></pre>
|
508
|
+
|
509
|
+
<h4><div class='inline'><p>
|
510
|
+
Authorize an account using an existing auth token.
|
511
|
+
</p>
|
512
|
+
</div></h4>
|
513
|
+
<pre class="example code"><span class='id auth_token'>auth_token</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>saved auth token</span><span class='tstring_end'>"</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>
|
515
|
+
|
516
|
+
<h4><div class='inline'><p>
|
517
|
+
Combining the above two for the best functionality.
|
518
|
+
</p>
|
519
|
+
</div></h4>
|
520
|
+
<pre class="example code"><span class='id auth_token'>auth_token</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>saved auth token</span><span class='tstring_end'>"</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>
|
522
|
+
<span class='comment'># auth token was invalid or nil, have the user visit auth_url
|
523
|
+
</span><span class='kw'>end</span></pre>
|
524
|
+
|
525
|
+
</div>
|
526
|
+
<h3>Parameters:</h3>
|
527
|
+
<ul class="param">
|
528
|
+
|
529
|
+
<li>
|
530
|
+
|
531
|
+
<span class='name'>auth_token</span>
|
532
|
+
|
533
|
+
|
534
|
+
<span class='type'>(<tt>Optional</tt>, <tt>String</tt>)</span>
|
535
|
+
|
536
|
+
|
537
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
538
|
+
|
539
|
+
|
540
|
+
—
|
541
|
+
<div class='inline'><p>
|
542
|
+
Uses an existing token or requests a new one if nil.
|
543
|
+
</p>
|
544
|
+
</div>
|
545
|
+
|
546
|
+
</li>
|
547
|
+
|
548
|
+
</ul>
|
549
|
+
<h3>Yields:</h3>
|
550
|
+
<ul class="yield">
|
551
|
+
|
552
|
+
<li>
|
553
|
+
|
554
|
+
|
555
|
+
<span class='type'>(<tt>authorize_url</tt>)</span>
|
556
|
+
|
557
|
+
|
558
|
+
|
559
|
+
—
|
560
|
+
<div class='inline'><p>
|
561
|
+
This block called when the user has not yet granted this application
|
562
|
+
permission to use their account. You must have the user navigate to the
|
563
|
+
passed url and authorize this app before continuing.
|
564
|
+
</p>
|
565
|
+
</div>
|
566
|
+
|
567
|
+
</li>
|
568
|
+
|
569
|
+
</ul>
|
570
|
+
<h3>Returns:</h3>
|
571
|
+
<ul class="return">
|
572
|
+
|
573
|
+
<li>
|
574
|
+
|
575
|
+
|
576
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
577
|
+
|
578
|
+
|
579
|
+
|
580
|
+
—
|
581
|
+
<div class='inline'><p>
|
582
|
+
Whether the user is authorized.
|
583
|
+
</p>
|
584
|
+
</div>
|
585
|
+
|
586
|
+
</li>
|
587
|
+
|
588
|
+
</ul>
|
589
|
+
|
590
|
+
</div><table class="source_code">
|
591
|
+
<tr>
|
592
|
+
<td>
|
593
|
+
<pre class="lines">
|
594
|
+
|
595
|
+
|
596
|
+
79
|
597
|
+
80
|
598
|
+
81
|
599
|
+
82
|
600
|
+
83
|
601
|
+
84
|
602
|
+
85
|
603
|
+
86
|
604
|
+
87
|
605
|
+
88
|
606
|
+
89
|
607
|
+
90
|
608
|
+
91
|
609
|
+
92
|
610
|
+
93
|
611
|
+
94
|
612
|
+
95
|
613
|
+
96
|
614
|
+
97</pre>
|
615
|
+
</td>
|
616
|
+
<td>
|
617
|
+
<pre class="code"><span class="info file"># File 'lib/box/account.rb', line 79</span>
|
618
|
+
|
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
|
+
<span class='comment'># use a saved auth token if it is given
|
621
|
+
</span> <span class='kw'>if</span> <span class='id auth_token'>auth_token</span>
|
622
|
+
<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>
|
623
|
+
<span class='kw'>end</span>
|
624
|
+
|
625
|
+
<span class='comment'># the auth token either failed or was not provided
|
626
|
+
</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>
|
628
|
+
<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>
|
630
|
+
|
631
|
+
<span class='comment'># try authorizing once more
|
632
|
+
</span> <span class='id authorize_ticket'>authorize_ticket</span>
|
633
|
+
<span class='kw'>end</span>
|
634
|
+
|
635
|
+
<span class='comment'># return our authorized status
|
636
|
+
</span> <span class='id authorized?'>authorized?</span>
|
637
|
+
<span class='kw'>end</span></pre>
|
638
|
+
</td>
|
639
|
+
</tr>
|
640
|
+
</table>
|
641
|
+
</div>
|
642
|
+
|
643
|
+
<div class="method_details ">
|
644
|
+
<p class="signature " id="authorized?-instance_method">
|
645
|
+
|
646
|
+
- (<tt>Boolean</tt>) <strong>authorized?</strong>
|
647
|
+
|
648
|
+
|
649
|
+
|
650
|
+
</p><div class="docstring">
|
651
|
+
<div class="discussion">
|
652
|
+
<p>
|
653
|
+
Is the account authorized?
|
654
|
+
</p>
|
655
|
+
|
656
|
+
|
657
|
+
</div>
|
658
|
+
</div>
|
659
|
+
<div class="tags">
|
660
|
+
<h3>Returns:</h3>
|
661
|
+
<ul class="return">
|
662
|
+
|
663
|
+
<li>
|
664
|
+
|
665
|
+
|
666
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
667
|
+
|
668
|
+
|
669
|
+
|
670
|
+
—
|
671
|
+
<div class='inline'><p>
|
672
|
+
Is the account authorized?
|
673
|
+
</p>
|
674
|
+
</div>
|
675
|
+
|
676
|
+
</li>
|
677
|
+
|
678
|
+
</ul>
|
679
|
+
|
680
|
+
</div><table class="source_code">
|
681
|
+
<tr>
|
682
|
+
<td>
|
683
|
+
<pre class="lines">
|
684
|
+
|
685
|
+
|
686
|
+
151
|
687
|
+
152
|
688
|
+
153</pre>
|
689
|
+
</td>
|
690
|
+
<td>
|
691
|
+
<pre class="code"><span class="info file"># File 'lib/box/account.rb', line 151</span>
|
692
|
+
|
693
|
+
<span class='kw'>def</span> <span class='id authorized?'>authorized?</span>
|
694
|
+
<span class='ivar'>@info</span> <span class='op'>!=</span> <span class='kw'>nil</span>
|
695
|
+
<span class='kw'>end</span></pre>
|
696
|
+
</td>
|
697
|
+
</tr>
|
698
|
+
</table>
|
699
|
+
</div>
|
700
|
+
|
701
|
+
<div class="method_details ">
|
702
|
+
<p class="signature " id="info-instance_method">
|
703
|
+
|
704
|
+
- (<tt>Hash</tt>) <strong>info</strong>(refresh = false)
|
705
|
+
|
706
|
+
|
707
|
+
|
708
|
+
</p><div class="docstring">
|
709
|
+
<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>
|
717
|
+
|
718
|
+
|
719
|
+
</div>
|
720
|
+
</div>
|
721
|
+
<div class="tags">
|
722
|
+
<h3>Parameters:</h3>
|
723
|
+
<ul class="param">
|
724
|
+
|
725
|
+
<li>
|
726
|
+
|
727
|
+
<span class='name'>refresh</span>
|
728
|
+
|
729
|
+
|
730
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
731
|
+
|
732
|
+
|
733
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
734
|
+
|
735
|
+
|
736
|
+
—
|
737
|
+
<div class='inline'><p>
|
738
|
+
Will not use the cached version if true.
|
739
|
+
</p>
|
740
|
+
</div>
|
741
|
+
|
742
|
+
</li>
|
743
|
+
|
744
|
+
</ul>
|
745
|
+
<h3>Returns:</h3>
|
746
|
+
<ul class="return">
|
747
|
+
|
748
|
+
<li>
|
749
|
+
|
750
|
+
|
751
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
752
|
+
|
753
|
+
|
754
|
+
|
755
|
+
—
|
756
|
+
<div class='inline'><p>
|
757
|
+
A hash containing all of the user’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>
|
761
|
+
</div>
|
762
|
+
|
763
|
+
</li>
|
764
|
+
|
765
|
+
</ul>
|
766
|
+
|
767
|
+
</div><table class="source_code">
|
768
|
+
<tr>
|
769
|
+
<td>
|
770
|
+
<pre class="lines">
|
771
|
+
|
772
|
+
|
773
|
+
127
|
774
|
+
128
|
775
|
+
129
|
776
|
+
130
|
777
|
+
131
|
778
|
+
132
|
779
|
+
133
|
780
|
+
134
|
781
|
+
135
|
782
|
+
136
|
783
|
+
137</pre>
|
784
|
+
</td>
|
785
|
+
<td>
|
786
|
+
<pre class="code"><span class="info file"># File 'lib/box/account.rb', line 127</span>
|
787
|
+
|
788
|
+
<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
|
+
<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>
|
790
|
+
|
791
|
+
<span class='kw'>begin</span>
|
792
|
+
<span class='id cache_info'>cache_info</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='rparen'>)</span> <span class='comment'># reset existing info
|
793
|
+
</span> <span class='id info'>info</span> <span class='op'>=</span> <span class='ivar'>@api</span><span class='period'>.</span><span class='id get_account_info'>get_account_info</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>user</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
794
|
+
<span class='id cache_info'>cache_info</span><span class='lparen'>(</span><span class='id info'>info</span><span class='rparen'>)</span>
|
795
|
+
<span class='kw'>rescue</span> <span class='const'>Api</span><span class='op'>::</span><span class='const'>NotAuthorized</span><span class='comma'>,</span> <span class='const'>Api</span><span class='op'>::</span><span class='const'>InvalidInput</span>
|
796
|
+
<span class='kw'>nil</span>
|
797
|
+
<span class='kw'>end</span>
|
798
|
+
<span class='kw'>end</span></pre>
|
799
|
+
</td>
|
800
|
+
</tr>
|
801
|
+
</table>
|
802
|
+
</div>
|
803
|
+
|
804
|
+
<div class="method_details ">
|
805
|
+
<p class="signature " id="logout-instance_method">
|
806
|
+
|
807
|
+
- (<tt>Boolean</tt>) <strong>logout</strong>
|
808
|
+
|
809
|
+
|
810
|
+
|
811
|
+
</p><div class="docstring">
|
812
|
+
<div class="discussion">
|
813
|
+
|
814
|
+
<div class="note notetag">
|
815
|
+
<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>
|
820
|
+
</div>
|
821
|
+
</div>
|
822
|
+
|
823
|
+
<p>
|
824
|
+
Log out of the account and invalidate the auth token.
|
825
|
+
</p>
|
826
|
+
|
827
|
+
|
828
|
+
</div>
|
829
|
+
</div>
|
830
|
+
<div class="tags">
|
831
|
+
<h3>Returns:</h3>
|
832
|
+
<ul class="return">
|
833
|
+
|
834
|
+
<li>
|
835
|
+
|
836
|
+
|
837
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
838
|
+
|
839
|
+
|
840
|
+
|
841
|
+
—
|
842
|
+
<div class='inline'><p>
|
843
|
+
Whether logout was successful.
|
844
|
+
</p>
|
845
|
+
</div>
|
846
|
+
|
847
|
+
</li>
|
848
|
+
|
849
|
+
</ul>
|
850
|
+
|
851
|
+
</div><table class="source_code">
|
852
|
+
<tr>
|
853
|
+
<td>
|
854
|
+
<pre class="lines">
|
855
|
+
|
856
|
+
|
857
|
+
106
|
858
|
+
107
|
859
|
+
108
|
860
|
+
109
|
861
|
+
110
|
862
|
+
111
|
863
|
+
112
|
864
|
+
113
|
865
|
+
114
|
866
|
+
115</pre>
|
867
|
+
</td>
|
868
|
+
<td>
|
869
|
+
<pre class="code"><span class="info file"># File 'lib/box/account.rb', line 106</span>
|
870
|
+
|
871
|
+
<span class='kw'>def</span> <span class='id logout'>logout</span>
|
872
|
+
<span class='kw'>begin</span>
|
873
|
+
<span class='ivar'>@api</span><span class='period'>.</span><span class='id logout'>logout</span>
|
874
|
+
<span class='id cache_token'>cache_token</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='rparen'>)</span>
|
875
|
+
<span class='kw'>rescue</span> <span class='const'>Api</span><span class='op'>::</span><span class='const'>NotAuthorized</span>
|
876
|
+
<span class='comment'># already logged out, or never logged in
|
877
|
+
</span> <span class='kw'>end</span>
|
878
|
+
|
879
|
+
<span class='kw'>true</span>
|
880
|
+
<span class='kw'>end</span></pre>
|
881
|
+
</td>
|
882
|
+
</tr>
|
883
|
+
</table>
|
884
|
+
</div>
|
885
|
+
|
886
|
+
<div class="method_details ">
|
887
|
+
<p class="signature " id="register-instance_method">
|
888
|
+
|
889
|
+
- (<tt>Boolean</tt>) <strong>register</strong>(email, password)
|
890
|
+
|
891
|
+
|
892
|
+
|
893
|
+
</p><div class="docstring">
|
894
|
+
<div class="discussion">
|
895
|
+
<p>
|
896
|
+
Register a new account on the Box website with the given details.
|
897
|
+
</p>
|
898
|
+
|
899
|
+
|
900
|
+
</div>
|
901
|
+
</div>
|
902
|
+
<div class="tags">
|
903
|
+
<h3>Parameters:</h3>
|
904
|
+
<ul class="param">
|
905
|
+
|
906
|
+
<li>
|
907
|
+
|
908
|
+
<span class='name'>email</span>
|
909
|
+
|
910
|
+
|
911
|
+
<span class='type'>(<tt>String</tt>)</span>
|
912
|
+
|
913
|
+
|
914
|
+
|
915
|
+
—
|
916
|
+
<div class='inline'><p>
|
917
|
+
The email address to create the account with
|
918
|
+
</p>
|
919
|
+
</div>
|
920
|
+
|
921
|
+
</li>
|
922
|
+
|
923
|
+
<li>
|
924
|
+
|
925
|
+
<span class='name'>password</span>
|
926
|
+
|
927
|
+
|
928
|
+
<span class='type'>(<tt>String</tt>)</span>
|
929
|
+
|
930
|
+
|
931
|
+
|
932
|
+
—
|
933
|
+
<div class='inline'><p>
|
934
|
+
The password to create the account with
|
935
|
+
</p>
|
936
|
+
</div>
|
937
|
+
|
938
|
+
</li>
|
939
|
+
|
940
|
+
</ul>
|
941
|
+
<h3>Returns:</h3>
|
942
|
+
<ul class="return">
|
943
|
+
|
944
|
+
<li>
|
945
|
+
|
946
|
+
|
947
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
948
|
+
|
949
|
+
|
950
|
+
|
951
|
+
—
|
952
|
+
<div class='inline'><p>
|
953
|
+
Whether registration was successful.
|
954
|
+
</p>
|
955
|
+
</div>
|
956
|
+
|
957
|
+
</li>
|
958
|
+
|
959
|
+
</ul>
|
960
|
+
<h3>Raises:</h3>
|
961
|
+
<ul class="raise">
|
962
|
+
|
963
|
+
<li>
|
964
|
+
|
965
|
+
|
966
|
+
<span class='type'>(<tt><span class='object_link'><a href="Api/EmailInvalid.html" title="Box::Api::EmailInvalid (class)">Api::EmailInvalid</a></span></tt>)</span>
|
967
|
+
|
968
|
+
|
969
|
+
|
970
|
+
—
|
971
|
+
<div class='inline'><p>
|
972
|
+
The email address was invalid
|
973
|
+
</p>
|
974
|
+
</div>
|
975
|
+
|
976
|
+
</li>
|
977
|
+
|
978
|
+
<li>
|
979
|
+
|
980
|
+
|
981
|
+
<span class='type'>(<tt><span class='object_link'><a href="Api/EmailTaken.html" title="Box::Api::EmailTaken (class)">Api::EmailTaken</a></span></tt>)</span>
|
982
|
+
|
983
|
+
|
984
|
+
|
985
|
+
—
|
986
|
+
<div class='inline'><p>
|
987
|
+
The email address was taken
|
988
|
+
</p>
|
989
|
+
</div>
|
990
|
+
|
991
|
+
</li>
|
992
|
+
|
993
|
+
</ul>
|
994
|
+
|
995
|
+
</div><table class="source_code">
|
996
|
+
<tr>
|
997
|
+
<td>
|
998
|
+
<pre class="lines">
|
999
|
+
|
1000
|
+
|
1001
|
+
36
|
1002
|
+
37
|
1003
|
+
38
|
1004
|
+
39
|
1005
|
+
40
|
1006
|
+
41
|
1007
|
+
42
|
1008
|
+
43</pre>
|
1009
|
+
</td>
|
1010
|
+
<td>
|
1011
|
+
<pre class="code"><span class="info file"># File 'lib/box/account.rb', line 36</span>
|
1012
|
+
|
1013
|
+
<span class='kw'>def</span> <span class='id register'>register</span><span class='lparen'>(</span><span class='id email'>email</span><span class='comma'>,</span> <span class='id password'>password</span><span class='rparen'>)</span>
|
1014
|
+
<span class='id response'>response</span> <span class='op'>=</span> <span class='ivar'>@api</span><span class='period'>.</span><span class='id register_new_user'>register_new_user</span><span class='lparen'>(</span><span class='id email'>email</span><span class='comma'>,</span> <span class='id password'>password</span><span class='rparen'>)</span>
|
1015
|
+
|
1016
|
+
<span class='id cache_info'>cache_info</span><span class='lparen'>(</span><span class='id response'>response</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>user</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='comment'># cache account_info, saving an extra API call
|
1017
|
+
</span> <span class='id authorize_token'>authorize_token</span><span class='lparen'>(</span><span class='id response'>response</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>token</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1018
|
+
|
1019
|
+
<span class='kw'>true</span>
|
1020
|
+
<span class='kw'>end</span></pre>
|
1021
|
+
</td>
|
1022
|
+
</tr>
|
1023
|
+
</table>
|
1024
|
+
</div>
|
1025
|
+
|
1026
|
+
<div class="method_details ">
|
1027
|
+
<p class="signature " id="root-instance_method">
|
1028
|
+
|
1029
|
+
- (<tt><span class='object_link'><a href="Folder.html" title="Box::Folder (class)">Folder</a></span></tt>) <strong>root</strong>
|
1030
|
+
|
1031
|
+
|
1032
|
+
|
1033
|
+
</p><div class="docstring">
|
1034
|
+
<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
|
1037
|
+
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>
|
1040
|
+
|
1041
|
+
|
1042
|
+
</div>
|
1043
|
+
</div>
|
1044
|
+
<div class="tags">
|
1045
|
+
<h3>Returns:</h3>
|
1046
|
+
<ul class="return">
|
1047
|
+
|
1048
|
+
<li>
|
1049
|
+
|
1050
|
+
|
1051
|
+
<span class='type'>(<tt><span class='object_link'><a href="Folder.html" title="Box::Folder (class)">Folder</a></span></tt>)</span>
|
1052
|
+
|
1053
|
+
|
1054
|
+
|
1055
|
+
—
|
1056
|
+
<div class='inline'><p>
|
1057
|
+
A folder object representing the root folder.
|
1058
|
+
</p>
|
1059
|
+
</div>
|
1060
|
+
|
1061
|
+
</li>
|
1062
|
+
|
1063
|
+
</ul>
|
1064
|
+
|
1065
|
+
</div><table class="source_code">
|
1066
|
+
<tr>
|
1067
|
+
<td>
|
1068
|
+
<pre class="lines">
|
1069
|
+
|
1070
|
+
|
1071
|
+
145
|
1072
|
+
146
|
1073
|
+
147
|
1074
|
+
148</pre>
|
1075
|
+
</td>
|
1076
|
+
<td>
|
1077
|
+
<pre class="code"><span class="info file"># File 'lib/box/account.rb', line 145</span>
|
1078
|
+
|
1079
|
+
<span class='kw'>def</span> <span class='id root'>root</span>
|
1080
|
+
<span class='kw'>return</span> <span class='ivar'>@root</span> <span class='kw'>if</span> <span class='ivar'>@root</span>
|
1081
|
+
<span class='ivar'>@root</span> <span class='op'>=</span> <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='ivar'>@api</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:id</span> <span class='op'>=></span> <span class='int'>0</span><span class='rparen'>)</span>
|
1082
|
+
<span class='kw'>end</span></pre>
|
1083
|
+
</td>
|
1084
|
+
</tr>
|
1085
|
+
</table>
|
1086
|
+
</div>
|
1087
|
+
|
1088
|
+
</div>
|
1089
|
+
|
1090
|
+
</div>
|
1091
|
+
|
1092
|
+
<div id="footer">
|
1093
|
+
Generated on Mon Aug 8 13:05:22 2011 by
|
1094
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1095
|
+
0.7.2 (ruby-1.9.2).
|
1096
|
+
</div>
|
1097
|
+
|
1098
|
+
</body>
|
1099
|
+
</html>
|