Class: DoiExtractor::CancelCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/doi_extractor/cancel_command.rb

Instance Attribute Summary

Attributes inherited from Command

#log, #options, #start_time, #std_out, #user_input_callback

Instance Method Summary collapse

Methods inherited from Command

#execute, for, #initialize

Constructor Details

This class inherits a constructor from DoiExtractor::Command

Instance Method Details

#_executeObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/doi_extractor/cancel_command.rb', line 3

def _execute
  doi = ipums_client.get_doi_extract(options.extract_group_id)
  unless doi
    fail('No extract group found')
  end

  if options.force
    say('skipping user confirmation', true)
  else
    i = ask("Are you sure you want to cancel DOI extract with ID #{doi.id}?")
    if i.to_s.downcase[0...1] != 'y'
      fail('user cancelled')
    end
  end

  ipums_client.cancel_doi_extract(doi.id)

  say("Complete")

end