Class: Commands::Remove
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(client, params) ⇒ Remove
constructor
A new instance of Remove.
Methods included from DriveError
Methods included from CommandMixin
Constructor Details
#initialize(client, params) ⇒ Remove
Returns a new instance of Remove.
17 18 19 20 |
# File 'lib/gdsh/remove.rb', line 17 def initialize(client, params) super(client, params) @file_id = @params[1] end |
Class Method Details
.command_name ⇒ Object
5 6 7 |
# File 'lib/gdsh/remove.rb', line 5 def self.command_name 'rm' end |
.function ⇒ Object
13 14 15 |
# File 'lib/gdsh/remove.rb', line 13 def self.function 'Removes the file.' end |
.parameters ⇒ Object
9 10 11 |
# File 'lib/gdsh/remove.rb', line 9 def self.parameters '(<file_id>)' end |
Instance Method Details
#execute ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/gdsh/remove.rb', line 22 def execute drive = @client.discovered_api('drive', 'v2') result = @client.execute( api_method: drive.files.trash, parameters: { fileId: @file_id }) if result.status != 200 puts drive_error_string else puts 'Deleted.'.colorize(:green) end end |