dropbox_api 0.1.14 → 0.1.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.yardopts +1 -0
- data/docs/DropboxApi.html +135 -0
- data/docs/DropboxApi/Authenticator.html +217 -0
- data/docs/DropboxApi/ChunkedUploader.html +409 -0
- data/docs/DropboxApi/Client.html +8747 -0
- data/docs/DropboxApi/ConnectionBuilder.html +326 -0
- data/docs/DropboxApi/Endpoints.html +119 -0
- data/docs/DropboxApi/Endpoints/Auth.html +115 -0
- data/docs/DropboxApi/Endpoints/Auth/TokenRevoke.html +265 -0
- data/docs/DropboxApi/Endpoints/Base.html +197 -0
- data/docs/DropboxApi/Endpoints/ContentDownload.html +383 -0
- data/docs/DropboxApi/Endpoints/ContentUpload.html +351 -0
- data/docs/DropboxApi/Endpoints/Files.html +117 -0
- data/docs/DropboxApi/Endpoints/Files/Copy.html +323 -0
- data/docs/DropboxApi/Endpoints/Files/CopyReferenceGet.html +304 -0
- data/docs/DropboxApi/Endpoints/Files/CopyReferenceSave.html +320 -0
- data/docs/DropboxApi/Endpoints/Files/CreateFileRequest.html +307 -0
- data/docs/DropboxApi/Endpoints/Files/CreateFolder.html +305 -0
- data/docs/DropboxApi/Endpoints/Files/Delete.html +341 -0
- data/docs/DropboxApi/Endpoints/Files/Download.html +284 -0
- data/docs/DropboxApi/Endpoints/Files/GetMetadata.html +376 -0
- data/docs/DropboxApi/Endpoints/Files/GetPreview.html +286 -0
- data/docs/DropboxApi/Endpoints/Files/GetTemporaryLink.html +286 -0
- data/docs/DropboxApi/Endpoints/Files/GetThumbnail.html +388 -0
- data/docs/DropboxApi/Endpoints/Files/GetThumbnailBatch.html +431 -0
- data/docs/DropboxApi/Endpoints/Files/ListFolder.html +383 -0
- data/docs/DropboxApi/Endpoints/Files/ListFolderContinue.html +298 -0
- data/docs/DropboxApi/Endpoints/Files/ListFolderGetLatestCursor.html +371 -0
- data/docs/DropboxApi/Endpoints/Files/ListFolderLongpoll.html +360 -0
- data/docs/DropboxApi/Endpoints/Files/ListRevisions.html +338 -0
- data/docs/DropboxApi/Endpoints/Files/Move.html +364 -0
- data/docs/DropboxApi/Endpoints/Files/PermanentlyDelete.html +337 -0
- data/docs/DropboxApi/Endpoints/Files/Restore.html +305 -0
- data/docs/DropboxApi/Endpoints/Files/SaveUrl.html +324 -0
- data/docs/DropboxApi/Endpoints/Files/SaveUrlCheckJobStatus.html +306 -0
- data/docs/DropboxApi/Endpoints/Files/Search.html +399 -0
- data/docs/DropboxApi/Endpoints/Files/Upload.html +439 -0
- data/docs/DropboxApi/Endpoints/Files/UploadSessionAppendV2.html +377 -0
- data/docs/DropboxApi/Endpoints/Files/UploadSessionFinish.html +328 -0
- data/docs/DropboxApi/Endpoints/Files/UploadSessionStart.html +350 -0
- data/docs/DropboxApi/Endpoints/Rpc.html +353 -0
- data/docs/DropboxApi/Endpoints/RpcContent.html +236 -0
- data/docs/DropboxApi/Endpoints/RpcNotify.html +240 -0
- data/docs/DropboxApi/Endpoints/Sharing.html +117 -0
- data/docs/DropboxApi/Endpoints/Sharing/AddFileMember.html +415 -0
- data/docs/DropboxApi/Endpoints/Sharing/AddFolderMember.html +400 -0
- data/docs/DropboxApi/Endpoints/Sharing/CreateSharedLinkWithSettings.html +322 -0
- data/docs/DropboxApi/Endpoints/Sharing/GetSharedLinkMetadata.html +344 -0
- data/docs/DropboxApi/Endpoints/Sharing/ListFileMembers.html +421 -0
- data/docs/DropboxApi/Endpoints/Sharing/ListFolderMembers.html +400 -0
- data/docs/DropboxApi/Endpoints/Sharing/ListSharedLinks.html +345 -0
- data/docs/DropboxApi/Endpoints/Sharing/ShareFolder.html +428 -0
- data/docs/DropboxApi/Endpoints/Sharing/UnshareFile.html +290 -0
- data/docs/DropboxApi/Endpoints/Users.html +117 -0
- data/docs/DropboxApi/Endpoints/Users/GetAccount.html +301 -0
- data/docs/DropboxApi/Endpoints/Users/GetAccountBatch.html +303 -0
- data/docs/DropboxApi/Endpoints/Users/GetCurrentAccount.html +282 -0
- data/docs/DropboxApi/Endpoints/Users/GetSpaceUsage.html +282 -0
- data/docs/DropboxApi/Errors.html +117 -0
- data/docs/DropboxApi/Errors/AddFileMemberError.html +164 -0
- data/docs/DropboxApi/Errors/AddFolderMemberError.html +170 -0
- data/docs/DropboxApi/Errors/AddMemberSelectorError.html +165 -0
- data/docs/DropboxApi/Errors/AlreadySharedError.html +213 -0
- data/docs/DropboxApi/Errors/BadPathError.html +143 -0
- data/docs/DropboxApi/Errors/BasicError.html +356 -0
- data/docs/DropboxApi/Errors/CantCopySharedFolderError.html +143 -0
- data/docs/DropboxApi/Errors/CantMoveFolderIntoItselfError.html +143 -0
- data/docs/DropboxApi/Errors/CantNestSharedFolderError.html +143 -0
- data/docs/DropboxApi/Errors/CantShareOutsideTeamError.html +143 -0
- data/docs/DropboxApi/Errors/ContainsSharedFolderError.html +143 -0
- data/docs/DropboxApi/Errors/ConversionError.html +143 -0
- data/docs/DropboxApi/Errors/CreateFileRequestError.html +160 -0
- data/docs/DropboxApi/Errors/CreateFolderError.html +161 -0
- data/docs/DropboxApi/Errors/CreateSharedLinkWithSettingsError.html +165 -0
- data/docs/DropboxApi/Errors/CursorClosedError.html +143 -0
- data/docs/DropboxApi/Errors/CursorNotClosedError.html +143 -0
- data/docs/DropboxApi/Errors/DeleteError.html +162 -0
- data/docs/DropboxApi/Errors/DisallowedNameError.html +143 -0
- data/docs/DropboxApi/Errors/DisallowedSharedLinkPolicyError.html +143 -0
- data/docs/DropboxApi/Errors/DownloadError.html +161 -0
- data/docs/DropboxApi/Errors/DownloadFailedError.html +143 -0
- data/docs/DropboxApi/Errors/EmailUnverifiedError.html +143 -0
- data/docs/DropboxApi/Errors/FileAncestorConflictError.html +143 -0
- data/docs/DropboxApi/Errors/FileConflictError.html +143 -0
- data/docs/DropboxApi/Errors/FileMemberActionError.html +164 -0
- data/docs/DropboxApi/Errors/FolderConflictError.html +143 -0
- data/docs/DropboxApi/Errors/GetAccountError.html +161 -0
- data/docs/DropboxApi/Errors/GetCopyReferenceError.html +161 -0
- data/docs/DropboxApi/Errors/GetMetadataError.html +161 -0
- data/docs/DropboxApi/Errors/GroupDeletedError.html +143 -0
- data/docs/DropboxApi/Errors/GroupNotOnTeamError.html +143 -0
- data/docs/DropboxApi/Errors/HttpError.html +124 -0
- data/docs/DropboxApi/Errors/InProgressError.html +143 -0
- data/docs/DropboxApi/Errors/InsideAppFolderError.html +143 -0
- data/docs/DropboxApi/Errors/InsideOsxPackageError.html +143 -0
- data/docs/DropboxApi/Errors/InsidePublicFolderError.html +143 -0
- data/docs/DropboxApi/Errors/InsideSharedFolderError.html +143 -0
- data/docs/DropboxApi/Errors/InsufficientPlanError.html +143 -0
- data/docs/DropboxApi/Errors/InsufficientSpaceError.html +143 -0
- data/docs/DropboxApi/Errors/InternalError.html +143 -0
- data/docs/DropboxApi/Errors/InvalidCommentError.html +143 -0
- data/docs/DropboxApi/Errors/InvalidCopyReferenceError.html +143 -0
- data/docs/DropboxApi/Errors/InvalidCursorError.html +143 -0
- data/docs/DropboxApi/Errors/InvalidDropboxIdError.html +143 -0
- data/docs/DropboxApi/Errors/InvalidEmailError.html +143 -0
- data/docs/DropboxApi/Errors/InvalidFileError.html +143 -0
- data/docs/DropboxApi/Errors/InvalidIdError.html +143 -0
- data/docs/DropboxApi/Errors/InvalidMemberError.html +143 -0
- data/docs/DropboxApi/Errors/InvalidPathError.html +143 -0
- data/docs/DropboxApi/Errors/InvalidRevisionError.html +143 -0
- data/docs/DropboxApi/Errors/InvalidSettingsError.html +143 -0
- data/docs/DropboxApi/Errors/InvalidUrlError.html +143 -0
- data/docs/DropboxApi/Errors/IsAppFolderError.html +143 -0
- data/docs/DropboxApi/Errors/IsFileError.html +143 -0
- data/docs/DropboxApi/Errors/IsFolderError.html +143 -0
- data/docs/DropboxApi/Errors/IsOsxPackageError.html +143 -0
- data/docs/DropboxApi/Errors/IsPublicFolderError.html +143 -0
- data/docs/DropboxApi/Errors/ListFolderContinueError.html +162 -0
- data/docs/DropboxApi/Errors/ListFolderError.html +161 -0
- data/docs/DropboxApi/Errors/ListFolderLongpollError.html +161 -0
- data/docs/DropboxApi/Errors/ListRevisionsError.html +161 -0
- data/docs/DropboxApi/Errors/ListSharedLinksError.html +162 -0
- data/docs/DropboxApi/Errors/LookupError.html +165 -0
- data/docs/DropboxApi/Errors/MalformedPathError.html +143 -0
- data/docs/DropboxApi/Errors/NoAccountError.html +143 -0
- data/docs/DropboxApi/Errors/NoPermissionError.html +143 -0
- data/docs/DropboxApi/Errors/NoWritePermissionError.html +143 -0
- data/docs/DropboxApi/Errors/NotAMemberError.html +143 -0
- data/docs/DropboxApi/Errors/NotFileError.html +143 -0
- data/docs/DropboxApi/Errors/NotFolderError.html +143 -0
- data/docs/DropboxApi/Errors/NotFoundError.html +143 -0
- data/docs/DropboxApi/Errors/PollError.html +162 -0
- data/docs/DropboxApi/Errors/PreviewError.html +164 -0
- data/docs/DropboxApi/Errors/RateLimitError.html +143 -0
- data/docs/DropboxApi/Errors/RelocationError.html +167 -0
- data/docs/DropboxApi/Errors/RestoreError.html +163 -0
- data/docs/DropboxApi/Errors/RestrictedContentError.html +143 -0
- data/docs/DropboxApi/Errors/SaveCopyReferenceError.html +165 -0
- data/docs/DropboxApi/Errors/SaveUrlError.html +164 -0
- data/docs/DropboxApi/Errors/SearchError.html +161 -0
- data/docs/DropboxApi/Errors/SettingsError.html +162 -0
- data/docs/DropboxApi/Errors/ShareFolderError.html +165 -0
- data/docs/DropboxApi/Errors/SharePathError.html +171 -0
- data/docs/DropboxApi/Errors/SharedFolderAccessError.html +164 -0
- data/docs/DropboxApi/Errors/SharedLinkAccessDeniedError.html +143 -0
- data/docs/DropboxApi/Errors/SharedLinkAlreadyExistsError.html +143 -0
- data/docs/DropboxApi/Errors/SharedLinkError.html +163 -0
- data/docs/DropboxApi/Errors/SharedLinkNotFoundError.html +143 -0
- data/docs/DropboxApi/Errors/SharingFileAccessError.html +165 -0
- data/docs/DropboxApi/Errors/SharingUserError.html +161 -0
- data/docs/DropboxApi/Errors/TeamFolderError.html +143 -0
- data/docs/DropboxApi/Errors/TeamPolicyDisallowsMemberPolicyError.html +143 -0
- data/docs/DropboxApi/Errors/ThumbnailBatchError.html +161 -0
- data/docs/DropboxApi/Errors/ThumbnailError.html +164 -0
- data/docs/DropboxApi/Errors/TooManyFilesError.html +143 -0
- data/docs/DropboxApi/Errors/TooManyMembersError.html +143 -0
- data/docs/DropboxApi/Errors/TooManyPendingInvitesError.html +143 -0
- data/docs/DropboxApi/Errors/TooManyRequestsError.html +321 -0
- data/docs/DropboxApi/Errors/TooManySharedFolderTargetsError.html +143 -0
- data/docs/DropboxApi/Errors/TooManyWriteOperationsError.html +167 -0
- data/docs/DropboxApi/Errors/UnmountedError.html +143 -0
- data/docs/DropboxApi/Errors/UnshareFileError.html +162 -0
- data/docs/DropboxApi/Errors/UnsupportedContentError.html +143 -0
- data/docs/DropboxApi/Errors/UnsupportedExtensionError.html +143 -0
- data/docs/DropboxApi/Errors/UnsupportedImageError.html +143 -0
- data/docs/DropboxApi/Errors/UnsupportedLinkTypeError.html +143 -0
- data/docs/DropboxApi/Errors/UnverifiedDropboxId.html +143 -0
- data/docs/DropboxApi/Errors/UploadError.html +161 -0
- data/docs/DropboxApi/Errors/UploadSessionFinishError.html +163 -0
- data/docs/DropboxApi/Errors/UploadSessionLookupError.html +164 -0
- data/docs/DropboxApi/Errors/UploadSessionOffsetError.html +220 -0
- data/docs/DropboxApi/Errors/UploadWriteFailedError.html +161 -0
- data/docs/DropboxApi/Errors/WriteConflictError.html +163 -0
- data/docs/DropboxApi/Errors/WriteError.html +165 -0
- data/docs/DropboxApi/Metadata.html +117 -0
- data/docs/DropboxApi/Metadata/AccessLevel.html +259 -0
- data/docs/DropboxApi/Metadata/AddFileMemberResult.html +164 -0
- data/docs/DropboxApi/Metadata/AddMember.html +246 -0
- data/docs/DropboxApi/Metadata/Base.html +545 -0
- data/docs/DropboxApi/Metadata/BasicAccount.html +167 -0
- data/docs/DropboxApi/Metadata/CommitInfo.html +232 -0
- data/docs/DropboxApi/Metadata/Deleted.html +158 -0
- data/docs/DropboxApi/Metadata/Dimensions.html +140 -0
- data/docs/DropboxApi/Metadata/Field.html +358 -0
- data/docs/DropboxApi/Metadata/File.html +238 -0
- data/docs/DropboxApi/Metadata/FileLinkMetadata.html +180 -0
- data/docs/DropboxApi/Metadata/FileMemberAction.html +230 -0
- data/docs/DropboxApi/Metadata/FileRequest.html +167 -0
- data/docs/DropboxApi/Metadata/Folder.html +228 -0
- data/docs/DropboxApi/Metadata/FolderLinkMetadata.html +140 -0
- data/docs/DropboxApi/Metadata/FolderSharingInfo.html +156 -0
- data/docs/DropboxApi/Metadata/LinkPermissions.html +161 -0
- data/docs/DropboxApi/Metadata/Location.html +140 -0
- data/docs/DropboxApi/Metadata/MediaInfo.html +245 -0
- data/docs/DropboxApi/Metadata/MediaMetadata.html +237 -0
- data/docs/DropboxApi/Metadata/Member.html +313 -0
- data/docs/DropboxApi/Metadata/MemberAction.html +274 -0
- data/docs/DropboxApi/Metadata/MemberActionList.html +221 -0
- data/docs/DropboxApi/Metadata/MemberPermission.html +163 -0
- data/docs/DropboxApi/Metadata/MemberPermissionList.html +237 -0
- data/docs/DropboxApi/Metadata/Name.html +158 -0
- data/docs/DropboxApi/Metadata/ParentFolderAccessInfo.html +140 -0
- data/docs/DropboxApi/Metadata/PhotoMetadata.html +164 -0
- data/docs/DropboxApi/Metadata/Resource.html +207 -0
- data/docs/DropboxApi/Metadata/SharedFolder.html +165 -0
- data/docs/DropboxApi/Metadata/SharedFolderPolicy.html +156 -0
- data/docs/DropboxApi/Metadata/SharedLink.html +375 -0
- data/docs/DropboxApi/Metadata/SharedLinkMetadata.html +204 -0
- data/docs/DropboxApi/Metadata/SpaceAllocation.html +156 -0
- data/docs/DropboxApi/Metadata/SpaceUsage.html +159 -0
- data/docs/DropboxApi/Metadata/Tag.html +293 -0
- data/docs/DropboxApi/Metadata/Team.html +140 -0
- data/docs/DropboxApi/Metadata/TeamMemberInfo.html +160 -0
- data/docs/DropboxApi/Metadata/ThumbnailBatchResultData.html +140 -0
- data/docs/DropboxApi/Metadata/ThumbnailBatchResultEntry.html +221 -0
- data/docs/DropboxApi/Metadata/UploadSessionCursor.html +226 -0
- data/docs/DropboxApi/Metadata/VideoMetadata.html +165 -0
- data/docs/DropboxApi/Metadata/WriteMode.html +439 -0
- data/docs/DropboxApi/MiddleWare.html +117 -0
- data/docs/DropboxApi/MiddleWare/DecodeResult.html +273 -0
- data/docs/DropboxApi/MiddleWare/Stack.html +452 -0
- data/docs/DropboxApi/OptionsValidator.html +234 -0
- data/docs/DropboxApi/ResultBuilder.html +570 -0
- data/docs/DropboxApi/Results.html +119 -0
- data/docs/DropboxApi/Results/AddFileMemberResultList.html +227 -0
- data/docs/DropboxApi/Results/Base.html +206 -0
- data/docs/DropboxApi/Results/BasicAccountBatch.html +205 -0
- data/docs/DropboxApi/Results/GetCopyReferenceResult.html +351 -0
- data/docs/DropboxApi/Results/GetTemporaryLinkResult.html +263 -0
- data/docs/DropboxApi/Results/GetThumbnailBatchResult.html +214 -0
- data/docs/DropboxApi/Results/ListFolderGetLatestCursorResult.html +210 -0
- data/docs/DropboxApi/Results/ListFolderLongpollResult.html +287 -0
- data/docs/DropboxApi/Results/ListFolderResult.html +368 -0
- data/docs/DropboxApi/Results/ListRevisionsResult.html +300 -0
- data/docs/DropboxApi/Results/ListSharedLinksResult.html +368 -0
- data/docs/DropboxApi/Results/SaveCopyReferenceResult.html +221 -0
- data/docs/DropboxApi/Results/SaveUrlJobStatus.html +230 -0
- data/docs/DropboxApi/Results/SaveUrlResult.html +227 -0
- data/docs/DropboxApi/Results/Search.html +115 -0
- data/docs/DropboxApi/Results/Search/Match.html +314 -0
- data/docs/DropboxApi/Results/SearchResult.html +368 -0
- data/docs/DropboxApi/Results/ShareFolderLaunch.html +205 -0
- data/docs/DropboxApi/Results/SharedFileMembers.html +369 -0
- data/docs/DropboxApi/Results/SharedFolderMembers.html +369 -0
- data/docs/DropboxApi/Results/UploadSessionStart.html +210 -0
- data/docs/DropboxApi/Results/VoidResult.html +140 -0
- data/docs/DropboxScaffoldBuilder.html +1117 -0
- data/docs/_index.html +1984 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +4 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +496 -0
- data/docs/file.README.html +257 -0
- data/docs/file.api_coverage.html +595 -0
- data/docs/file.rails_setup.html +152 -0
- data/docs/file_list.html +66 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +257 -0
- data/docs/js/app.js +292 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +1779 -0
- data/docs/top-level-namespace.html +112 -0
- data/lib/dropbox_api/chunked_uploader.rb +1 -0
- data/lib/dropbox_api/version.rb +1 -1
- metadata +264 -2
@@ -0,0 +1,152 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
File: Rails setup
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.15
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "rails_setup";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="file_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index</a> »
|
40
|
+
<span class="title">File: Rails setup</span>
|
41
|
+
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div id="search">
|
45
|
+
|
46
|
+
<a class="full_list_link" id="class_list_link"
|
47
|
+
href="class_list.html">
|
48
|
+
|
49
|
+
<svg width="24" height="24">
|
50
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
</svg>
|
54
|
+
</a>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
<div class="clear"></div>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div id="content"><div id='filecontents'><h1>Standard OAuth 2 flow set up</h1>
|
61
|
+
|
62
|
+
<p>This document describes how to implement the OAuth2 flow in a Rails
|
63
|
+
application, the process is represented in the following diagram:</p>
|
64
|
+
|
65
|
+
<p><img src="https://www.dropbox.com/static/images/developers/oauth2-web-diagram.png" alt="Oauth 2 flow"></p>
|
66
|
+
|
67
|
+
<p>Source: <a href="https://www.dropbox.com/developers/reference/oauth-guide#oauth-2-on-the-web">https://www.dropbox.com/developers/reference/oauth-guide#oauth-2-on-the-web</a></p>
|
68
|
+
|
69
|
+
<h2>1. Set up some new routes</h2>
|
70
|
+
|
71
|
+
<p>You'll have to create a couple of new routes:</p>
|
72
|
+
|
73
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_get'>get</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>dropbox/auth</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>dropbox#auth</span><span class='tstring_end'>'</span></span>
|
74
|
+
<span class='id identifier rubyid_get'>get</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>dropbox/auth_callback</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>dropbox#auth_callback</span><span class='tstring_end'>'</span></span>
|
75
|
+
</code></pre>
|
76
|
+
|
77
|
+
<p>We'll use <code>dropbox/auth</code> to perform the step 2 in the diagram, i.e. this route
|
78
|
+
will redirect to Dropbox.</p>
|
79
|
+
|
80
|
+
<p>The other route, <code>dropbox/auth_callback</code>, will process the authentication token
|
81
|
+
that we'll receive from Dropbox. Steps 4 & 5.</p>
|
82
|
+
|
83
|
+
<h2>2. Set up a Dropbox controller</h2>
|
84
|
+
|
85
|
+
<pre class="code ruby"><code class="ruby"><span class='kw'>class</span> <span class='const'>DropboxController</span> <span class='op'><</span> <span class='const'>ApplicationController</span>
|
86
|
+
<span class='comment'># Example call:
|
87
|
+
</span> <span class='comment'># GET /dropbox/auth
|
88
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_auth'>auth</span>
|
89
|
+
<span class='id identifier rubyid_url'>url</span> <span class='op'>=</span> <span class='id identifier rubyid_authenticator'>authenticator</span><span class='period'>.</span><span class='id identifier rubyid_authorize_url'>authorize_url</span> <span class='symbol'>:redirect_uri</span> <span class='op'>=></span> <span class='id identifier rubyid_redirect_uri'>redirect_uri</span>
|
90
|
+
|
91
|
+
<span class='id identifier rubyid_redirect_to'>redirect_to</span> <span class='id identifier rubyid_url'>url</span>
|
92
|
+
<span class='kw'>end</span>
|
93
|
+
|
94
|
+
<span class='comment'># Example call:
|
95
|
+
</span> <span class='comment'># GET /dropbox/auth_callback?code=VofXAX8DO1sAAAAAAAACUKBwkDZyMg1zKT0f_FNONeA
|
96
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_auth_callback'>auth_callback</span>
|
97
|
+
<span class='id identifier rubyid_auth_bearer'>auth_bearer</span> <span class='op'>=</span> <span class='id identifier rubyid_authenticator'>authenticator</span><span class='period'>.</span><span class='id identifier rubyid_get_token'>get_token</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='symbol'>:code</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
98
|
+
<span class='symbol'>:redirect_uri</span> <span class='op'>=></span> <span class='id identifier rubyid_redirect_uri'>redirect_uri</span><span class='rparen'>)</span>
|
99
|
+
<span class='id identifier rubyid_token'>token</span> <span class='op'>=</span> <span class='id identifier rubyid_auth_bearer'>auth_bearer</span><span class='period'>.</span><span class='id identifier rubyid_token'>token</span> <span class='comment'># This line is step 5 in the diagram.
|
100
|
+
</span>
|
101
|
+
<span class='comment'># At this stage you may want to persist the reusable token we've acquired.
|
102
|
+
</span> <span class='comment'># Remember that it's bound to the Dropbox account of your user.
|
103
|
+
</span>
|
104
|
+
<span class='comment'># If you persist this token, you can use it in subsequent requests or
|
105
|
+
</span> <span class='comment'># background jobs to perform calls to Dropbox API such as the following.
|
106
|
+
</span> <span class='id identifier rubyid_folders'>folders</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="DropboxApi.html" title="DropboxApi (module)">DropboxApi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="DropboxApi/Client.html" title="DropboxApi::Client (class)">Client</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="DropboxApi/Client.html#initialize-instance_method" title="DropboxApi::Client#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_token'>token</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_list_folder'><span class='object_link'><a href="DropboxApi/Client.html#list_folder-instance_method" title="DropboxApi::Client#list_folder (method)">list_folder</a></span></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/</span><span class='tstring_end'>"</span></span>
|
107
|
+
<span class='kw'>end</span>
|
108
|
+
|
109
|
+
<span class='id identifier rubyid_private'>private</span>
|
110
|
+
|
111
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_authenticator'>authenticator</span>
|
112
|
+
<span class='id identifier rubyid_client_id'>client_id</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>az8ykn83kecoodq</span><span class='tstring_end'>"</span></span>
|
113
|
+
<span class='id identifier rubyid_client_secret'>client_secret</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>ozp1pxo8e563fc5</span><span class='tstring_end'>"</span></span>
|
114
|
+
|
115
|
+
<span class='const'><span class='object_link'><a href="DropboxApi.html" title="DropboxApi (module)">DropboxApi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="DropboxApi/Authenticator.html" title="DropboxApi::Authenticator (class)">Authenticator</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="DropboxApi/Authenticator.html#initialize-instance_method" title="DropboxApi::Authenticator#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_client_id'>client_id</span><span class='comma'>,</span> <span class='id identifier rubyid_client_secret'>client_secret</span><span class='rparen'>)</span>
|
116
|
+
<span class='kw'>end</span>
|
117
|
+
|
118
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_redirect_uri'>redirect_uri</span>
|
119
|
+
<span class='id identifier rubyid_dropbox_auth_callback_url'>dropbox_auth_callback_url</span> <span class='comment'># => http://localhost:3000/dropbox/auth_callback
|
120
|
+
</span> <span class='kw'>end</span>
|
121
|
+
<span class='kw'>end</span>
|
122
|
+
</code></pre>
|
123
|
+
|
124
|
+
<h2>3. Set up redirect URI in your Dropbox app settings</h2>
|
125
|
+
|
126
|
+
<p>In the previous code, you probably noticed that we're providing a <code>redirect_uri</code>
|
127
|
+
parameter. This is where the user will be redirected to after accepting our
|
128
|
+
application.</p>
|
129
|
+
|
130
|
+
<p>However, Dropbox will only redirect to a set of whitelisted URIs, so
|
131
|
+
you'll need to add yours to the list. That's very easy:</p>
|
132
|
+
|
133
|
+
<ol>
|
134
|
+
<li>Log in to your Dropbox developer account at
|
135
|
+
<a href="https://www.dropbox.com/developers">www.dropbox.com/developers</a>.</li>
|
136
|
+
<li>On the menu, click on "My Apps". Then click on your application to edit its
|
137
|
+
settings.</li>
|
138
|
+
<li>On the OAuth 2 section, add the redirect URI that maps to the
|
139
|
+
<code>auth_callback</code> method that we've implemented above. For example,
|
140
|
+
<code>www.yourapp.com/dropbox/oauth_callback</code>.</li>
|
141
|
+
</ol>
|
142
|
+
</div></div>
|
143
|
+
|
144
|
+
<div id="footer">
|
145
|
+
Generated on Mon Nov 12 20:42:55 2018 by
|
146
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
147
|
+
0.9.15 (ruby-2.3.3).
|
148
|
+
</div>
|
149
|
+
|
150
|
+
</div>
|
151
|
+
</body>
|
152
|
+
</html>
|
data/docs/file_list.html
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
5
|
+
<meta charset="utf-8" />
|
6
|
+
|
7
|
+
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
+
|
9
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
|
16
|
+
|
17
|
+
|
18
|
+
<title>File List</title>
|
19
|
+
<base id="base_target" target="_parent" />
|
20
|
+
</head>
|
21
|
+
<body>
|
22
|
+
<div id="content">
|
23
|
+
<div class="fixed_header">
|
24
|
+
<h1 id="full_list_header">File List</h1>
|
25
|
+
<div id="full_list_nav">
|
26
|
+
|
27
|
+
<span><a target="_self" href="class_list.html">
|
28
|
+
Classes
|
29
|
+
</a></span>
|
30
|
+
|
31
|
+
<span><a target="_self" href="method_list.html">
|
32
|
+
Methods
|
33
|
+
</a></span>
|
34
|
+
|
35
|
+
<span><a target="_self" href="file_list.html">
|
36
|
+
Files
|
37
|
+
</a></span>
|
38
|
+
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search">Search: <input type="text" /></div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<ul id="full_list" class="file">
|
45
|
+
|
46
|
+
|
47
|
+
<li id="object_README" class="odd">
|
48
|
+
<div class="item"><span class="object_link"><a href="index.html" title="README">README</a></span></div>
|
49
|
+
</li>
|
50
|
+
|
51
|
+
|
52
|
+
<li id="object_api_coverage" class="even">
|
53
|
+
<div class="item"><span class="object_link"><a href="file.api_coverage.html" title="API Implementation Coverage">API Implementation Coverage</a></span></div>
|
54
|
+
</li>
|
55
|
+
|
56
|
+
|
57
|
+
<li id="object_rails_setup" class="odd">
|
58
|
+
<div class="item"><span class="object_link"><a href="file.rails_setup.html" title="Rails setup">Rails setup</a></span></div>
|
59
|
+
</li>
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</ul>
|
64
|
+
</div>
|
65
|
+
</body>
|
66
|
+
</html>
|
data/docs/frames.html
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>Documentation by YARD 0.9.15</title>
|
6
|
+
</head>
|
7
|
+
<script type="text/javascript" charset="utf-8">
|
8
|
+
var match = unescape(window.location.hash).match(/^#!(.+)/);
|
9
|
+
var name = match ? match[1] : 'index.html';
|
10
|
+
name = name.replace(/^(\w+):\/\//, '').replace(/^\/\//, '');
|
11
|
+
window.top.location = name;
|
12
|
+
</script>
|
13
|
+
<noscript>
|
14
|
+
<h1>Oops!</h1>
|
15
|
+
<h2>YARD requires JavaScript!</h2>
|
16
|
+
</noscript>
|
17
|
+
</html>
|
data/docs/index.html
ADDED
@@ -0,0 +1,257 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
File: README
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.15
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "README";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index</a> »
|
40
|
+
<span class="title">File: README</span>
|
41
|
+
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div id="search">
|
45
|
+
|
46
|
+
<a class="full_list_link" id="class_list_link"
|
47
|
+
href="class_list.html">
|
48
|
+
|
49
|
+
<svg width="24" height="24">
|
50
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
</svg>
|
54
|
+
</a>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
<div class="clear"></div>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div id="content"><div id='filecontents'><h1>DropboxApi</h1>
|
61
|
+
|
62
|
+
<p>Library for communicating with Dropbox API v2.</p>
|
63
|
+
|
64
|
+
<h2>Installation</h2>
|
65
|
+
|
66
|
+
<p>Add this line to your application's Gemfile:</p>
|
67
|
+
|
68
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>dropbox_api</span><span class='tstring_end'>'</span></span>
|
69
|
+
</code></pre>
|
70
|
+
|
71
|
+
<p>And then execute:</p>
|
72
|
+
|
73
|
+
<pre class="code ruby"><code class="ruby">$ bundle
|
74
|
+
</code></pre>
|
75
|
+
|
76
|
+
<p>Or install it yourself as:</p>
|
77
|
+
|
78
|
+
<pre class="code ruby"><code class="ruby">$ gem install dropbox_api
|
79
|
+
</code></pre>
|
80
|
+
|
81
|
+
<h2>Documentation</h2>
|
82
|
+
|
83
|
+
<p>Please, refer to this gem's custom <a href="http://jesus.github.io/dropbox_api">Dropbox API
|
84
|
+
documentation</a>.
|
85
|
+
Most of the time you'll be checking the <a href="http://jesus.github.io/dropbox_api/DropboxApi/Client.html">available
|
86
|
+
endpoints</a>.</p>
|
87
|
+
|
88
|
+
<p>Unfortunately, the documentation at <a href="http://www.rubydoc.info">RubyDoc.info</a> is
|
89
|
+
disrecommended because it lacks some nice features that have been added with
|
90
|
+
YARD plugins:</p>
|
91
|
+
|
92
|
+
<ul>
|
93
|
+
<li>Each endpoint includes its tests right below the description, this works as
|
94
|
+
an example of its usage.</li>
|
95
|
+
<li>All endpoints are shown as methods of the <code>Client</code> class, just as you will
|
96
|
+
use them.</li>
|
97
|
+
</ul>
|
98
|
+
|
99
|
+
<h2>Basic set up</h2>
|
100
|
+
|
101
|
+
<h3>Authorize your application</h3>
|
102
|
+
|
103
|
+
<p>Dropbox uses OAuth, in order to use this library from your application you'll
|
104
|
+
have to get an authorization code.</p>
|
105
|
+
|
106
|
+
<p>Once you have it, just pass it on client initialization:</p>
|
107
|
+
|
108
|
+
<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="DropboxApi.html" title="DropboxApi (module)">DropboxApi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="DropboxApi/Client.html" title="DropboxApi::Client (class)">Client</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="DropboxApi/Client.html#initialize-instance_method" title="DropboxApi::Client#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>VofXAX8D...</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
109
|
+
<span class='comment'>#=> #<DropboxApi::Client ...>
|
110
|
+
</span></code></pre>
|
111
|
+
|
112
|
+
<p>Or set it as an ENV variable called <code>DROPBOX_OAUTH_BEARER</code>, for example:</p>
|
113
|
+
|
114
|
+
<pre class="code ruby"><code class="ruby"><span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>DROPBOX_OAUTH_BEARER</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>VofXAX8D...</span><span class='tstring_end'>"</span></span>
|
115
|
+
<span class='const'><span class='object_link'><a href="DropboxApi.html" title="DropboxApi (module)">DropboxApi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="DropboxApi/Client.html" title="DropboxApi::Client (class)">Client</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="DropboxApi/Client.html#initialize-instance_method" title="DropboxApi::Client#initialize (method)">new</a></span></span>
|
116
|
+
<span class='comment'>#=> #<DropboxApi::Client ...>
|
117
|
+
</span></code></pre>
|
118
|
+
|
119
|
+
<p>Note that setting an ENV variable is only a feasible choice if you're only
|
120
|
+
using one account.</p>
|
121
|
+
|
122
|
+
<h4>Option A: Get your access token from the website</h4>
|
123
|
+
|
124
|
+
<p>The easiest way to obtain an access token is to get it from the Dropbox website.
|
125
|
+
You just need to log in to Dropbox and refer to the <em>developers</em> section, go to
|
126
|
+
<em>My apps</em> and select your application, you may need to create one if you
|
127
|
+
haven't done so yet.</p>
|
128
|
+
|
129
|
+
<p>Under your application settings, find section <em>OAuth 2</em>. You'll find a button
|
130
|
+
to generate an access token.</p>
|
131
|
+
|
132
|
+
<h4>Option B: Use <code>DropboxApi::Authenticator</code></h4>
|
133
|
+
|
134
|
+
<p>You can obtain an authorization code with this library:</p>
|
135
|
+
|
136
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_authenticator'>authenticator</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="DropboxApi.html" title="DropboxApi (module)">DropboxApi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="DropboxApi/Authenticator.html" title="DropboxApi::Authenticator (class)">Authenticator</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="DropboxApi/Authenticator.html#initialize-instance_method" title="DropboxApi::Authenticator#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='const'>CLIENT_ID</span><span class='comma'>,</span> <span class='const'>CLIENT_SECRET</span><span class='rparen'>)</span>
|
137
|
+
<span class='id identifier rubyid_authenticator'>authenticator</span><span class='period'>.</span><span class='id identifier rubyid_authorize_url'>authorize_url</span> <span class='comment'>#=> "https://www.dropbox.com/..."
|
138
|
+
</span>
|
139
|
+
<span class='comment'># Now you need to open the authorization URL in your browser,
|
140
|
+
</span><span class='comment'># authorize the application and copy your code.
|
141
|
+
</span>
|
142
|
+
<span class='id identifier rubyid_auth_bearer'>auth_bearer</span> <span class='op'>=</span> <span class='id identifier rubyid_authenticator'>authenticator</span><span class='period'>.</span><span class='id identifier rubyid_get_token'>get_token</span><span class='lparen'>(</span><span class='const'>CODE</span><span class='rparen'>)</span> <span class='comment'>#=> #<OAuth2::AccessToken ...>`
|
143
|
+
</span><span class='id identifier rubyid_auth_bearer'>auth_bearer</span><span class='period'>.</span><span class='id identifier rubyid_token'>token</span> <span class='comment'>#=> "VofXAX8D..."
|
144
|
+
</span><span class='comment'># Keep this token, you'll need it to initialize a `DropboxApi::Client` object
|
145
|
+
</span></code></pre>
|
146
|
+
|
147
|
+
<h4>Standard OAuth 2 flow</h4>
|
148
|
+
|
149
|
+
<p>This is what many web applications will use. The process is described in
|
150
|
+
Dropbox's <a href="https://www.dropbox.com/developers/reference/oauth-guide#oauth-2-on-the-web">OAuth guide</a>.</p>
|
151
|
+
|
152
|
+
<p>If you have a Rails application, you might be interested in this <a href="http://jesus.github.io/dropbox_api/file.rails_setup.html">setup
|
153
|
+
guide</a>.</p>
|
154
|
+
|
155
|
+
<h3>Performing API calls</h3>
|
156
|
+
|
157
|
+
<p>Once you've initialized a client, for example:</p>
|
158
|
+
|
159
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_client'>client</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="DropboxApi.html" title="DropboxApi (module)">DropboxApi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="DropboxApi/Client.html" title="DropboxApi::Client (class)">Client</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="DropboxApi/Client.html#initialize-instance_method" title="DropboxApi::Client#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>VofXAX8D...</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
160
|
+
<span class='comment'>#=> #<DropboxApi::Client ...>
|
161
|
+
</span></code></pre>
|
162
|
+
|
163
|
+
<p>You can perform an API call like this:</p>
|
164
|
+
|
165
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_list_folder'>list_folder</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/sample_folder</span><span class='tstring_end'>"</span></span>
|
166
|
+
<span class='comment'>#=> #<DropboxApi::Results::ListFolderResult>
|
167
|
+
</span><span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_entries'>entries</span>
|
168
|
+
<span class='comment'>#=> [#<DropboxApi::Metadata::Folder>, #<DropboxApi::Metadata::File>]
|
169
|
+
</span><span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_has_more?'>has_more?</span>
|
170
|
+
<span class='comment'>#=> false
|
171
|
+
</span></code></pre>
|
172
|
+
|
173
|
+
<p>The instance of <code>Client</code> we've initialized is the one you'll be using to
|
174
|
+
perform API calls. You can check the class' documentation to find
|
175
|
+
<a href="http://jesus.github.io/dropbox_api/DropboxApi/Client.html">all available endpoints</a>.</p>
|
176
|
+
|
177
|
+
<h3>Large file uploads</h3>
|
178
|
+
|
179
|
+
<p>If you need to upload files larger than 150MB the default <code>#upload</code> endpoint
|
180
|
+
won't work. Instead, you need to start a upload session and upload
|
181
|
+
the file in small chunks.</p>
|
182
|
+
|
183
|
+
<p>To make this easier, the method <code>upload_by_chunks</code> will handle this for you,
|
184
|
+
example:</p>
|
185
|
+
|
186
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_client'>client</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="DropboxApi.html" title="DropboxApi (module)">DropboxApi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="DropboxApi/Client.html" title="DropboxApi::Client (class)">Client</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="DropboxApi/Client.html#initialize-instance_method" title="DropboxApi::Client#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>VofXAX8D...</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
187
|
+
<span class='comment'>#=> #<DropboxApi::Client ...>
|
188
|
+
</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>large_file.avi</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span>
|
189
|
+
<span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_upload_by_chunks'>upload_by_chunks</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/remote_path.txt</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_f'>f</span>
|
190
|
+
<span class='kw'>end</span>
|
191
|
+
</code></pre>
|
192
|
+
|
193
|
+
<p>Check out the
|
194
|
+
<a href="http://www.xuuso.com/dropbox_api/DropboxApi/Client.html#upload_by_chunks-instance_method">method documentation</a>
|
195
|
+
to find out all available options.</p>
|
196
|
+
|
197
|
+
<h2>Dependencies</h2>
|
198
|
+
|
199
|
+
<p>This gem depends on
|
200
|
+
<a href="https://github.com/oauth-xx/oauth2">oauth2</a>
|
201
|
+
and
|
202
|
+
<a href="https://github.com/lostisland/faraday">faraday</a>.</p>
|
203
|
+
|
204
|
+
<p>It has official support for Ruby versions <code>1.9.x</code> and <code>2.x</code>.</p>
|
205
|
+
|
206
|
+
<h2>Development</h2>
|
207
|
+
|
208
|
+
<p>After checking out the repo, run <code>bin/setup</code> to install dependencies. Then, run
|
209
|
+
<code>bin/console</code> for an interactive prompt that will allow you to experiment.</p>
|
210
|
+
|
211
|
+
<h3>Testing</h3>
|
212
|
+
|
213
|
+
<p>I recommend you to use a test account other than your main one.</p>
|
214
|
+
|
215
|
+
<p>We use VCR to record the HTTP calls to Dropbox, however we sometimes need to
|
216
|
+
regenerate the cassettes. Let's take <code>list_folder</code> as an example to show what
|
217
|
+
would be the procedure to do so:</p>
|
218
|
+
|
219
|
+
<ol>
|
220
|
+
<li><p>Manually delete the existing cassettes in
|
221
|
+
<code>spec/fixtures/vcr_cassettes/list_folder/*.yml</code>.</p></li>
|
222
|
+
<li><p>Run the task to build the scaffolding in your Dropbox account so the tests
|
223
|
+
will pass. If it doesn't exist you may need to write it yourself, check
|
224
|
+
the <code>DropboxScaffoldBuilder</code> class to find all existing scaffold builders.</p>
|
225
|
+
|
226
|
+
<pre class="code text"><code class="text">DROPBOX_OAUTH_BEARER=YOUR_AUTH_BEARER rake test:build_scaffold[list_folder]
|
227
|
+
</code></pre></li>
|
228
|
+
<li><p>Run the tests and the cassettes will be written:</p>
|
229
|
+
|
230
|
+
<pre class="code text"><code class="text">DROPBOX_OAUTH_BEARER=YOUR_AUTH_BEARER rspec spec/endpoints/files/list_folder_spec.rb
|
231
|
+
</code></pre></li>
|
232
|
+
</ol>
|
233
|
+
|
234
|
+
<p>The OAuth bearer shouldn't have been recorded in the cassette and it should've
|
235
|
+
been filtered. However, you may want to double check before pushing your
|
236
|
+
updates to Github.</p>
|
237
|
+
|
238
|
+
<p>Tip: You can simply run <code>export DROPBOX_OAUTH_BEARER=YOUR_AUTH_BEARER</code> at
|
239
|
+
the beginning of your work session so you don't need to prefix it in every
|
240
|
+
command line.</p>
|
241
|
+
|
242
|
+
<h2>Contributing</h2>
|
243
|
+
|
244
|
+
<p>Any help will be much appreciated. The easiest way to help is to implement one
|
245
|
+
or more of the <a href="http://jesus.github.io/dropbox_api/file.api_coverage.html">endpoints that are still pending</a>. To see how the
|
246
|
+
endpoints are implemented, check out the <code>lib/dropbox_api/endpoints</code> folder.</p>
|
247
|
+
</div></div>
|
248
|
+
|
249
|
+
<div id="footer">
|
250
|
+
Generated on Mon Nov 12 20:42:54 2018 by
|
251
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
252
|
+
0.9.15 (ruby-2.3.3).
|
253
|
+
</div>
|
254
|
+
|
255
|
+
</div>
|
256
|
+
</body>
|
257
|
+
</html>
|