Class: Tessa::Upload

Inherits:
Object
  • Object
show all
Extended by:
ResponseFactory
Defined in:
lib/tessa/upload.rb

Defined Under Namespace

Classes: UploadsFile

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ResponseFactory

new_from_response

Class Method Details

.create(connection: Tessa.config.connection, strategy: Tessa.config.strategy, **options) ⇒ Object



19
20
21
22
23
# File 'lib/tessa/upload.rb', line 19

def self.create(connection: Tessa.config.connection,
                strategy: Tessa.config.strategy,
                **options)
  new_from_response connection.post('/uploads', options.merge(strategy: strategy))
end

Instance Method Details

#upload_file(file) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/tessa/upload.rb', line 10

def upload_file(file)
  if UploadsFile.new(upload: self).(file)
    asset.complete!
  else
    asset.cancel!
    false
  end
end