Class: Chimps::Commands::Get

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

Constant Summary collapse

USAGE =
"usage: chimps get [OPTIONS] PATH"
HELP =
<<EOF

Send a GET request to the given PATH at Infochimps.

Examples:

  $ chimps get /datasets                        # list datasets (#{default_response_fmt} by default)
  $ chimps get /datasets --response_format=yaml # in YAML
  $ chimps get /sources/1.xml                   # look at source 1 in XML
EOF

Instance Attribute Summary

Attributes inherited from Chimps::Command

#config

Instance Method Summary collapse

Methods included from Utils::ExplicitPath

#path, #query_params, #raw_path

Methods included from Utils::HttpFormat

#headers, included, #normalize_fmt

Methods inherited from Chimps::Command

#initialize, name, #name

Constructor Details

This class inherits a constructor from Chimps::Command

Instance Method Details

#execute!Object



21
22
23
24
25
# File 'lib/chimps-cli/commands/get.rb', line 21

def execute!
  response = Chimps::Request.new(path, :query_params => query_params, :sign => config[:sign]).get(headers)
  response.print_headers if config[:headers]
  response.print
end