Sha256: 295c44bf32c98fd8f7252f1ebb5282f9ea869ea3c67b4812db852212db65e4b3
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
class Quandl::Command::Tasks::List < Quandl::Command::Tasks::Base description "List datasets matching conditions." options({ String => { match: "Only return datasets matching: [match]", source_code: "Return datasets matching: [SOURCE_CODE]" }, Integer => { limit: "How datasets to return per page.", page: "Return datasets starting from: [page]", } }) authenticated_users_only! def execute # find dataset debug "search_params: #{search_params}" dataset = Quandl::Client::Dataset.where( search_params ).fetch codes = dataset.collect(&:full_code) # fail on errors info codes.join("\n") end def search_params search_params = {} search_params[:query] = options.match if options.match.present? search_params[:source_code] = options.source_code.to_s.upcase if options.source_code.present? search_params[:per_page] = options.limit if options.limit.present? search_params[:page] = page search_params[:self_search] = search_params[:source_code].present? ? false : true search_params end def page options.page.to_i || 1 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
quandl-0.2.22 | lib/quandl/command/tasks/list.rb |