Class: TempestTime::Commands::Submit
- Inherits:
-
TempestTime::Command
- Object
- TempestTime::Command
- TempestTime::Commands::Submit
- Defined in:
- lib/tempest_time/commands/submit.rb
Instance Method Summary collapse
- #execute(input: $stdin, output: $stdout) ⇒ Object
-
#initialize(options) ⇒ Submit
constructor
A new instance of Submit.
Methods inherited from TempestTime::Command
#command, #pastel, #prompt, #spinner, #table, #with_spinner, #with_success_fail_spinner
Constructor Details
#initialize(options) ⇒ Submit
Returns a new instance of Submit.
9 10 11 |
# File 'lib/tempest_time/commands/submit.rb', line 9 def initialize() = end |
Instance Method Details
#execute(input: $stdin, output: $stdout) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/tempest_time/commands/submit.rb', line 13 def execute(input: $stdin, output: $stdout) # Command logic goes here ... reviewer = prompt.ask('Who should review this timesheet? (username)') = "Submit this week's timesheet to " + pastel.green(reviewer) + '?' abort unless prompt.yes?() abort unless prompt.yes?('Are you sure? No edits can be made once submitted!') with_success_fail_spinner("Submitting this week's timesheet...") do TempoAPI::Requests::SubmitTimesheet.new(reviewer).send_request end end |