Class: Chimps::Commands::Update

Inherits:
Chimps::Command show all
Includes:
Utils::UsesModel, Utils::UsesYamlData
Defined in:
lib/chimps/commands/update.rb

Overview

A command to issue a PUT request to update a resource at Infochimps.

Constant Summary collapse

"usage: chimps update [OPTIONS] ID_OR_HANDLE [PROP=VALUE] ..."
HELP =
"\nUpdates a single resource of a given type (defaults to dataset)\nidentified by ID_OR_HANDLE using the properties and values supplied.\n\nProperties and values can be supplied directly on the command line,\nfrom an input YAML file, or multiple YAML documents streamed in via\nSTDIN, in order of decreasing precedence.\n"
MODELS =

Models this command applies to (default first)

%w[dataset source license]

Instance Attribute Summary

Attributes included from Utils::UsesYamlData

#data_file

Attributes inherited from Chimps::Command

#argv

Instance Method Summary collapse

Methods included from Utils::UsesYamlData

#data, #ignore_yaml_files_on_command_line

Methods included from Utils::UsesModel

#define_model_option, #model, #model=, #model_identifier, #model_path, #models_path, #models_string, #plural_model

Methods inherited from Chimps::Command

#initialize, name, #name

Constructor Details

This class inherits a constructor from Chimps::Command

Instance Method Details

#execute!Object

Issue the PUT request.



28
29
30
31
# File 'lib/chimps/commands/update.rb', line 28

def execute!
  ensure_data_is_present!
  Request.new(model_path, :data => {model.to_sym => data } , :authenticate => true).put.print
end

#ignore_first_arg_on_command_lineObject



23
24
25
# File 'lib/chimps/commands/update.rb', line 23

def ignore_first_arg_on_command_line
  true
end