Sha256: bf24da348fed8b4f0784977527fcf5095238e82928cff0eadb3bd98cf8db824e
Contents?: true
Size: 1.17 KB
Versions: 4
Compression:
Stored size: 1.17 KB
Contents
class Quandl::Command::Tasks::List < Quandl::Command::Tasks::Base autoload_client_library 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
4 entries across 4 versions & 1 rubygems