Class: Chimps::Commands::List
- Inherits:
-
Chimps::Command
- Object
- Chimps::Command
- Chimps::Commands::List
- Includes:
- Utils::ActsOnResource, Utils::HttpFormat
- Defined in:
- lib/chimps-cli/commands/list.rb
Overview
A command to issue a GET request against an index of resources at Infochimps.
Constant Summary collapse
- USAGE =
"usage: chimps [OPTIONS] list [RESOURCE]"
- HELP =
<<EOF List #{default_resources_type} on Infochimps. #{resources_listing} Examples: $ chimps list # list all datasets $ chimps list --my # list your datasets $ chimps list licenses # list licenses $ chimps list --my sources # list your sources EOF
Instance Attribute Summary
Attributes inherited from Chimps::Command
Class Method Summary collapse
Instance Method Summary collapse
-
#execute! ⇒ Object
Issue the GET request.
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 included from Utils::HttpFormat
#headers, included, #normalize_fmt
Methods inherited from Chimps::Command
Constructor Details
This class inherits a constructor from Chimps::Command
Class Method Details
.allowed_resources ⇒ Object
19 20 21 |
# File 'lib/chimps-cli/commands/list.rb', line 19 def self.allowed_resources %w[collection dataset source license] end |
.allowed_response_fmts ⇒ Object
15 16 17 |
# File 'lib/chimps-cli/commands/list.rb', line 15 def self.allowed_response_fmts super().concat(['tsv']) end |
.default_response_fmt ⇒ Object
11 12 13 |
# File 'lib/chimps-cli/commands/list.rb', line 11 def self.default_response_fmt 'tsv' end |
Instance Method Details
#execute! ⇒ Object
Issue the GET request.
39 40 41 42 43 |
# File 'lib/chimps-cli/commands/list.rb', line 39 def execute! query_params = {} query_params[:skip_header] = true if config[:skip_column_names] Request.new(resources_path, :query_params => query_params, :sign => config[:my]).get(headers).print(config) end |