dropbox_api 0.1.20 → 0.1.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (297) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +20 -0
  3. data/TODO.md +8 -0
  4. data/docs/DropboxApi/Authenticator.html +8 -14
  5. data/docs/DropboxApi/ChunkedUploader.html +2 -2
  6. data/docs/DropboxApi/Client.html +344 -16
  7. data/docs/DropboxApi/ConnectionBuilder.html +259 -24
  8. data/docs/DropboxApi/Endpoints/Auth/TokenRevoke.html +5 -5
  9. data/docs/DropboxApi/Endpoints/Auth.html +2 -2
  10. data/docs/DropboxApi/Endpoints/Base.html +88 -7
  11. data/docs/DropboxApi/Endpoints/ContentDownload.html +22 -33
  12. data/docs/DropboxApi/Endpoints/ContentUpload.html +22 -33
  13. data/docs/DropboxApi/Endpoints/Files/Copy.html +5 -5
  14. data/docs/DropboxApi/Endpoints/Files/CopyBatch.html +5 -5
  15. data/docs/DropboxApi/Endpoints/Files/CopyBatchCheck.html +5 -5
  16. data/docs/DropboxApi/Endpoints/Files/CopyReferenceGet.html +5 -5
  17. data/docs/DropboxApi/Endpoints/Files/CopyReferenceSave.html +5 -5
  18. data/docs/DropboxApi/Endpoints/Files/CreateFileRequest.html +5 -5
  19. data/docs/DropboxApi/Endpoints/Files/CreateFolder.html +5 -5
  20. data/docs/DropboxApi/Endpoints/Files/CreateFolderBatch.html +5 -5
  21. data/docs/DropboxApi/Endpoints/Files/CreateFolderBatchCheck.html +5 -5
  22. data/docs/DropboxApi/Endpoints/Files/Delete.html +5 -5
  23. data/docs/DropboxApi/Endpoints/Files/DeleteBatch.html +5 -5
  24. data/docs/DropboxApi/Endpoints/Files/DeleteBatchCheck.html +5 -5
  25. data/docs/DropboxApi/Endpoints/Files/Download.html +5 -5
  26. data/docs/DropboxApi/Endpoints/Files/GetMetadata.html +5 -5
  27. data/docs/DropboxApi/Endpoints/Files/GetPreview.html +5 -5
  28. data/docs/DropboxApi/Endpoints/Files/GetTemporaryLink.html +5 -5
  29. data/docs/DropboxApi/Endpoints/Files/GetThumbnail.html +5 -5
  30. data/docs/DropboxApi/Endpoints/Files/GetThumbnailBatch.html +6 -6
  31. data/docs/DropboxApi/Endpoints/Files/ListFolder.html +5 -5
  32. data/docs/DropboxApi/Endpoints/Files/ListFolderContinue.html +5 -5
  33. data/docs/DropboxApi/Endpoints/Files/ListFolderGetLatestCursor.html +5 -5
  34. data/docs/DropboxApi/Endpoints/Files/ListFolderLongpoll.html +6 -6
  35. data/docs/DropboxApi/Endpoints/Files/ListRevisions.html +5 -5
  36. data/docs/DropboxApi/Endpoints/Files/Move.html +5 -5
  37. data/docs/DropboxApi/Endpoints/Files/PermanentlyDelete.html +5 -5
  38. data/docs/DropboxApi/Endpoints/Files/Restore.html +5 -5
  39. data/docs/DropboxApi/Endpoints/Files/SaveUrl.html +5 -5
  40. data/docs/DropboxApi/Endpoints/Files/SaveUrlCheckJobStatus.html +5 -5
  41. data/docs/DropboxApi/Endpoints/Files/Search.html +5 -5
  42. data/docs/DropboxApi/Endpoints/Files/SearchContinue.html +300 -0
  43. data/docs/DropboxApi/Endpoints/Files/Upload.html +5 -5
  44. data/docs/DropboxApi/Endpoints/Files/UploadSessionAppendV2.html +5 -5
  45. data/docs/DropboxApi/Endpoints/Files/UploadSessionFinish.html +5 -5
  46. data/docs/DropboxApi/Endpoints/Files/UploadSessionStart.html +5 -5
  47. data/docs/DropboxApi/Endpoints/Files.html +4 -4
  48. data/docs/DropboxApi/Endpoints/Rpc.html +23 -34
  49. data/docs/DropboxApi/Endpoints/RpcContent.html +21 -26
  50. data/docs/DropboxApi/Endpoints/RpcNotify.html +21 -26
  51. data/docs/DropboxApi/Endpoints/Sharing/AddFileMember.html +5 -5
  52. data/docs/DropboxApi/Endpoints/Sharing/AddFolderMember.html +5 -5
  53. data/docs/DropboxApi/Endpoints/Sharing/CreateSharedLinkWithSettings.html +5 -5
  54. data/docs/DropboxApi/Endpoints/Sharing/GetSharedLinkMetadata.html +5 -5
  55. data/docs/DropboxApi/Endpoints/Sharing/ListFileMembers.html +5 -5
  56. data/docs/DropboxApi/Endpoints/Sharing/ListFolderMembers.html +5 -5
  57. data/docs/DropboxApi/Endpoints/Sharing/ListSharedLinks.html +5 -5
  58. data/docs/DropboxApi/Endpoints/Sharing/RevokeSharedLink.html +5 -5
  59. data/docs/DropboxApi/Endpoints/Sharing/ShareFolder.html +5 -5
  60. data/docs/DropboxApi/Endpoints/Sharing/UnshareFile.html +5 -5
  61. data/docs/DropboxApi/Endpoints/Sharing.html +2 -2
  62. data/docs/DropboxApi/Endpoints/Users/GetAccount.html +5 -5
  63. data/docs/DropboxApi/Endpoints/Users/GetAccountBatch.html +5 -5
  64. data/docs/DropboxApi/Endpoints/Users/GetCurrentAccount.html +5 -5
  65. data/docs/DropboxApi/Endpoints/Users/GetSpaceUsage.html +5 -5
  66. data/docs/DropboxApi/Endpoints/Users.html +2 -2
  67. data/docs/DropboxApi/Endpoints.html +2 -2
  68. data/docs/DropboxApi/Errors/AddFileMemberError.html +2 -2
  69. data/docs/DropboxApi/Errors/AddFolderMemberError.html +2 -2
  70. data/docs/DropboxApi/Errors/AddMemberSelectorError.html +2 -2
  71. data/docs/DropboxApi/Errors/AlreadySharedError.html +2 -2
  72. data/docs/DropboxApi/Errors/BadPathError.html +2 -2
  73. data/docs/DropboxApi/Errors/BasicError.html +3 -3
  74. data/docs/DropboxApi/Errors/CantCopySharedFolderError.html +2 -2
  75. data/docs/DropboxApi/Errors/CantMoveFolderIntoItselfError.html +2 -2
  76. data/docs/DropboxApi/Errors/CantNestSharedFolderError.html +2 -2
  77. data/docs/DropboxApi/Errors/CantShareOutsideTeamError.html +2 -2
  78. data/docs/DropboxApi/Errors/ContainsSharedFolderError.html +2 -2
  79. data/docs/DropboxApi/Errors/ConversionError.html +2 -2
  80. data/docs/DropboxApi/Errors/CreateFileRequestError.html +2 -2
  81. data/docs/DropboxApi/Errors/CreateFolderBatchError.html +2 -2
  82. data/docs/DropboxApi/Errors/CreateFolderError.html +2 -2
  83. data/docs/DropboxApi/Errors/CreateSharedLinkWithSettingsError.html +2 -2
  84. data/docs/DropboxApi/Errors/CursorClosedError.html +2 -2
  85. data/docs/DropboxApi/Errors/CursorNotClosedError.html +2 -2
  86. data/docs/DropboxApi/Errors/DeleteError.html +2 -2
  87. data/docs/DropboxApi/Errors/DisallowedNameError.html +2 -2
  88. data/docs/DropboxApi/Errors/DisallowedSharedLinkPolicyError.html +2 -2
  89. data/docs/DropboxApi/Errors/DownloadError.html +2 -2
  90. data/docs/DropboxApi/Errors/DownloadFailedError.html +2 -2
  91. data/docs/DropboxApi/Errors/EmailUnverifiedError.html +2 -2
  92. data/docs/DropboxApi/Errors/ExpiredAccessTokenError.html +143 -0
  93. data/docs/DropboxApi/Errors/FileAncestorConflictError.html +2 -2
  94. data/docs/DropboxApi/Errors/FileConflictError.html +2 -2
  95. data/docs/DropboxApi/Errors/FileMemberActionError.html +2 -2
  96. data/docs/DropboxApi/Errors/FolderConflictError.html +2 -2
  97. data/docs/DropboxApi/Errors/GetAccountError.html +2 -2
  98. data/docs/DropboxApi/Errors/GetCopyReferenceError.html +2 -2
  99. data/docs/DropboxApi/Errors/GetMetadataError.html +2 -2
  100. data/docs/DropboxApi/Errors/GroupDeletedError.html +2 -2
  101. data/docs/DropboxApi/Errors/GroupNotOnTeamError.html +2 -2
  102. data/docs/DropboxApi/Errors/HttpError.html +2 -2
  103. data/docs/DropboxApi/Errors/InProgressError.html +2 -2
  104. data/docs/DropboxApi/Errors/InsideAppFolderError.html +2 -2
  105. data/docs/DropboxApi/Errors/InsideOsxPackageError.html +2 -2
  106. data/docs/DropboxApi/Errors/InsidePublicFolderError.html +2 -2
  107. data/docs/DropboxApi/Errors/InsideSharedFolderError.html +2 -2
  108. data/docs/DropboxApi/Errors/InsufficientPlanError.html +2 -2
  109. data/docs/DropboxApi/Errors/InsufficientSpaceError.html +2 -2
  110. data/docs/DropboxApi/Errors/InternalError.html +2 -2
  111. data/docs/DropboxApi/Errors/InvalidCommentError.html +2 -2
  112. data/docs/DropboxApi/Errors/InvalidCopyReferenceError.html +2 -2
  113. data/docs/DropboxApi/Errors/InvalidCursorError.html +2 -2
  114. data/docs/DropboxApi/Errors/InvalidDropboxIdError.html +2 -2
  115. data/docs/DropboxApi/Errors/InvalidEmailError.html +2 -2
  116. data/docs/DropboxApi/Errors/InvalidFileError.html +2 -2
  117. data/docs/DropboxApi/Errors/InvalidIdError.html +2 -2
  118. data/docs/DropboxApi/Errors/InvalidMemberError.html +2 -2
  119. data/docs/DropboxApi/Errors/InvalidPathError.html +2 -2
  120. data/docs/DropboxApi/Errors/InvalidRevisionError.html +2 -2
  121. data/docs/DropboxApi/Errors/InvalidSettingsError.html +2 -2
  122. data/docs/DropboxApi/Errors/InvalidUrlError.html +2 -2
  123. data/docs/DropboxApi/Errors/IsAppFolderError.html +2 -2
  124. data/docs/DropboxApi/Errors/IsFileError.html +2 -2
  125. data/docs/DropboxApi/Errors/IsFolderError.html +2 -2
  126. data/docs/DropboxApi/Errors/IsOsxPackageError.html +2 -2
  127. data/docs/DropboxApi/Errors/IsPublicFolderError.html +2 -2
  128. data/docs/DropboxApi/Errors/ListFolderContinueError.html +2 -2
  129. data/docs/DropboxApi/Errors/ListFolderError.html +2 -2
  130. data/docs/DropboxApi/Errors/ListFolderLongpollError.html +2 -2
  131. data/docs/DropboxApi/Errors/ListRevisionsError.html +2 -2
  132. data/docs/DropboxApi/Errors/ListSharedLinksError.html +2 -2
  133. data/docs/DropboxApi/Errors/LookupError.html +2 -2
  134. data/docs/DropboxApi/Errors/MalformedPathError.html +2 -2
  135. data/docs/DropboxApi/Errors/NoAccountError.html +2 -2
  136. data/docs/DropboxApi/Errors/NoPermissionError.html +2 -2
  137. data/docs/DropboxApi/Errors/NoWritePermissionError.html +2 -2
  138. data/docs/DropboxApi/Errors/NotAMemberError.html +2 -2
  139. data/docs/DropboxApi/Errors/NotFileError.html +2 -2
  140. data/docs/DropboxApi/Errors/NotFolderError.html +2 -2
  141. data/docs/DropboxApi/Errors/NotFoundError.html +2 -2
  142. data/docs/DropboxApi/Errors/PollError.html +2 -2
  143. data/docs/DropboxApi/Errors/PreviewError.html +2 -2
  144. data/docs/DropboxApi/Errors/RateLimitError.html +2 -2
  145. data/docs/DropboxApi/Errors/RelocationBatchEntryError.html +2 -2
  146. data/docs/DropboxApi/Errors/RelocationError.html +2 -2
  147. data/docs/DropboxApi/Errors/RestoreError.html +2 -2
  148. data/docs/DropboxApi/Errors/RestrictedContentError.html +2 -2
  149. data/docs/DropboxApi/Errors/RevokeSharedLinkError.html +2 -2
  150. data/docs/DropboxApi/Errors/SaveCopyReferenceError.html +2 -2
  151. data/docs/DropboxApi/Errors/SaveUrlError.html +2 -2
  152. data/docs/DropboxApi/Errors/SearchError.html +2 -2
  153. data/docs/DropboxApi/Errors/SettingsError.html +2 -2
  154. data/docs/DropboxApi/Errors/ShareFolderError.html +2 -2
  155. data/docs/DropboxApi/Errors/SharePathError.html +2 -2
  156. data/docs/DropboxApi/Errors/SharedFolderAccessError.html +2 -2
  157. data/docs/DropboxApi/Errors/SharedLinkAccessDeniedError.html +2 -2
  158. data/docs/DropboxApi/Errors/SharedLinkAlreadyExistsError.html +2 -2
  159. data/docs/DropboxApi/Errors/SharedLinkError.html +2 -2
  160. data/docs/DropboxApi/Errors/SharedLinkMalformedError.html +2 -2
  161. data/docs/DropboxApi/Errors/SharedLinkNotFoundError.html +2 -2
  162. data/docs/DropboxApi/Errors/SharingFileAccessError.html +2 -2
  163. data/docs/DropboxApi/Errors/SharingUserError.html +2 -2
  164. data/docs/DropboxApi/Errors/TeamFolderError.html +2 -2
  165. data/docs/DropboxApi/Errors/TeamPolicyDisallowsMemberPolicyError.html +2 -2
  166. data/docs/DropboxApi/Errors/ThumbnailBatchError.html +2 -2
  167. data/docs/DropboxApi/Errors/ThumbnailError.html +2 -2
  168. data/docs/DropboxApi/Errors/TooManyFilesError.html +2 -2
  169. data/docs/DropboxApi/Errors/TooManyMembersError.html +2 -2
  170. data/docs/DropboxApi/Errors/TooManyPendingInvitesError.html +2 -2
  171. data/docs/DropboxApi/Errors/TooManyRequestsError.html +2 -2
  172. data/docs/DropboxApi/Errors/TooManySharedFolderTargetsError.html +2 -2
  173. data/docs/DropboxApi/Errors/TooManyWriteOperationsError.html +2 -2
  174. data/docs/DropboxApi/Errors/UnmountedError.html +2 -2
  175. data/docs/DropboxApi/Errors/UnshareFileError.html +2 -2
  176. data/docs/DropboxApi/Errors/UnsupportedContentError.html +2 -2
  177. data/docs/DropboxApi/Errors/UnsupportedExtensionError.html +2 -2
  178. data/docs/DropboxApi/Errors/UnsupportedImageError.html +2 -2
  179. data/docs/DropboxApi/Errors/UnsupportedLinkTypeError.html +2 -2
  180. data/docs/DropboxApi/Errors/UnverifiedDropboxId.html +2 -2
  181. data/docs/DropboxApi/Errors/UploadError.html +2 -2
  182. data/docs/DropboxApi/Errors/UploadSessionFinishError.html +2 -2
  183. data/docs/DropboxApi/Errors/UploadSessionLookupError.html +2 -2
  184. data/docs/DropboxApi/Errors/UploadSessionOffsetError.html +2 -2
  185. data/docs/DropboxApi/Errors/UploadWriteFailedError.html +2 -2
  186. data/docs/DropboxApi/Errors/WriteConflictError.html +2 -2
  187. data/docs/DropboxApi/Errors/WriteError.html +2 -2
  188. data/docs/DropboxApi/Errors.html +4 -4
  189. data/docs/DropboxApi/Metadata/AccessLevel.html +2 -2
  190. data/docs/DropboxApi/Metadata/AddFileMemberResult.html +2 -2
  191. data/docs/DropboxApi/Metadata/AddMember.html +2 -2
  192. data/docs/DropboxApi/Metadata/Base.html +3 -3
  193. data/docs/DropboxApi/Metadata/BasicAccount.html +8 -3
  194. data/docs/DropboxApi/Metadata/CommitInfo.html +2 -2
  195. data/docs/DropboxApi/Metadata/Deleted.html +2 -2
  196. data/docs/DropboxApi/Metadata/Dimensions.html +2 -2
  197. data/docs/DropboxApi/Metadata/Field.html +2 -2
  198. data/docs/DropboxApi/Metadata/File.html +2 -2
  199. data/docs/DropboxApi/Metadata/FileCategoriesList.html +2 -2
  200. data/docs/DropboxApi/Metadata/FileCategory.html +2 -2
  201. data/docs/DropboxApi/Metadata/FileExtensionsList.html +2 -2
  202. data/docs/DropboxApi/Metadata/FileLinkMetadata.html +2 -2
  203. data/docs/DropboxApi/Metadata/FileMemberAction.html +2 -2
  204. data/docs/DropboxApi/Metadata/FileRequest.html +2 -2
  205. data/docs/DropboxApi/Metadata/FileStatus.html +2 -2
  206. data/docs/DropboxApi/Metadata/Folder.html +2 -2
  207. data/docs/DropboxApi/Metadata/FolderLinkMetadata.html +2 -2
  208. data/docs/DropboxApi/Metadata/FolderSharingInfo.html +2 -2
  209. data/docs/DropboxApi/Metadata/LinkPermissions.html +2 -2
  210. data/docs/DropboxApi/Metadata/Location.html +2 -2
  211. data/docs/DropboxApi/Metadata/MediaInfo.html +2 -2
  212. data/docs/DropboxApi/Metadata/MediaMetadata.html +2 -2
  213. data/docs/DropboxApi/Metadata/Member.html +2 -2
  214. data/docs/DropboxApi/Metadata/MemberAction.html +2 -2
  215. data/docs/DropboxApi/Metadata/MemberActionList.html +2 -2
  216. data/docs/DropboxApi/Metadata/MemberPermission.html +2 -2
  217. data/docs/DropboxApi/Metadata/MemberPermissionList.html +2 -2
  218. data/docs/DropboxApi/Metadata/MetadataV2.html +2 -2
  219. data/docs/DropboxApi/Metadata/Name.html +2 -2
  220. data/docs/DropboxApi/Metadata/NamespaceId.html +210 -0
  221. data/docs/DropboxApi/Metadata/ParentFolderAccessInfo.html +2 -2
  222. data/docs/DropboxApi/Metadata/PhotoMetadata.html +2 -2
  223. data/docs/DropboxApi/Metadata/Resource.html +2 -2
  224. data/docs/DropboxApi/Metadata/RootInfo.html +227 -0
  225. data/docs/DropboxApi/Metadata/SearchMatchFieldOptions.html +2 -2
  226. data/docs/DropboxApi/Metadata/SearchMatchTypeV2.html +2 -2
  227. data/docs/DropboxApi/Metadata/SearchMatchV2.html +2 -2
  228. data/docs/DropboxApi/Metadata/SearchOptions.html +2 -2
  229. data/docs/DropboxApi/Metadata/SearchOrderBy.html +2 -2
  230. data/docs/DropboxApi/Metadata/SharedFolder.html +2 -2
  231. data/docs/DropboxApi/Metadata/SharedFolderPolicy.html +2 -2
  232. data/docs/DropboxApi/Metadata/SharedLink.html +2 -2
  233. data/docs/DropboxApi/Metadata/SharedLinkMetadata.html +2 -2
  234. data/docs/DropboxApi/Metadata/SpaceAllocation.html +2 -2
  235. data/docs/DropboxApi/Metadata/SpaceUsage.html +2 -2
  236. data/docs/DropboxApi/Metadata/Tag.html +2 -2
  237. data/docs/DropboxApi/Metadata/Team.html +2 -2
  238. data/docs/DropboxApi/Metadata/TeamMemberInfo.html +2 -2
  239. data/docs/DropboxApi/Metadata/TeamRootInfo.html +140 -0
  240. data/docs/DropboxApi/Metadata/ThumbnailBatchResultData.html +2 -2
  241. data/docs/DropboxApi/Metadata/ThumbnailBatchResultEntry.html +2 -2
  242. data/docs/DropboxApi/Metadata/UploadSessionCursor.html +2 -2
  243. data/docs/DropboxApi/Metadata/UserRootInfo.html +140 -0
  244. data/docs/DropboxApi/Metadata/VideoMetadata.html +2 -2
  245. data/docs/DropboxApi/Metadata/WriteMode.html +2 -2
  246. data/docs/DropboxApi/Metadata.html +4 -4
  247. data/docs/DropboxApi/MiddleWare/DecodeResult.html +2 -2
  248. data/docs/DropboxApi/MiddleWare/PathRoot.html +412 -0
  249. data/docs/DropboxApi/MiddleWare/Stack.html +2 -2
  250. data/docs/DropboxApi/MiddleWare.html +4 -4
  251. data/docs/DropboxApi/OptionsValidator.html +3 -3
  252. data/docs/DropboxApi/ResultBuilder.html +2 -2
  253. data/docs/DropboxApi/Results/AddFileMemberResultList.html +2 -2
  254. data/docs/DropboxApi/Results/Base.html +2 -2
  255. data/docs/DropboxApi/Results/BasicAccountBatch.html +2 -2
  256. data/docs/DropboxApi/Results/CopyBatchResult.html +2 -2
  257. data/docs/DropboxApi/Results/CreateFolderBatchResult.html +2 -2
  258. data/docs/DropboxApi/Results/CreateFolderBatchResultEntry.html +2 -2
  259. data/docs/DropboxApi/Results/DeleteBatchResult.html +2 -2
  260. data/docs/DropboxApi/Results/DeleteBatchResultEntry.html +2 -2
  261. data/docs/DropboxApi/Results/GetCopyReferenceResult.html +2 -2
  262. data/docs/DropboxApi/Results/GetTemporaryLinkResult.html +2 -2
  263. data/docs/DropboxApi/Results/GetThumbnailBatchResult.html +2 -2
  264. data/docs/DropboxApi/Results/ListFolderGetLatestCursorResult.html +2 -2
  265. data/docs/DropboxApi/Results/ListFolderLongpollResult.html +2 -2
  266. data/docs/DropboxApi/Results/ListFolderResult.html +2 -2
  267. data/docs/DropboxApi/Results/ListRevisionsResult.html +2 -2
  268. data/docs/DropboxApi/Results/ListSharedLinksResult.html +2 -2
  269. data/docs/DropboxApi/Results/RelocationBatchResult.html +2 -2
  270. data/docs/DropboxApi/Results/RelocationBatchResultEntry.html +2 -2
  271. data/docs/DropboxApi/Results/SaveCopyReferenceResult.html +2 -2
  272. data/docs/DropboxApi/Results/SaveUrlJobStatus.html +2 -2
  273. data/docs/DropboxApi/Results/SaveUrlResult.html +2 -2
  274. data/docs/DropboxApi/Results/Search/Match.html +2 -2
  275. data/docs/DropboxApi/Results/Search.html +2 -2
  276. data/docs/DropboxApi/Results/SearchV2Result.html +6 -6
  277. data/docs/DropboxApi/Results/ShareFolderLaunch.html +2 -2
  278. data/docs/DropboxApi/Results/SharedFileMembers.html +2 -2
  279. data/docs/DropboxApi/Results/SharedFolderMembers.html +2 -2
  280. data/docs/DropboxApi/Results/UploadSessionStart.html +2 -2
  281. data/docs/DropboxApi/Results/VoidResult.html +2 -2
  282. data/docs/DropboxApi/Results.html +2 -2
  283. data/docs/DropboxApi.html +3 -3
  284. data/docs/DropboxScaffoldBuilder.html +2 -2
  285. data/docs/_index.html +61 -12
  286. data/docs/class_list.html +1 -1
  287. data/docs/file.README.html +110 -24
  288. data/docs/file.api_coverage.html +2 -2
  289. data/docs/file.rails_setup.html +2 -2
  290. data/docs/index.html +110 -24
  291. data/docs/method_list.html +437 -325
  292. data/docs/top-level-namespace.html +2 -2
  293. data/dropbox_api.gemspec +2 -6
  294. data/lib/dropbox_api/connection_builder.rb +1 -1
  295. data/lib/dropbox_api/endpoints/rpc_notify.rb +1 -1
  296. data/lib/dropbox_api/version.rb +1 -1
  297. metadata +15 -78
