Class: Chimps::Commands::Show

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

Constant Summary collapse

USAGE =
"usage: chimps show [OPTIONS] [RESOURCE] SLUG_OR_ID"
HELP =
<<EOF

Return a description of the #{default_resource_type} with the given
ID or or slug.

#{resources_listing}

Examples:

  $ chimps show musicbrainz           # show musicbrainz dataset
  $ chimps show 11598                 # show musicbrainz dataset
  $ chimps show source musicbrainzorg # show musicbrainz.org source page
  $ chimps show user Infochimps       # show Infochimps' user page
EOF

Instance Attribute Summary

Attributes inherited from Chimps::Command

#config

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils::HttpFormat

#headers, included, #normalize_fmt

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_resourcesObject



13
14
15
# File 'lib/chimps-cli/commands/show.rb', line 13

def self.allowed_resources
  %w[dataset collection source license user]
end

.default_response_fmtObject



9
10
11
# File 'lib/chimps-cli/commands/show.rb', line 9

def self.default_response_fmt
  'yaml'
end

Instance Method Details

#execute!Object



33
34
35
# File 'lib/chimps-cli/commands/show.rb', line 33

def execute!
  puts Chimps::Request.new(resource_path + ".#{response_fmt}").get.body
end