Class: Uploadcare::Rails::Api::Upload::UploadApi

Inherits:
Base
  • Object
show all
Defined in:
lib/uploadcare/rails/api/upload/upload_api.rb

Overview

A client for general uploads

Class Method Summary collapse

Class Method Details

.upload_file(file, options = {}) ⇒ Object

Uploads single files smaller. Supports small (less that 100 MB) and large single files.



18
19
20
21
22
# File 'lib/uploadcare/rails/api/upload/upload_api.rb', line 18

def upload_file(file, options = {})
  return upload(file, options) if file?(file) || file.is_a?(String)

  raise TypeError, "The first argument must be a File or String (URL), #{file.class} given"
end

.upload_files(files, options = {}) ⇒ Object

Raises:

  • (TypeError)


27
28
29
30
31
# File 'lib/uploadcare/rails/api/upload/upload_api.rb', line 27

def upload_files(files, options = {})
  return upload(files, options) if array_of_files?(files)

  raise TypeError, 'The first argument must be an Array of File objects'
end