Class: Ribose::SpaceFile
- Includes:
- Actions::All, Actions::Delete, Actions::Fetch, Actions::Update
- Defined in:
- lib/ribose/space_file.rb
Class Method Summary collapse
-
.all(space_id, options = {}) ⇒ Array<Sawyer::Resource>
List Files for Space.
-
.create(space_id, file:, **attributes) ⇒ Sawyer::Resource
Create a new file upload.
-
.delete(space_id, file_id, options = {}) ⇒ Object
Delete a space file.
-
.download(space_id, file_id, options = {}) ⇒ Object
Download a space file.
-
.fetch(space_id, file_id, options = {}) ⇒ Sawyer::Resource
Fetch a space file.
-
.fetch_icon(space_id, file_id, options = {}) ⇒ Sawyer::Resource
Fetch a space file icon.
-
.update(space_id, file_id, attributes) ⇒ Sawyer::Resource
Update a space file.
Instance Method Summary collapse
Methods included from Actions::Delete
Methods included from Actions::Base
Methods included from Actions::Update
Methods included from Actions::Fetch
Methods included from Actions::All
Methods inherited from Base
Methods included from ResourceHelper
#resource_id, #resource_path, #resources
Constructor Details
This class inherits a constructor from Ribose::Base
Class Method Details
.all(space_id, options = {}) ⇒ Array<Sawyer::Resource>
List Files for Space
This interface retrieves the files for any specific space, and the usages is pretty simple all we need to do, provide the space id and it will return the files as ‘Sawyer::Resource`
20 21 22 |
# File 'lib/ribose/space_file.rb', line 20 def self.all(space_id, = {}) new(space_id: space_id, **).all end |
.create(space_id, file:, **attributes) ⇒ Sawyer::Resource
Create a new file upload
59 60 61 62 |
# File 'lib/ribose/space_file.rb', line 59 def self.create(space_id, file:, **attributes) upload = FileUploader.upload(space_id, attributes.merge(file: file)) upload[:attachment] end |
.delete(space_id, file_id, options = {}) ⇒ Object
Delete a space file
80 81 82 |
# File 'lib/ribose/space_file.rb', line 80 def self.delete(space_id, file_id, = {}) new(space_id: space_id, resource_id: file_id, **).delete end |
.download(space_id, file_id, options = {}) ⇒ Object
Download a space file
47 48 49 50 |
# File 'lib/ribose/space_file.rb', line 47 def self.download(space_id, file_id, = {}) [:version_id] ||= fetch(space_id, file_id).current_version_id Ribose::FileVersion.download(space_id, file_id, **) end |
.fetch(space_id, file_id, options = {}) ⇒ Sawyer::Resource
Fetch a space file
This interface retrieve the details for a single file in any given user space. The response is a ‘Sawyer::Resource`.
33 34 35 |
# File 'lib/ribose/space_file.rb', line 33 def self.fetch(space_id, file_id, = {}) new(space_id: space_id, resource_id: file_id, **).fetch end |
.fetch_icon(space_id, file_id, options = {}) ⇒ Sawyer::Resource
Fetch a space file icon
94 95 96 |
# File 'lib/ribose/space_file.rb', line 94 def self.fetch_icon(space_id, file_id, = {}) new(space_id: space_id, resource_id: file_id, **).fetch_icon end |
.update(space_id, file_id, attributes) ⇒ Sawyer::Resource
Update a space file
71 72 73 |
# File 'lib/ribose/space_file.rb', line 71 def self.update(space_id, file_id, attributes) new(space_id: space_id, resource_id: file_id, **attributes).update end |