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! ⇒ Object
-
#initialize(options) ⇒ Submit
constructor
A new instance of Submit.
Methods inherited from TempestTime::Command
#command, #date_prompt, #execute, #pastel, #prompt, #spinner, #table, #week_prompt, #with_spinner, #with_success_fail_spinner
Methods included from Helpers::GitHelper
Methods included from Helpers::FormattingHelper
Methods included from Helpers::TimeHelper
#beginning_of_week, #dates_in_range, #end_of_week, #formatted_date, #formatted_date_range, #formatted_time, #formatted_time_for_input, #formatted_time_long, #future_dates, #parsed_time, #past_dates, #past_week_selections, #week_beginnings, #week_dates
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() @options = end |
Instance Method Details
#execute! ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/tempest_time/commands/submit.rb', line 13 def execute! reviewer = prompt.ask('Who should review this timesheet? (username)') dates = week_dates(week_prompt('Select a week to submit.')) = 'Submit the selected 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 your timesheet...') do TempoAPI::Requests::SubmitTimesheet.new(reviewer, dates).send_request end end |