Class: Ribose::CLI::Commands::File

Inherits:
Base
  • Object
show all
Defined in:
lib/ribose/cli/commands/file.rb

Instance Method Summary collapse

Instance Method Details

#add(file) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/ribose/cli/commands/file.rb', line 28

def add(file)
  file_upload = create_upload(file, options)

  if file_upload.id
    say("#{file_upload.name} added to your space!")
  end
end

#listObject



9
10
11
# File 'lib/ribose/cli/commands/file.rb', line 9

def list
  say(build_output(list_files(options), options))
end

#removeObject



54
55
56
57
# File 'lib/ribose/cli/commands/file.rb', line 54

def remove
  Ribose::SpaceFile.delete(options[:space_id], options[:file_id])
  say("The file has been removed from your space!")
end

#showObject



18
19
20
21
# File 'lib/ribose/cli/commands/file.rb', line 18

def show
  file = Ribose::SpaceFile.fetch(options[:space_id], options[:file_id])
  say(build_resource_output(file, options))
end

#updateObject



43
44
45
46
47
48
# File 'lib/ribose/cli/commands/file.rb', line 43

def update
  update_file(symbolize_keys(options))
  say("The file has been updated with new attributes")
rescue Ribose::UnprocessableEntity
  say("Something went wrong! Please check required attributes")
end