@@ -116,42 +116,110 @@ have to get an authorization code.</p>
116
116
  <span class='comment'>#=&gt; #&lt;DropboxApi::Client ...&gt;
117
117
  </span></code></pre>
118
118
 
119
- <p>Note that setting an ENV variable is only a feasible choice if you&#39;re only
120
- using one account.</p>
119
+ <p>The official documentation on the process to get an authorization code is
120
+ <a href="https://developers.dropbox.com/es-es/oauth-guide#implementing-oauth">here</a>,
121
+ it describes the two options listed below.</p>
121
122
 
122
123
  <h4 id="option-a-get-your-access-token-from-the-website">Option A: Get your access token from the website</h4>
123
124
 
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&#39;t done so yet.</p>
125
+ <p>For a quick test, you can obtain an access token from the App Console in
126
+ <a href="https://www.dropbox.com/developers/">Dropbox&#39;s website</a>. Select from
127
+ <em>My apps</em> your application, you may need to create one if you
128
+ haven&#39;t done so yet. Under your application settings, find section
129
+ <em>OAuth 2</em>, there is a button to generate an access token.</p>
128
130
 
129
- <p>Under your application settings, find section <em>OAuth 2</em>. You&#39;ll find a button
130
- to generate an access token.</p>
131
+ <h4 id="option-b-oauth2-code-flow">Option B: OAuth2 Code Flow</h4>
131
132
 
