Class: Chimps::Commands::Post

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

Constant Summary collapse

USAGE =
"usage: chimps post [OPTIONS] PATH [PARAM=VALUE] ..."
HELP =
<<EOF

Send a GET request to the given PATH at Infochimps.

Examples:

  # create a dataset
  $ chimps post /datasets title="List of Chimps" description="Awesome..."

  # create a source
  $ chimps post /sources --data=/path/to/some/metadata.json
EOF

Instance Attribute Summary

Attributes inherited from Chimps::Command

#config

Instance Method Summary collapse

Methods included from Utils::UsesParamValueData

#data, included

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



24
25
26
27
28
# File 'lib/chimps-cli/commands/post.rb', line 24

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