Sha256: fa103520fa905a132b7c99ee79c06c3bb66f7b26e1a0885d68d6801cf4fd3b48
Contents?: true
Size: 1.6 KB
Versions: 2
Compression:
Stored size: 1.6 KB
Contents
class Quandl::Command::Tasks::Upload < Quandl::Command::Task autoload_quandl_client description "Upload one or more datasets." 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 } 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 t1 = Time.now Quandl::Format::Dataset.each_line(interface) do |dataset, error| # present error if given next present( error ) unless error.nil? # process in background using thread key background_job do # upload upload( dataset ) debug("#{dataset.full_code.to_s.ljust(20)} TOTAL: #{t1.elapsed_ms.ljust(20)} BREAKDOWN: #{dataset.client.human_benchmarks}") if dataset.respond_to?(:full_code) end t1 = Time.now end end def upload(dataset) # upload unless errors were raised dataset.upload if dataset.valid? # output report to $stdout or $stderr present(dataset.client) end def file_path args.first end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
quandl-0.4.4 | lib/quandl/command/tasks/upload.rb |
quandl-0.4.3 | lib/quandl/command/tasks/upload.rb |