Class: RunApi::Core::Files
- Inherits:
-
Object
- Object
- RunApi::Core::Files
- Includes:
- ResourceHelpers
- Defined in:
- lib/runapi/core/files.rb
Defined Under Namespace
Classes: UploadResponse
Constant Summary collapse
- ENDPOINT =
"/api/v1/files"- PREPARE_ENDPOINT =
"#{ENDPOINT}/prepare"- CONFIRM_ENDPOINT =
"#{ENDPOINT}/confirm"- RESPONSE_CLASS =
UploadResponse
Instance Method Summary collapse
- #create(file: nil, source: nil, file_name: nil, options: nil) ⇒ Object
-
#initialize(http) ⇒ Files
constructor
A new instance of Files.
Constructor Details
#initialize(http) ⇒ Files
Returns a new instance of Files.
25 26 27 |
# File 'lib/runapi/core/files.rb', line 25 def initialize(http) @http = http end |
Instance Method Details
#create(file: nil, source: nil, file_name: nil, options: nil) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/runapi/core/files.rb', line 29 def create(file: nil, source: nil, file_name: nil, options: nil) validate_source!(file:, source:) return upload_direct(file, file_name:, options:) if file request(:post, ENDPOINT, body: compact_params(source:, file_name:), options:) end |