Sha256: cc1b08bb77d2ede7f01299ad1667f76fb1a71957f23f07ffae0da4ca1c895a0f
Contents?: true
Size: 1.68 KB
Versions: 4
Compression:
Stored size: 1.68 KB
Contents
class Quandl::Command::Tasks::Upload < Quandl::Command::Tasks::Base autoload_client_library description "Upload a dataset using its quandl code." syntax %{quandl upload file.qdf Examples: $ quandl upload file.qcsv OK | 98ms | http://quandl.com/USERNAME/CODE_1 OK | 72ms | http://quandl.com/USERNAME/CODE_2 $ ruby code.rb | quandl upload OK | 98ms | http://quandl.com/USERNAME/CODE_1 OK | 72ms | http://quandl.com/USERNAME/CODE_2 Quandl CSV Format: code: YOUR_QUANDL_CODE name: Dataset Title description: Dataset description. private: false - Date, First, Second, Third 2013-11-22,1252.0,454.95,448.2 2013-11-21,452.25,457.75,449.1 } options({ Integer => { threads: "How many workers to use during download.", } }) authenticated_users_only! def execute # datasets from file_path if given interface = file_path.present? ? File.open(file_path, "r") : $stdin # for each dataset streamed from interface Quandl::Format::Dataset.each_line(interface) do |dataset| pool.process{ upload( dataset ) } end pool.shutdown end def upload(dataset) # display debug info when verbose debug dataset.attributes.to_s # upload dataset.upload if dataset.valid? # output report to $stdout or $stderr report(dataset) end def report(dataset) if [200,201].include?( dataset.client.status ) info table dataset.client.human_status, dataset.client.elapsed_request_time_ms, dataset.client.full_url else error(dataset.human_errors) end debug "---" end def file_path args.first end end
Version data entries
4 entries across 4 versions & 1 rubygems