Module: QTimetrap::Services::TimetrapGatewayUpdateNoteHelpers

Included in:
TimetrapGateway
Defined in:
app/services/timetrap_gateway_update_note_helpers.rb

Overview

Note update workflow for Timetrap API/CLI adapters.

Instance Method Summary collapse

Instance Method Details

#update_note(entry_id, note) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/services/timetrap_gateway_update_note_helpers.rb', line 7

def update_note(entry_id, note)
  normalized_id = entry_id.to_i
  normalized_note = normalize_text(note).strip
  return if normalized_id.zero?

  if api_available?
    logger.log_api(
      operation: 'update_note',
      input: { entry_id: normalized_id, note: normalized_note },
      output: 'requested'
    )
    result = update_note_via_api(normalized_id, normalized_note)
    logger.log_api(operation: 'update_note', input: {}, output: result.to_s)
    return result
  end

  update_note_via_cli(normalized_id, normalized_note)
end