dropbox_api 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -12
- data/RELEASING.md +5 -0
- data/api_coverage.md +9 -0
- data/lib/dropbox_api.rb +23 -4
- data/lib/dropbox_api/chunked_uploader.rb +48 -0
- data/lib/dropbox_api/endpoints/content_upload.rb +16 -9
- data/lib/dropbox_api/endpoints/file_requests/create_file_request.rb +21 -0
- data/lib/dropbox_api/endpoints/files/get_metadata.rb +1 -1
- data/lib/dropbox_api/endpoints/files/get_thumbnail.rb +4 -4
- data/lib/dropbox_api/endpoints/files/get_thumbnail_batch.rb +38 -0
- data/lib/dropbox_api/endpoints/files/list_folder.rb +16 -1
- data/lib/dropbox_api/endpoints/files/list_folder_get_latest_cursor.rb +8 -9
- data/lib/dropbox_api/endpoints/files/list_folder_longpoll.rb +1 -1
- data/lib/dropbox_api/endpoints/files/list_revisions.rb +1 -1
- data/lib/dropbox_api/endpoints/files/move.rb +2 -2
- data/lib/dropbox_api/endpoints/files/save_url_check_job_status.rb +1 -1
- data/lib/dropbox_api/endpoints/files/search.rb +1 -1
- data/lib/dropbox_api/endpoints/files/upload.rb +17 -27
- data/lib/dropbox_api/endpoints/files/upload_session_append_v2.rb +7 -5
- data/lib/dropbox_api/endpoints/files/upload_session_finish.rb +5 -3
- data/lib/dropbox_api/endpoints/files/upload_session_start.rb +3 -3
- data/lib/dropbox_api/endpoints/rpc_content.rb +9 -0
- data/lib/dropbox_api/endpoints/sharing/add_file_member.rb +6 -6
- data/lib/dropbox_api/endpoints/sharing/add_folder_member.rb +5 -5
- data/lib/dropbox_api/endpoints/sharing/create_shared_link_with_settings.rb +2 -2
- data/lib/dropbox_api/endpoints/sharing/list_folder_members.rb +1 -1
- data/lib/dropbox_api/endpoints/sharing/list_shared_links.rb +1 -1
- data/lib/dropbox_api/endpoints/sharing/share_folder.rb +1 -1
- data/lib/dropbox_api/endpoints/virtual/upload_by_chunks.rb +49 -0
- data/lib/dropbox_api/errors/basic_error.rb +2 -0
- data/lib/dropbox_api/errors/create_file_request_error.rb +6 -0
- data/lib/dropbox_api/errors/thumbnail_batch_error.rb +7 -0
- data/lib/dropbox_api/errors/thumbnail_error.rb +10 -0
- data/lib/dropbox_api/metadata/access_level.rb +7 -4
- data/lib/dropbox_api/metadata/add_file_member_result.rb +13 -10
- data/lib/dropbox_api/metadata/add_member.rb +19 -16
- data/lib/dropbox_api/metadata/basic_account.rb +18 -15
- data/lib/dropbox_api/metadata/commit_info.rb +35 -1
- data/lib/dropbox_api/metadata/deleted.rb +9 -6
- data/lib/dropbox_api/metadata/file.rb +18 -15
- data/lib/dropbox_api/metadata/file_link_metadata.rb +48 -0
- data/lib/dropbox_api/metadata/file_member_action.rb +8 -5
- data/lib/dropbox_api/metadata/file_request.rb +30 -0
- data/lib/dropbox_api/metadata/folder.rb +9 -6
- data/lib/dropbox_api/metadata/{folder_link.rb → folder_link_metadata.rb} +1 -1
- data/lib/dropbox_api/metadata/folder_sharing_info.rb +7 -4
- data/lib/dropbox_api/metadata/link_permissions.rb +11 -8
- data/lib/dropbox_api/metadata/media_info.rb +14 -7
- data/lib/dropbox_api/metadata/media_metadata.rb +14 -12
- data/lib/dropbox_api/metadata/member.rb +12 -9
- data/lib/dropbox_api/metadata/member_action.rb +13 -10
- data/lib/dropbox_api/metadata/member_permission.rb +11 -8
- data/lib/dropbox_api/metadata/member_permission_list.rb +19 -17
- data/lib/dropbox_api/metadata/name.rb +9 -6
- data/lib/dropbox_api/metadata/photo_metadata.rb +14 -11
- data/lib/dropbox_api/metadata/resource.rb +1 -1
- data/lib/dropbox_api/metadata/shared_folder.rb +16 -13
- data/lib/dropbox_api/metadata/shared_folder_policy.rb +7 -4
- data/lib/dropbox_api/metadata/shared_link.rb +30 -18
- data/lib/dropbox_api/metadata/shared_link_metadata.rb +26 -0
- data/lib/dropbox_api/metadata/space_allocation.rb +7 -4
- data/lib/dropbox_api/metadata/space_usage.rb +9 -6
- data/lib/dropbox_api/metadata/{symbol.rb → tag.rb} +1 -1
- data/lib/dropbox_api/metadata/team_member_info.rb +11 -8
- data/lib/dropbox_api/metadata/thumbnail_batch_result_data.rb +6 -0
- data/lib/dropbox_api/metadata/thumbnail_batch_result_entry.rb +23 -0
- data/lib/dropbox_api/metadata/upload_session_cursor.rb +7 -4
- data/lib/dropbox_api/metadata/video_metadata.rb +15 -12
- data/lib/dropbox_api/metadata/write_mode.rb +3 -3
- data/lib/dropbox_api/{endpoints/options_validator.rb → options_validator.rb} +1 -1
- data/lib/dropbox_api/results/add_file_member_result_list.rb +1 -1
- data/lib/dropbox_api/results/get_thumbnail_batch_result.rb +9 -0
- data/lib/dropbox_api/results/list_shared_links_result.rb +1 -1
- data/lib/dropbox_api/version.rb +1 -1
- metadata +20 -6
- data/lib/dropbox_api/metadata/file_link.rb +0 -45
@@ -5,7 +5,7 @@ module DropboxApi::Endpoints::Files
|
|
5
5
|
ResultType = DropboxApi::Results::ListRevisionsResult
|
6
6
|
ErrorType = DropboxApi::Errors::ListRevisionsError
|
7
7
|
|
8
|
-
include DropboxApi::
|
8
|
+
include DropboxApi::OptionsValidator
|
9
9
|
|
10
10
|
# Return revisions of a file
|
11
11
|
#
|
@@ -5,7 +5,7 @@ module DropboxApi::Endpoints::Files
|
|
5
5
|
ResultType = DropboxApi::Metadata::Resource
|
6
6
|
ErrorType = DropboxApi::Errors::RelocationError
|
7
7
|
|
8
|
-
include DropboxApi::
|
8
|
+
include DropboxApi::OptionsValidator
|
9
9
|
|
10
10
|
# Move a file or folder to a different location in the user's Dropbox.
|
11
11
|
#
|
@@ -15,7 +15,7 @@ module DropboxApi::Endpoints::Files
|
|
15
15
|
# @param to [String] Path in the user's Dropbox that is the destination.
|
16
16
|
# @option options autorename [Boolean] If there's a conflict, have the
|
17
17
|
# Dropbox server try to autorename the file to avoid the conflict. The
|
18
|
-
# default for this field is
|
18
|
+
# default for this field is `false`.
|
19
19
|
add_endpoint :move do |from, to, options = {}|
|
20
20
|
# We're not implementing support for the `allow_shared_folder` option
|
21
21
|
# because according to Dropbox's documentation: "This field is always
|
@@ -5,7 +5,7 @@ module DropboxApi::Endpoints::Files
|
|
5
5
|
ResultType = DropboxApi::Results::SaveUrlJobStatus
|
6
6
|
ErrorType = DropboxApi::Errors::PollError
|
7
7
|
|
8
|
-
# Check the status of a
|
8
|
+
# Check the status of a `save_url` job.
|
9
9
|
#
|
10
10
|
# @param job_id [String] Id of the asynchronous job. This is the value of
|
11
11
|
# a response returned from the method that launched the job.
|
@@ -5,12 +5,13 @@ module DropboxApi::Endpoints::Files
|
|
5
5
|
ResultType = DropboxApi::Metadata::File
|
6
6
|
ErrorType = DropboxApi::Errors::UploadError
|
7
7
|
|
8
|
-
include DropboxApi::
|
8
|
+
include DropboxApi::OptionsValidator
|
9
9
|
|
10
10
|
# Creates a new file.
|
11
11
|
#
|
12
|
-
# Do not use this to upload a file larger than 150 MB.
|
13
|
-
#
|
12
|
+
# Do not use this to upload a file larger than 150 MB.
|
13
|
+
#
|
14
|
+
# For larger files you can use {#upload_by_chunks}.
|
14
15
|
#
|
15
16
|
# @example
|
16
17
|
# client = DropboxApi::Client.new
|
@@ -27,18 +28,23 @@ module DropboxApi::Endpoints::Files
|
|
27
28
|
# #=> #<DropboxApi::Metadata::File: @name="file (1).txt" ...>
|
28
29
|
# @param path [String] Path in the user's Dropbox to save the file.
|
29
30
|
# @param content The contents of the file that will be uploaded. This
|
30
|
-
# could be the result of the
|
31
|
+
# could be the result of the `IO::read` method.
|
31
32
|
# @option options mode [DropboxApi::Metadata::WriteMode] Selects what to
|
32
|
-
# do if the file already exists. The default is
|
33
|
+
# do if the file already exists. The default is `add`.
|
33
34
|
# @option options autorename [Boolean] If there's a conflict, as determined
|
34
|
-
# by
|
35
|
-
# conflict. The default for this field is
|
35
|
+
# by `mode`, have the Dropbox server try to autorename the file to avoid
|
36
|
+
# conflict. The default for this field is `false`.
|
36
37
|
# @option options client_modified [DateTime] The value to store as the
|
37
|
-
#
|
38
|
+
# `client_modified` timestamp. Dropbox automatically records the time at
|
38
39
|
# which the file was written to the Dropbox servers. It can also record
|
39
40
|
# an additional timestamp, provided by Dropbox desktop clients, mobile
|
40
41
|
# clients, and API apps of when the file was actually created or
|
41
42
|
# modified.
|
43
|
+
# @option options mute [Boolean] Normally, users are made aware of any
|
44
|
+
# file modifications in their Dropbox account via notifications in the
|
45
|
+
# client software. If `true`, this tells the clients that this
|
46
|
+
# modification shouldn't result in a user notification. The default for
|
47
|
+
# this field is `false`.
|
42
48
|
# @see DropboxApi::Metadata::WriteMode
|
43
49
|
add_endpoint :upload do |path, content, options = {}|
|
44
50
|
validate_options([
|
@@ -48,25 +54,9 @@ module DropboxApi::Endpoints::Files
|
|
48
54
|
:mute
|
49
55
|
], options)
|
50
56
|
|
51
|
-
options[:
|
52
|
-
|
53
|
-
|
54
|
-
perform_request(options.merge({
|
55
|
-
:path => path
|
56
|
-
}), content)
|
57
|
-
end
|
58
|
-
|
59
|
-
private
|
60
|
-
|
61
|
-
def build_write_mode_param(write_mode)
|
62
|
-
case write_mode
|
63
|
-
when String, Symbol
|
64
|
-
DropboxApi::Metadata::WriteMode.new write_mode
|
65
|
-
when DropboxApi::Metadata::WriteMode
|
66
|
-
write_mode
|
67
|
-
else
|
68
|
-
raise ArgumentError, "Invalid write mode: #{write_mode.inspect}"
|
69
|
-
end.to_hash
|
57
|
+
options[:path] = path
|
58
|
+
commit_info = DropboxApi::Metadata::CommitInfo.build_from_options options
|
59
|
+
perform_request(commit_info.to_hash, content)
|
70
60
|
end
|
71
61
|
end
|
72
62
|
end
|
@@ -5,13 +5,15 @@ module DropboxApi::Endpoints::Files
|
|
5
5
|
ResultType = DropboxApi::Results::VoidResult
|
6
6
|
ErrorType = DropboxApi::Errors::UploadSessionLookupError
|
7
7
|
|
8
|
-
include DropboxApi::
|
8
|
+
include DropboxApi::OptionsValidator
|
9
9
|
|
10
10
|
# Append more data to an upload session.
|
11
11
|
#
|
12
|
-
# When the parameter
|
12
|
+
# When the parameter `close` is set, this call will close the session.
|
13
13
|
#
|
14
|
-
# A single request should not upload more than 150 MB
|
14
|
+
# A single request should not upload more than 150 MB.
|
15
|
+
#
|
16
|
+
# The maximum size of a file one can upload to an upload session is 350 GB.
|
15
17
|
#
|
16
18
|
# Calling this method may update the cursor received. In particular, the
|
17
19
|
# offset variable will be increased to match the new position. This allows
|
@@ -28,10 +30,10 @@ module DropboxApi::Endpoints::Files
|
|
28
30
|
# @param cursor [DropboxApi::Metadata::UploadSessionCursor] Contains the
|
29
31
|
# upload session ID and the offset. This cursor will have its offset
|
30
32
|
# updated after a successful call.
|
31
|
-
# @option options close [Boolean] If
|
33
|
+
# @option options close [Boolean] If `true`, the current session will be
|
32
34
|
# closed, at which point you won't be able to call
|
33
35
|
# {Client#upload_session_append_v2} anymore with the current session.
|
34
|
-
# The default for this field is
|
36
|
+
# The default for this field is `false`.
|
35
37
|
# @see UploadSessionCursor
|
36
38
|
add_endpoint :upload_session_append_v2 do |cursor, content, options = {}|
|
37
39
|
validate_options([
|
@@ -5,17 +5,19 @@ module DropboxApi::Endpoints::Files
|
|
5
5
|
ResultType = DropboxApi::Metadata::File
|
6
6
|
ErrorType = DropboxApi::Errors::UploadSessionFinishError
|
7
7
|
|
8
|
-
include DropboxApi::
|
8
|
+
include DropboxApi::OptionsValidator
|
9
9
|
|
10
10
|
# Finish an upload session and save the uploaded data to the given file
|
11
11
|
# path.
|
12
12
|
#
|
13
|
-
# A single request should not upload more than 150 MB
|
13
|
+
# A single request should not upload more than 150 MB.
|
14
|
+
#
|
15
|
+
# The maximum size of a file one can upload to an upload session is 350 GB.
|
14
16
|
#
|
15
17
|
# @param cursor [DropboxApi::Metadata::UploadSessionCursor] Contains the
|
16
18
|
# upload session ID and the offset.
|
17
19
|
# @param commit [DropboxApi::Metadata::CommitInfo] Contains the path and
|
18
|
-
#
|
20
|
+
# other optional modifiers for the commit.
|
19
21
|
add_endpoint :upload_session_finish do |cursor, commit, content = nil|
|
20
22
|
perform_request({
|
21
23
|
:cursor => cursor.to_hash,
|
@@ -5,7 +5,7 @@ module DropboxApi::Endpoints::Files
|
|
5
5
|
ResultType = DropboxApi::Results::UploadSessionStart
|
6
6
|
ErrorType = nil
|
7
7
|
|
8
|
-
include DropboxApi::
|
8
|
+
include DropboxApi::OptionsValidator
|
9
9
|
|
10
10
|
# Upload sessions allow you to upload a single file in one or more
|
11
11
|
# requests, for example where the size of the file is greater than 150 MB.
|
@@ -16,10 +16,10 @@ module DropboxApi::Endpoints::Files
|
|
16
16
|
#
|
17
17
|
# A single request should not upload more than 150 MB of file contents.
|
18
18
|
#
|
19
|
-
# @option options close [Boolean] If
|
19
|
+
# @option options close [Boolean] If `true`, the current session will be
|
20
20
|
# closed, at which point you won't be able to call
|
21
21
|
# {Client#upload_session_append_v2} anymore with the current session.
|
22
|
-
# The default for this field is
|
22
|
+
# The default for this field is `false`.
|
23
23
|
# @return [DropboxApi::Metadata::UploadSessionCursor] The session cursor
|
24
24
|
# that you can use to continue the upload afterwards.
|
25
25
|
add_endpoint :upload_session_start do |content, options = {}|
|
@@ -5,28 +5,28 @@ module DropboxApi::Endpoints::Sharing
|
|
5
5
|
ResultType = DropboxApi::Results::AddFileMemberResultList
|
6
6
|
ErrorType = DropboxApi::Errors::AddFileMemberError
|
7
7
|
|
8
|
-
include DropboxApi::
|
8
|
+
include DropboxApi::OptionsValidator
|
9
9
|
|
10
10
|
# Adds specified members to a file.
|
11
11
|
#
|
12
|
-
# The
|
13
|
-
# element is represented by either a
|
12
|
+
# The `members` parameter can be an `Array` or a single member element. Each
|
13
|
+
# element is represented by either a `String` or a {Metadata::Member}
|
14
14
|
# object. You can identify a member using his email or a Dropbox ID.
|
15
15
|
#
|
16
16
|
# @param file [String] File to which to add members. It can be a path or
|
17
|
-
# an ID such as
|
17
|
+
# an ID such as `id:3kmLmQFnf1AAAAAAAAAAAw`.
|
18
18
|
# @param members Members to add. Note
|
19
19
|
# that even if an email address is given, this may result in a user
|
20
20
|
# being directy added to the membership if that email is the user's
|
21
21
|
# main account email.
|
22
22
|
# @option options quiet [Boolean] Whether added members should be notified
|
23
23
|
# via email and device notifications of their invite. The default for
|
24
|
-
# this field is
|
24
|
+
# this field is `false`.
|
25
25
|
# @option options custom_message [String] Message to send to added members
|
26
26
|
# in their invitation. This field is optional.
|
27
27
|
# @option options access_level [AccessLevel] AccessLevel union object,
|
28
28
|
# describing what access level we want to give new members. The default
|
29
|
-
# for this is
|
29
|
+
# for this is `:viewer`.
|
30
30
|
# @option options add_message_as_comment [String] Optional message to
|
31
31
|
# display to added members in their invitation. This field is optional.
|
32
32
|
# @see DropboxApi::Metadata::Member
|
@@ -5,23 +5,23 @@ module DropboxApi::Endpoints::Sharing
|
|
5
5
|
ResultType = DropboxApi::Results::VoidResult
|
6
6
|
ErrorType = DropboxApi::Errors::AddFolderMemberError
|
7
7
|
|
8
|
-
include DropboxApi::
|
8
|
+
include DropboxApi::OptionsValidator
|
9
9
|
|
10
10
|
# Allows an owner or editor (if the ACL update policy allows) of a shared
|
11
11
|
# folder to add another member.
|
12
12
|
#
|
13
13
|
# For the new member to get access to all the functionality for this folder,
|
14
|
-
# you will need to call
|
14
|
+
# you will need to call `mount_folder` on their behalf.
|
15
15
|
#
|
16
16
|
# Apps must have full Dropbox access to use this endpoint.
|
17
17
|
#
|
18
|
-
# The
|
19
|
-
# Each element is represented by either a
|
18
|
+
# The `members` parameter can be an `Array` or a single member element.
|
19
|
+
# Each element is represented by either a `String` or a
|
20
20
|
# {Metadata::AddMember} object. This parameter can be just a string with
|
21
21
|
# an email.
|
22
22
|
#
|
23
23
|
# You can also build a {Metadata::AddMember} object and use it in the
|
24
|
-
#
|
24
|
+
# `members` parameter, this allows custom options for each member.
|
25
25
|
#
|
26
26
|
# @example
|
27
27
|
# client = DropboxApi::Client.new
|
@@ -2,7 +2,7 @@ module DropboxApi::Endpoints::Sharing
|
|
2
2
|
class CreateSharedLinkWithSettings < DropboxApi::Endpoints::Rpc
|
3
3
|
Method = :post
|
4
4
|
Path = "/2/sharing/create_shared_link_with_settings".freeze
|
5
|
-
ResultType = DropboxApi::Metadata::
|
5
|
+
ResultType = DropboxApi::Metadata::SharedLinkMetadata
|
6
6
|
ErrorType = DropboxApi::Errors::CreateSharedLinkWithSettingsError
|
7
7
|
|
8
8
|
# Create a shared link with custom settings. If no settings are given then
|
@@ -13,7 +13,7 @@ module DropboxApi::Endpoints::Sharing
|
|
13
13
|
# @param path [String] The path to be shared by the shared link.
|
14
14
|
# @param settings [SharedLinkSettings] The requested settings for the newly
|
15
15
|
# created shared link This field is optional.
|
16
|
-
# @return [DropboxApi::Metadata::
|
16
|
+
# @return [DropboxApi::Metadata::SharedLinkMetadata]
|
17
17
|
add_endpoint :create_shared_link_with_settings do |path, settings = {}|
|
18
18
|
# NOTE: This endpoint accepts an additional option `settings` which
|
19
19
|
# hasn't been implemented.
|
@@ -5,7 +5,7 @@ module DropboxApi::Endpoints::Sharing
|
|
5
5
|
ResultType = DropboxApi::Results::SharedFolderMembers
|
6
6
|
ErrorType = DropboxApi::Errors::SharedFolderAccessError
|
7
7
|
|
8
|
-
include DropboxApi::
|
8
|
+
include DropboxApi::OptionsValidator
|
9
9
|
|
10
10
|
# Returns shared folder membership by its folder ID.
|
11
11
|
#
|
@@ -5,7 +5,7 @@ module DropboxApi::Endpoints::Sharing
|
|
5
5
|
ResultType = DropboxApi::Results::ListSharedLinksResult
|
6
6
|
ErrorType = DropboxApi::Errors::ListSharedLinksError
|
7
7
|
|
8
|
-
include DropboxApi::
|
8
|
+
include DropboxApi::OptionsValidator
|
9
9
|
|
10
10
|
# List shared links of this user.
|
11
11
|
#
|
@@ -5,7 +5,7 @@ module DropboxApi::Endpoints::Sharing
|
|
5
5
|
ResultType = DropboxApi::Results::ShareFolderLaunch
|
6
6
|
ErrorType = DropboxApi::Errors::ShareFolderError
|
7
7
|
|
8
|
-
include DropboxApi::
|
8
|
+
include DropboxApi::OptionsValidator
|
9
9
|
|
10
10
|
# Share a folder with collaborators.
|
11
11
|
#
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module DropboxApi
|
2
|
+
class Client
|
3
|
+
# Creates a new file using the *upload session* endpoints. You can use
|
4
|
+
# this method to upload files larger than 150 MB.
|
5
|
+
#
|
6
|
+
# @example
|
7
|
+
# client = DropboxApi::Client.new
|
8
|
+
# File.open "large file.avi" do |file|
|
9
|
+
# client.upload "/large file.avi", file
|
10
|
+
# #=> #<DropboxApi::Metadata::File: @name="large file.avi" ...>
|
11
|
+
# end
|
12
|
+
# @example
|
13
|
+
# client = DropboxApi::Client.new
|
14
|
+
# client.upload "/file.txt", "File contents...", :mode => :add
|
15
|
+
# #=> #<DropboxApi::Metadata::File: @name="file (1).txt" ...>
|
16
|
+
# @param path [String] Path in the user's Dropbox to save the file.
|
17
|
+
# @param content The contents of the file that will be uploaded. This
|
18
|
+
# could be the result of the `IO::read` method.
|
19
|
+
# @option options mode [DropboxApi::Metadata::WriteMode] Selects what to
|
20
|
+
# do if the file already exists. The default is `add`.
|
21
|
+
# @option options autorename [Boolean] If there's a conflict, as determined
|
22
|
+
# by `mode`, have the Dropbox server try to autorename the file to avoid
|
23
|
+
# conflict. The default for this field is `false`.
|
24
|
+
# @option options client_modified [DateTime] The value to store as the
|
25
|
+
# `client_modified` timestamp. Dropbox automatically records the time at
|
26
|
+
# which the file was written to the Dropbox servers. It can also record
|
27
|
+
# an additional timestamp, provided by Dropbox desktop clients, mobile
|
28
|
+
# clients, and API apps of when the file was actually created or
|
29
|
+
# modified.
|
30
|
+
# @option options mute [Boolean] Normally, users are made aware of any
|
31
|
+
# file modifications in their Dropbox account via notifications in the
|
32
|
+
# client software. If `true`, this tells the clients that this
|
33
|
+
# modification shouldn't result in a user notification. The default for
|
34
|
+
# this field is `false`.
|
35
|
+
# @option options chunk_size [Numeric] The size of each upload chunk. It
|
36
|
+
# defaults to 4 MiB.
|
37
|
+
# @see DropboxApi::Metadata::WriteMode
|
38
|
+
#
|
39
|
+
# @!group virtual
|
40
|
+
def upload_by_chunks(path, content, options = {})
|
41
|
+
content = StringIO.new(content) if content.is_a?(String)
|
42
|
+
|
43
|
+
uploader = DropboxApi::ChunkedUploader.new(self, path, content, options)
|
44
|
+
uploader.start
|
45
|
+
uploader.upload
|
46
|
+
uploader.finish
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -34,6 +34,7 @@ module DropboxApi::Errors
|
|
34
34
|
class CantNestSharedFolderError < BasicError; end
|
35
35
|
class CantShareOutsideTeamError < BasicError; end
|
36
36
|
class ContainsSharedFolderError < BasicError; end
|
37
|
+
class ConversionError < BasicError; end
|
37
38
|
class CursorClosedError < BasicError; end
|
38
39
|
class CursorNotClosedError < BasicError; end
|
39
40
|
class DisallowedNameError < BasicError; end
|
@@ -90,5 +91,6 @@ module DropboxApi::Errors
|
|
90
91
|
class UnmountedError < BasicError; end
|
91
92
|
class UnsupportedContentError < BasicError; end
|
92
93
|
class UnsupportedExtensionError < BasicError; end
|
94
|
+
class UnsupportedImageError < BasicError; end
|
93
95
|
class UnverifiedDropboxId < BasicError; end
|
94
96
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module DropboxApi::Errors
|
2
|
+
class ThumbnailError < BasicError
|
3
|
+
ErrorSubtypes = {
|
4
|
+
:path => LookupError,
|
5
|
+
:unsupported_extension => UnsupportedExtensionError,
|
6
|
+
:unsupported_image => UnsupportedImageError,
|
7
|
+
:conversion_error => ConversionError
|
8
|
+
}.freeze
|
9
|
+
end
|
10
|
+
end
|
@@ -1,9 +1,12 @@
|
|
1
1
|
module DropboxApi::Metadata
|
2
2
|
# Example of a serialized {AccessLevel} object:
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
|
3
|
+
#
|
4
|
+
# ```json
|
5
|
+
# {
|
6
|
+
# ".tag": "viewer"
|
7
|
+
# }
|
8
|
+
# ```
|
9
|
+
class AccessLevel < DropboxApi::Metadata::Tag
|
7
10
|
VALID_ACCESS_LEVELS = [
|
8
11
|
:owner,
|
9
12
|
:editor,
|
@@ -1,17 +1,20 @@
|
|
1
1
|
module DropboxApi::Metadata
|
2
2
|
# Example of a {AddFileMemberResult}:
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
# "
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
3
|
+
#
|
4
|
+
# ```json
|
5
|
+
# {
|
6
|
+
# "member":{
|
7
|
+
# ".tag": "email",
|
8
|
+
# "email": "somebody@test.com"
|
9
|
+
# },
|
10
|
+
# "result": {
|
11
|
+
# ".tag": "success",
|
12
|
+
# "success": {
|
13
|
+
# ".tag": "viewer"
|
13
14
|
# }
|
14
15
|
# }
|
16
|
+
# }
|
17
|
+
# ```
|
15
18
|
class AddFileMemberResult < Base
|
16
19
|
field :member, DropboxApi::Metadata::Member
|
17
20
|
field :result, DropboxApi::Metadata::FileMemberAction
|