132
- <h4 id="option-b-use-dropboxapi-authenticator">Option B: Use <code>DropboxApi::Authenticator</code></h4>
133
+ <p>This is typically what you will use in production, you can obtain an
134
+ authorization code with a 3-step process:</p>
133
135
 
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'>#=&gt; &quot;https://www.dropbox.com/...&quot;
136
+ <pre class="code ruby"><code class="ruby"><span class='comment'># 1. Get an authorization URL.
137
+ </span><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>
138
+ <span class='id identifier rubyid_authenticator'>authenticator</span><span class='period'>.</span><span class='id identifier rubyid_auth_code'>auth_code</span><span class='period'>.</span><span class='id identifier rubyid_authorize_url'>authorize_url</span> <span class='comment'>#=&gt; &quot;https://www.dropbox.com/...&quot;
138
139
  </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.
140
+ <span class='comment'># 2. Log into Dropbox and authorize your app. You need to open the
141
+ </span><span class='comment'># authorization URL in your browser.
141
142
  </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'>#=&gt; #&lt;OAuth2::AccessToken ...&gt;`
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'>#=&gt; &quot;VofXAX8D...&quot;
144
- </span><span class='comment'># Keep this token, you&#39;ll need it to initialize a `DropboxApi::Client` object
145
- </span></code></pre>
143
+ <span class='comment'># 3. Exchange the authorization code for a reusable access token (not visible
144
+ </span><span class='comment'># to the user).
145
+ </span><span class='id identifier rubyid_access_token'>access_token</span> <span class='op'>=</span> <span class='id identifier rubyid_authenticator'>authenticator</span><span class='period'>.</span><span class='id identifier rubyid_auth_code'>auth_code</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'>#=&gt; #&lt;OAuth2::AccessToken ...&gt;`
146
+ </span><span class='id identifier rubyid_access_token'>access_token</span><span class='period'>.</span><span class='id identifier rubyid_token'>token</span> <span class='comment'>#=&gt; &quot;VofXAX8D...&quot;
147
+ </span>
148
+ <span class='comment'># Keep this token, you&#39;ll need it to initialize a `DropboxApi::Client` object:
149
+ </span><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='label'>access_token:</span> <span class='id identifier rubyid_access_token'>access_token</span><span class='rparen'>)</span>
146
150
 
