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.
-
.fetch(space_id, file_id, options = {}) ⇒ Sawyer::Resource
Fetch a space file.
-
.update(space_id, file_id, attributes) ⇒ Sawyer::Resource
Update a space file.
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
44 45 46 47 |
# File 'lib/ribose/space_file.rb', line 44 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
65 66 67 |
# File 'lib/ribose/space_file.rb', line 65 def self.delete(space_id, file_id, = {}) new(space_id: space_id, resource_id: file_id, **).delete 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 |
.update(space_id, file_id, attributes) ⇒ Sawyer::Resource
Update a space file
56 57 58 |
# File 'lib/ribose/space_file.rb', line 56 def self.update(space_id, file_id, attributes) new(space_id: space_id, resource_id: file_id, **attributes).update end |