Sha256: 8554698c51fa90cf57c22be0b98026bcfb91a80e3bea1b826a5422f917268720

Contents?: true

Size: 1.48 KB

Versions: 5

Compression:

Stored size: 1.48 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::Endpoints::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

5 entries across 5 versions & 1 rubygems

Version Path
dropbox_api-0.1.10 lib/dropbox_api/endpoints/files/upload_session_start.rb
dropbox_api-0.1.9 lib/dropbox_api/endpoints/files/upload_session_start.rb
dropbox_api-0.1.8 lib/dropbox_api/endpoints/files/upload_session_start.rb
dropbox_api-0.1.7 lib/dropbox_api/endpoints/files/upload_session_start.rb
dropbox_api-0.1.6 lib/dropbox_api/endpoints/files/upload_session_start.rb