147
- <h4 id="standard-oauth-2-flow">Standard OAuth 2 flow</h4>
151
+ <span class='comment'># For backwards compatibility, the following also works:
152
+ </span><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='id identifier rubyid_access_token'>access_token</span><span class='period'>.</span><span class='id identifier rubyid_token'>token</span><span class='rparen'>)</span>
153
+ </code></pre>
148
154
 
149
- <p>This is what many web applications will use. The process is described in
150
- Dropbox&#39;s <a href="https://www.dropbox.com/developers/reference/oauth-guide#oauth-2-on-the-web">OAuth guide</a>.</p>
155
+ <h5 id="integration-with-rails">Integration with Rails</h5>
151
156
 
152
157
  <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
158
  guide</a>.</p>
154
159
 
160
+ <h5 id="using-refresh-tokens">Using refresh tokens</h5>
161
+
162
+ <p>Access tokens are short-lived by default (as of September 30th, 2021),
163
+ applications that require long-lived access to the API without additional
164
+ interaction with the user should use refresh tokens.</p>
165
+
166
+ <p>The process is similar but a token refresh might seamlessly occur as you
167
+ perform API calls. When this happens you&#39;ll need to store the
168
+ new token hash if you want to continue using this session, you can use the
169
+ <code>on_token_refreshed</code> callback to do this.</p>
170
+
171
+ <pre class="code ruby"><code class="ruby"><span class='comment'># 1. Get an authorization URL, requesting offline access type.
172
+ </span><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>
173
+ <span class='id identifier rubyid_authenticator'>authenticator</span><span class='period'>.</span><span class='id identifier rubyid_auth_code'>auth_code</span><span class='period'>.</span><span class='id identifier rubyid_authorize_url'>authorize_url</span><span class='lparen'>(</span><span class='label'>token_access_type:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>offline</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
174
+
175
+ <span class='comment'># 2. Log into Dropbox and authorize your app. You need to open the
176
+ </span><span class='comment'># authorization URL in your browser.
177
+ </span>
178
+ <span class='comment'># 3. Exchange the authorization code for a reusable access token
179
+ </span><span class='id identifier rubyid_access_token'>access_token</span> <span class='op'>=</span> <span class='id identifier rubyid_authenticator'>authenticator</span><span class='period'>.</span><span class='id identifier rubyid_auth_code'>auth_code</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'>#=&gt; #&lt;OAuth2::AccessToken ...&gt;`
180
+ </span>
181
+ <span class='comment'># You can now use the access token to initialize a DropboxApi::Client, you
182
+ </span><span class='comment'># should also provide a callback function to store the updated access token
183
+ </span><span class='comment'># whenever it&#39;s refreshed.
184
+ </span><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>
185
+ <span class='label'>access_token:</span> <span class='id identifier rubyid_access_token'>access_token</span><span class='comma'>,</span>
186
+ <span class='label'>on_token_refreshed:</span> <span class='id identifier rubyid_lambda'>lambda</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_new_token_hash'>new_token_hash</span><span class='op'>|</span>
187
+ <span class='comment'># token_hash is a serializable Hash, something like this:
188
+ </span> <span class='comment'># {
189
+ </span> <span class='comment'># &quot;uid&quot;=&gt;&quot;440&quot;,
190
+ </span> <span class='comment'># &quot;token_type&quot;=&gt;&quot;bearer&quot;,
191
+ </span> <span class='comment'># &quot;scope&quot;=&gt;&quot;account_info.read account_info.write...&quot;,
192
+ </span> <span class='comment'># &quot;account_id&quot;=&gt;&quot;dbid:AABOLtA1rT6rRK4vajKZ...&quot;,
193
+ </span> <span class='comment'># :access_token=&gt;&quot;sl.A5Ez_CBsqJILhDawHlmXSoZEhLZ4nuLFVRs6AJ...&quot;,
194
+ </span> <span class='comment'># :refresh_token=&gt;&quot;iMg4Me_oKYUAAAAAAAAAAapQixCgwfXOxuubCuK_...&quot;,
195
+ </span> <span class='comment'># :expires_at=&gt;1632948328
196
+ </span> <span class='comment'># }
197
+ </span> <span class='const'>SomewhereSafe</span><span class='period'>.</span><span class='id identifier rubyid_save'>save</span><span class='lparen'>(</span><span class='id identifier rubyid_new_token_hash'>new_token_hash</span><span class='rparen'>)</span>
198
+ <span class='rbrace'>}</span>
199
+ <span class='rparen'>)</span>
200
+ </code></pre>
201
+
202
+ <p>Once you&#39;ve gone through the process above, you can skip the steps that require
203
+ user interaction in subsequent initializations of <code>DropboxApi::Client</code>. For
204
+ example:</p>
205
+
206
+ <pre class="code ruby"><code class="ruby"><span class='comment'># 1. Initialize an authenticator
207
+ </span><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>
208
+
209
+ <span class='comment'># 2. Retrieve the token hash you previously stored somewhere safe, you can use
210
+ </span><span class='comment'># it to build a new access token.
211
+ </span><span class='id identifier rubyid_access_token'>access_token</span> <span class='op'>=</span> <span class='const'>OAuth2</span><span class='op'>::</span><span class='const'>AccessToken</span><span class='period'>.</span><span class='id identifier rubyid_from_hash'>from_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_authenticator'>authenticator</span><span class='comma'>,</span> <span class='id identifier rubyid_token_hash'>token_hash</span><span class='rparen'>)</span>
212
+
213
+ <span class='comment'># 3. You now have an access token, so you can initialize a client like you
214
+ </span><span class='comment'># would normally:
215
+ </span><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>
216
+ <span class='label'>access_token:</span> <span class='id identifier rubyid_access_token'>access_token</span><span class='comma'>,</span>
217
+ <span class='label'>on_token_refreshed:</span> <span class='id identifier rubyid_lambda'>lambda</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_new_token_hash'>new_token_hash</span><span class='op'>|</span>
218
+ <span class='const'>SomewhereSafe</span><span class='period'>.</span><span class='id identifier rubyid_save'>save</span><span class='lparen'>(</span><span class='id identifier rubyid_new_token_hash'>new_token_hash</span><span class='rparen'>)</span>
219
+ <span class='rbrace'>}</span>
220
+ <span class='rparen'>)</span>
221
+ </code></pre>
222
+
155
223
  <h3 id="performing-api-calls">Performing API calls</h3>
