Class: Chimps::Commands::Put

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

Constant Summary collapse

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

Send a GET request to the given PATH at Infochimps.

Examples:

  # update a dataset
  $ chimps put /datasets/my-dataset title="A new title"

  # update a source
  $ chimps put /sources/my-source --data=/path/to/new/metadata.yaml
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/put.rb', line 24

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