Class: Chimps::Commands::Destroy

Inherits:
Chimps::Command show all
Includes:
Utils::ActsOnResource
Defined in:
lib/chimps-cli/commands/destroy.rb

Overview

A command to issue a DELETE request against a resource at Infochimps.

Constant Summary collapse

USAGE =
"usage: chimps destroy [OPTIONS] [RESOURCE] ID_OR_SLUG"
HELP =
<<EOF

Destroys a #{default_resource_type} identified by the given ID or slug.

#{resources_listing}

You can only destroy resources that you own.

Examples:

  $ chimps destroy my-crappy-dataset
  $ chimps destroy source 7837
EOF

Instance Attribute Summary

Attributes inherited from Chimps::Command

#config

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils::ActsOnResource

#first_arg_is_resource_type?, #has_resource_identifier?, included, #plural_resource, #resource_identifier, #resource_path, #resource_type, #resources_path

Methods inherited from Chimps::Command

#initialize, name, #name

Constructor Details

This class inherits a constructor from Chimps::Command

Class Method Details

.allowed_modelsObject



10
11
12
# File 'lib/chimps-cli/commands/destroy.rb', line 10

def self.allowed_models
  %w[dataset source license]
end

Instance Method Details

#execute!Object



29
30
31
# File 'lib/chimps-cli/commands/destroy.rb', line 29

def execute!
  Request.new(resource_path, :sign => true).delete.print
end