156
224
 
157
225
  <p>Once you&#39;ve initialized a client, for example:</p>
@@ -194,6 +262,24 @@ example:</p>
194
262
  <a href="http://www.xuuso.com/dropbox_api/DropboxApi/Client.html#upload_by_chunks-instance_method">method documentation</a>
195
263
  to find out all available options.</p>
196
264
 
265
+ <h3 id="accessing-team-folders">Accessing Team Folders</h3>
266
+
267
+ <p>In order to access your team scope you need to add the namespace_id to you request headers.
268
+ This can be done using the middlewere layer as per the below:</p>
269
+
270
+ <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'>&quot;</span><span class='tstring_content'>VofXAX8D...</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
271
+ <span class='comment'>#=&gt; #&lt;DropboxApi::Client ...&gt;
272
+ </span><span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_namespace_id'>namespace_id</span> <span class='op'>=</span> <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_get_current_account'>get_current_account</span><span class='period'>.</span><span class='id identifier rubyid_root_info'>root_info</span><span class='period'>.</span><span class='id identifier rubyid_root_namespace_id'>root_namespace_id</span>
273
+
274
+ <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_list_folder'>list_folder</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
275
+ <span class='comment'>#=&gt; Now returns the team folders
276
+ </span></code></pre>
277
+
278
+ <p>You could unset the namespace ID at any point afterwards with just:</p>
279
+
280
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_namespace_id'>namespace_id</span> <span class='op'>=</span> <span class='kw'>nil</span>
281
+ </code></pre>
282
+
197
283
  <h2 id="dependencies">Dependencies</h2>
