Class: Ribose::SpaceFile

Inherits:
Base
  • Object
show all
Includes:
Actions::All
Defined in:
lib/ribose/space_file.rb

Class Method Summary collapse

Methods included from Actions::All

#all

Methods included from Actions::Base

#included

Methods inherited from Base

#initialize

Methods included from ResourceHelper

#resource_id, #resource_key, #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`

Parameters:

  • space_id (String)

    The spcific space Id

  • options (Hash) (defaults to: {})

    Query parameters as a Hash

Returns:

  • (Array<Sawyer::Resource>)


17
18
19
# File 'lib/ribose/space_file.rb', line 17

def self.all(space_id, options = {})
  new(space_id: space_id, **options).all
end

.create(space_id, file:, **attributes) ⇒ Sawyer::Resource

Create a new file upload

Parameters:

  • space_id (String)

    The Space UUID

  • file (String)

    The complete path for the file

  • attributes (Hash)

    The file attributes as Hash

Returns:

  • (Sawyer::Resource)

    The file upload response.



28
29
30
31
# File 'lib/ribose/space_file.rb', line 28

def self.create(space_id, file:, **attributes)
  upload = FileUploader.upload(space_id, attributes.merge(file: file))
  upload[:attachment]
end