Class: Tessa::Asset
- Inherits:
-
Object
- Object
- Tessa::Asset
- Extended by:
- ResponseFactory
- Defined in:
- lib/tessa/asset.rb
Defined Under Namespace
Classes: Failure
Class Method Summary collapse
Instance Method Summary collapse
- #cancel!(connection: Tessa.config.connection) ⇒ Object
- #complete!(connection: Tessa.config.connection) ⇒ Object
- #delete!(connection: Tessa.config.connection) ⇒ Object
- #failure? ⇒ Boolean
Methods included from ResponseFactory
Class Method Details
.create(file:, **options) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/tessa/asset.rb', line 32 def self.create(file:, **) = { size: File.size(file), name: File.basename(file), date: File.mtime(file), } Upload.create(.merge()).upload_file(file) end |
.find(*ids, connection: Tessa.config.connection) ⇒ Object
27 28 29 30 |
# File 'lib/tessa/asset.rb', line 27 def self.find(*ids, connection: Tessa.config.connection) new_from_response connection.get("/assets/#{ids.join(",")}") end |
Instance Method Details
#cancel!(connection: Tessa.config.connection) ⇒ Object
19 20 21 |
# File 'lib/tessa/asset.rb', line 19 def cancel!(connection: Tessa.config.connection) Asset.new_from_response connection.patch("/assets/#{id}/cancelled") end |
#complete!(connection: Tessa.config.connection) ⇒ Object
15 16 17 |
# File 'lib/tessa/asset.rb', line 15 def complete!(connection: Tessa.config.connection) Asset.new_from_response connection.patch("/assets/#{id}/completed") end |
#delete!(connection: Tessa.config.connection) ⇒ Object
23 24 25 |
# File 'lib/tessa/asset.rb', line 23 def delete!(connection: Tessa.config.connection) Asset.new_from_response connection.delete("/assets/#{id}") end |
#failure? ⇒ Boolean
41 42 43 |
# File 'lib/tessa/asset.rb', line 41 def failure? false end |