198
284
 
199
285
  <p>This gem depends on
@@ -252,9 +338,9 @@ endpoints are implemented, check out the <code>lib/dropbox_api/endpoints</code>
252
338
  </div></div>
253
339
 
254
340
  <div id="footer">
255
- Generated on Sun Feb 7 11:51:54 2021 by
341
+ Generated on Wed Sep 29 23:44:24 2021 by
256
342
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
257
- 0.9.26 (ruby-2.5.1).
343
+ 0.9.26 (ruby-2.6.5).
258
344
  </div>
259
345
 
260
346
  </div>
@@ -585,9 +585,9 @@ issue</a>.</p>
585
585
  </div></div>
586
586
 
587
587
  <div id="footer">
588
- Generated on Sun Feb 7 11:51:54 2021 by
588
+ Generated on Wed Sep 29 23:44:24 2021 by
589
589
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
590
- 0.9.26 (ruby-2.5.1).
590
+ 0.9.26 (ruby-2.6.5).
591
591
  </div>
592
592
 
593
593
  </div>
@@ -142,9 +142,9 @@ settings.</li>
142
142
  </div></div>
143
143
 
144
144
  <div id="footer">
145
- Generated on Sun Feb 7 11:51:54 2021 by
145
+ Generated on Wed Sep 29 23:44:24 2021 by
146
146
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
147
- 0.9.26 (ruby-2.5.1).
147
+ 0.9.26 (ruby-2.6.5).
148
148
  </div>
