Sha256: dda57250c75dc7ed25b55ea66a367b18bd15fd36f1153ed3601cfe209e206e72

Contents?: true

Size: 911 Bytes

Versions: 8

Compression:

Stored size: 911 Bytes

Contents

class Quandl::Command::Tasks::Delete < Quandl::Command::Task
  
  autoload_quandl_client
  authenticated_users_only!
  
  description "Delete a dataset by its quandl code."
  syntax %Q{quandl delete (SOURCE_CODE/)CODE

    EXAMPLES:

      $ quandl delete TEST
      Are you sure? (y/n)
      
      $ quandl delete TEST TEST2 TEST3 --force-yes
      Deleted | 164ms | TEST
      Deleted | 134ms | TEST2
      Deleted | 124ms | TEST3
      
      $ quandl list --match TEST | quandl delete --force-yes
    
      $ cat ids.txt | quandl delete --force-yes}

  def execute
    each_line_in_background( args_or_stdin ) do |code|
      # find
      dataset = Quandl::Client::Dataset.find( code )
      # destroy
      dataset.destroy if dataset.respond_to?(:destroy) && dataset.exists? && confirmed?("Are you sure you want to delete #{dataset.full_code}?")
      # present
      present dataset
    end
  end
  
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
quandl-0.4.4 lib/quandl/command/tasks/delete.rb
quandl-0.4.3 lib/quandl/command/tasks/delete.rb
quandl-0.4.2 lib/quandl/command/tasks/delete.rb
quandl-0.4.1 lib/quandl/command/tasks/delete.rb
quandl-0.4.0 lib/quandl/command/tasks/delete.rb
quandl-0.3.7 lib/quandl/command/tasks/delete.rb
quandl-0.3.6 lib/quandl/command/tasks/delete.rb
quandl-0.3.4 lib/quandl/command/tasks/delete.rb