Sha256: f6168672f99d256a5a06d2de4bcbb768080abb703493a5055bd5dace0e8ab133

Contents?: true

Size: 1.47 KB

Versions: 8

Compression:

Stored size: 1.47 KB

Contents

module DropboxApi::Endpoints::Files
  class UploadSessionStart < DropboxApi::Endpoints::ContentUpload
    Method      = :post
    Path        = "/2/files/upload_session/start".freeze
    ResultType  = DropboxApi::Results::UploadSessionStart
    ErrorType   = nil

    include DropboxApi::OptionsValidator

    # Upload sessions allow you to upload a single file in one or more
    # requests, for example where the size of the file is greater than 150 MB.
    #
    # This call starts a new upload session with the given data. You can then
    # use {Client#upload_session_append_v2} to add more data and
    # {Client#upload_session_finish} to save all the data to a file in Dropbox.
    #
    # A single request should not upload more than 150 MB of file contents.
    #
    # @option options close [Boolean] If `true`, the current session will be
    #   closed, at which point you won't be able to call
    #   {Client#upload_session_append_v2} anymore with the current session.
    #   The default for this field is `false`.
    # @return [DropboxApi::Metadata::UploadSessionCursor] The session cursor
    #   that you can use to continue the upload afterwards.
    add_endpoint :upload_session_start do |content, options = {}|
      validate_options([
        :close
      ], options)

      session = perform_request(options, content)

      DropboxApi::Metadata::UploadSessionCursor.new({
        "session_id" => session.session_id,
        "offset" => content.bytesize
      })
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dropbox_api-0.1.18 lib/dropbox_api/endpoints/files/upload_session_start.rb
dropbox_api-0.1.17 lib/dropbox_api/endpoints/files/upload_session_start.rb
dropbox_api-0.1.16 lib/dropbox_api/endpoints/files/upload_session_start.rb
dropbox_api-0.1.15 lib/dropbox_api/endpoints/files/upload_session_start.rb
dropbox_api-0.1.14 lib/dropbox_api/endpoints/files/upload_session_start.rb
dropbox_api-0.1.13 lib/dropbox_api/endpoints/files/upload_session_start.rb
dropbox_api-0.1.12 lib/dropbox_api/endpoints/files/upload_session_start.rb
dropbox_api-0.1.11 lib/dropbox_api/endpoints/files/upload_session_start.rb