149
149
 
150
150
  </div>
data/docs/index.html CHANGED
@@ -116,42 +116,110 @@ have to get an authorization code.</p>
116
116
  <span class='comment'>#=&gt; #&lt;DropboxApi::Client ...&gt;
117
117
  </span></code></pre>
118
118
 
119
- <p>Note that setting an ENV variable is only a feasible choice if you&#39;re only
120
- using one account.</p>
119
+ <p>The official documentation on the process to get an authorization code is
120
+ <a href="https://developers.dropbox.com/es-es/oauth-guide#implementing-oauth">here</a>,
121
+ it describes the two options listed below.</p>
121
122
 
122
123
  <h4 id="option-a-get-your-access-token-from-the-website">Option A: Get your access token from the website</h4>
123
124
 
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&#39;t done so yet.</p>
125
+ <p>For a quick test, you can obtain an access token from the App Console in
126
+ <a href="https://www.dropbox.com/developers/">Dropbox&#39;s website</a>. Select from
127
+ <em>My apps</em> your application, you may need to create one if you
128
+ haven&#39;t done so yet. Under your application settings, find section
129
+ <em>OAuth 2</em>, there is a button to generate an access token.</p>
128
130
 
129
- <p>Under your application settings, find section <em>OAuth 2</em>. You&#39;ll find a button
130
- to generate an access token.</p>
131
+ <h4 id="option-b-oauth2-code-flow">Option B: OAuth2 Code Flow</h4>
131
132
 
132
- <h4 id="option-b-use-dropboxapi-authenticator">Option B: Use <code>DropboxApi::Authenticator</code></h4>
133
+ <p>This is typically what you will use in production, you can obtain an
134
+ authorization code with a 3-step process:</p>
133
135
 
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'>#=&gt; &quot;https://www.dropbox.com/...&quot;
136
+ <pre class="code ruby"><code class="ruby"><span class='comment'># 1. Get an authorization URL.
137
+ </span><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>
138
+ <span class='id identifier rubyid_authenticator'>authenticator</span><span class='period'>.</span><span class='id identifier rubyid_auth_code'>auth_code</span><span class='period'>.</span><span class='id identifier rubyid_authorize_url'>authorize_url</span> <span class='comment'>#=&gt; &quot;https://www.dropbox.com/...&quot;
138
139
  </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.
140
+ <span class='comment'># 2. Log into Dropbox and authorize your app. You need to open the
141
+ </span><span class='comment'># authorization URL in your browser.
141
142
  </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'>#=&gt; #&lt;OAuth2::AccessToken ...&gt;`
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'>#=&gt; &quot;VofXAX8D...&quot;
144
- </span><span class='comment'># Keep this token, you&#39;ll need it to initialize a `DropboxApi::Client` object
145
- </span></code></pre>
143
+ <span class='comment'># 3. Exchange the authorization code for a reusable access token (not visible
144
+ </span><span class='comment'># to the user).
145
+ </span><span class='id identifier rubyid_access_token'>access_token</span> <span class='op'>=</span> <span class='id identifier rubyid_authenticator'>authenticator</span><span class='period'>.</span><span class='id identifier rubyid_auth_code'>auth_code</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'>#=&gt; #&lt;OAuth2::AccessToken ...&gt;`
146
+ </span><span class='id identifier rubyid_access_token'>access_token</span><span class='period'>.</span><span class='id identifier rubyid_token'>token</span> <span class='comment'>#=&gt; &quot;VofXAX8D...&quot;
147
+ </span>
148
+ <span class='comment'># Keep this token, you&#39;ll need it to initialize a `DropboxApi::Client` object:
149
+ </span><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='label'>access_token:</span> <span class='id identifier rubyid_access_token'>access_token</span><span class='rparen'>)</span>
146
150
 
147
- <h4 id="standard-oauth-2-flow">Standard OAuth 2 flow</h4>
151
+ <span class='comment'># For backwards compatibility, the following also works:
152
+ </span><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='id identifier rubyid_access_token'>access_token</span><span class='period'>.</span><span class='id identifier rubyid_token'>token</span><span class='rparen'>)</span>
153
+ </code></pre>
148
154
 
149
- <p>This is what many web applications will use. The process is described in
150
- Dropbox&#39;s <a href="https://www.dropbox.com/developers/reference/oauth-guide#oauth-2-on-the-web">OAuth guide</a>.</p>
155
+ <h5 id="integration-with-rails">Integration with Rails</h5>
151
156
 
152
157
  <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
158
  guide</a>.</p>
154
159
 
