Class: DropboxApi::Endpoints::Files::Upload
- Inherits:
-
ContentUpload
- Object
- Base
- ContentUpload
- DropboxApi::Endpoints::Files::Upload
- Includes:
- OptionsValidator
- Defined in:
- lib/dropbox_api/endpoints/files/upload.rb
Constant Summary collapse
- Method =
:post
- Path =
"/2/files/upload".freeze
- ResultType =
DropboxApi::Metadata::File
- ErrorType =
DropboxApi::Errors::UploadError
Instance Method Summary collapse
-
#upload(path, content, options = {}) ⇒ Object
Creates a new file.
Methods included from OptionsValidator
Methods inherited from ContentUpload
#build_request, #initialize, #perform_request
Methods inherited from Base
Constructor Details
This class inherits a constructor from DropboxApi::Endpoints::ContentUpload
Instance Method Details
#upload(path, content, options = {}) ⇒ Object
Creates a new file.
Do not use this to upload a file larger than 150 MB. Instead, create an upload session with #upload_session_start().
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/dropbox_api/endpoints/files/upload.rb', line 43 add_endpoint :upload do |path, content, = {}| ([ :mode, :autorename, :client_modified, :mute ], ) [:mode] = build_write_mode_param([:mode]) if [:mode] [:client_modified] = [:client_modified].utc.strftime("%FT%TZ") if [:client_modified] perform_request(.merge({ :path => path }), content) end |