160
+ <h5 id="using-refresh-tokens">Using refresh tokens</h5>
161
+
162
+ <p>Access tokens are short-lived by default (as of September 30th, 2021),
163
+ applications that require long-lived access to the API without additional
164
+ interaction with the user should use refresh tokens.</p>
165
+
166
+ <p>The process is similar but a token refresh might seamlessly occur as you
167
+ perform API calls. When this happens you&#39;ll need to store the
168
+ new token hash if you want to continue using this session, you can use the
169
+ <code>on_token_refreshed</code> callback to do this.</p>
170
+
171
+ <pre class="code ruby"><code class="ruby"><span class='comment'># 1. Get an authorization URL, requesting offline access type.
172
+ </span><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>
173
+ <span class='id identifier rubyid_authenticator'>authenticator</span><span class='period'>.</span><span class='id identifier rubyid_auth_code'>auth_code</span><span class='period'>.</span><span class='id identifier rubyid_authorize_url'>authorize_url</span><span class='lparen'>(</span><span class='label'>token_access_type:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>offline</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
174
+
175
+ <span class='comment'># 2. Log into Dropbox and authorize your app. You need to open the
176
+ </span><span class='comment'># authorization URL in your browser.
177
+ </span>
178
+ <span class='comment'># 3. Exchange the authorization code for a reusable access token
179
+ </span><span class='id identifier rubyid_access_token'>access_token</span> <span class='op'>=</span> <span class='id identifier rubyid_authenticator'>authenticator</span><span class='period'>.</span><span class='id identifier rubyid_auth_code'>auth_code</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'>#=&gt; #&lt;OAuth2::AccessToken ...&gt;`
180
+ </span>
181
+ <span class='comment'># You can now use the access token to initialize a DropboxApi::Client, you
182
+ </span><span class='comment'># should also provide a callback function to store the updated access token
183
+ </span><span class='comment'># whenever it&#39;s refreshed.
184
+ </span><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>
185
+ <span class='label'>access_token:</span> <span class='id identifier rubyid_access_token'>access_token</span><span class='comma'>,</span>
186
+ <span class='label'>on_token_refreshed:</span> <span class='id identifier rubyid_lambda'>lambda</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_new_token_hash'>new_token_hash</span><span class='op'>|</span>
187
+ <span class='comment'># token_hash is a serializable Hash, something like this:
188
+ </span> <span class='comment'># {
189
+ </span> <span class='comment'># &quot;uid&quot;=&gt;&quot;440&quot;,
190
+ </span> <span class='comment'># &quot;token_type&quot;=&gt;&quot;bearer&quot;,
191
+ </span> <span class='comment'># &quot;scope&quot;=&gt;&quot;account_info.read account_info.write...&quot;,
192
+ </span> <span class='comment'># &quot;account_id&quot;=&gt;&quot;dbid:AABOLtA1rT6rRK4vajKZ...&quot;,
193
+ </span> <span class='comment'># :access_token=&gt;&quot;sl.A5Ez_CBsqJILhDawHlmXSoZEhLZ4nuLFVRs6AJ...&quot;,
194
+ </span> <span class='comment'># :refresh_token=&gt;&quot;iMg4Me_oKYUAAAAAAAAAAapQixCgwfXOxuubCuK_...&quot;,
195
+ </span> <span class='comment'># :expires_at=&gt;1632948328
196
+ </span> <span class='comment'># }
197
+ </span> <span class='const'>SomewhereSafe</span><span class='period'>.</span><span class='id identifier rubyid_save'>save</span><span class='lparen'>(</span><span class='id identifier rubyid_new_token_hash'>new_token_hash</span><span class='rparen'>)</span>
198
+ <span class='rbrace'>}</span>
199
+ <span class='rparen'>)</span>
200
+ </code></pre>
201
+
202
+ <p>Once you&#39;ve gone through the process above, you can skip the steps that require
203
+ user interaction in subsequent initializations of <code>DropboxApi::Client</code>. For
204
+ example:</p>
205
+
206
+ <pre class="code ruby"><code class="ruby"><span class='comment'># 1. Initialize an authenticator
207
+ </span><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>
208
+
209
+ <span class='comment'># 2. Retrieve the token hash you previously stored somewhere safe, you can use
210
+ </span><span class='comment'># it to build a new access token.
211
+ </span><span class='id identifier rubyid_access_token'>access_token</span> <span class='op'>=</span> <span class='const'>OAuth2</span><span class='op'>::</span><span class='const'>AccessToken</span><span class='period'>.</span><span class='id identifier rubyid_from_hash'>from_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_authenticator'>authenticator</span><span class='comma'>,</span> <span class='id identifier rubyid_token_hash'>token_hash</span><span class='rparen'>)</span>
212
+
213
+ <span class='comment'># 3. You now have an access token, so you can initialize a client like you
214
+ </span><span class='comment'># would normally:
215
+ </span><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>
216
+ <span class='label'>access_token:</span> <span class='id identifier rubyid_access_token'>access_token</span><span class='comma'>,</span>
217
+ <span class='label'>on_token_refreshed:</span> <span class='id identifier rubyid_lambda'>lambda</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_new_token_hash'>new_token_hash</span><span class='op'>|</span>
218
+ <span class='const'>SomewhereSafe</span><span class='period'>.</span><span class='id identifier rubyid_save'>save</span><span class='lparen'>(</span><span class='id identifier rubyid_new_token_hash'>new_token_hash</span><span class='rparen'>)</span>
219
+ <span class='rbrace'>}</span>
220
+ <span class='rparen'>)</span>
221
+ </code></pre>
222
+
155
223
  <h3 id="performing-api-calls">Performing API calls</h3>
156
224
 
157
225
  <p>Once you&#39;ve initialized a client, for example:</p>
@@ -194,6 +262,24 @@ example:</p>
194
262
  <a href="http://www.xuuso.com/dropbox_api/DropboxApi/Client.html#upload_by_chunks-instance_method">method documentation</a>
195
263
  to find out all available options.</p>
196
264
 
265
+ <h3 id="accessing-team-folders">Accessing Team Folders</h3>
266
+
267
+ <p>In order to access your team scope you need to add the namespace_id to you request headers.
268
+ This can be done using the middlewere layer as per the below:</p>
269
+
270
+ <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'>&quot;</span><span class='tstring_content'>VofXAX8D...</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
271
+ <span class='comment'>#=&gt; #&lt;DropboxApi::Client ...&gt;
272
+ </span><span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_namespace_id'>namespace_id</span> <span class='op'>=</span> <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_get_current_account'>get_current_account</span><span class='period'>.</span><span class='id identifier rubyid_root_info'>root_info</span><span class='period'>.</span><span class='id identifier rubyid_root_namespace_id'>root_namespace_id</span>
273
+
274
+ <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_list_folder'>list_folder</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
275
+ <span class='comment'>#=&gt; Now returns the team folders
276
+ </span></code></pre>
277
+
278
+ <p>You could unset the namespace ID at any point afterwards with just:</p>
279
+
280
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_namespace_id'>namespace_id</span> <span class='op'>=</span> <span class='kw'>nil</span>
281
+ </code></pre>
282
+
197
283
  <h2 id="dependencies">Dependencies</h2>
198
284
 
199
285
  <p>This gem depends on
@@ -252,9 +338,9 @@ endpoints are implemented, check out the <code>lib/dropbox_api/endpoints</code>
252
338
  </div></div>
253
339
 
254
340
  <div id="footer">
255
- Generated on Sun Feb 7 11:51:54 2021 by
341
+ Generated on Wed Sep 29 23:44:24 2021 by
256
342
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
257
- 0.9.26 (ruby-2.5.1).
343
+ 0.9.26 (ruby-2.6.5).
258
344
  </div>
259
345
 
260
346
  </div>