Class: Booth::Adminland::Onboardings::Destroy

Inherits:
Object
  • Object
show all
Includes:
Logging, Calls
Defined in:
lib/booth/adminland/onboardings/destroy.rb

Instance Method Summary collapse

Instance Method Details

#callObject



12
13
14
15
16
# File 'lib/booth/adminland/onboardings/destroy.rb', line 12

def call
  do_verify_id
    .on_success { do_find_record }
    .on_success { do_destroy_record }
end

#do_destroy_recordObject



32
33
34
35
36
# File 'lib/booth/adminland/onboardings/destroy.rb', line 32

def do_destroy_record
  return Tron.success(:onboarding_deleted, id: record.id, credential_id:) if record.destroy

  Tron.failure :could_not_delete_onboarding, id: record.id, credential_id:
end

#do_find_recordObject



25
26
27
28
29
30
# File 'lib/booth/adminland/onboardings/destroy.rb', line 25

def do_find_record
  return Tron.success :record_found if record

  log { "Could not find Onboarding with ID #{id.inspect}" }
  Tron.failure :onboarding_not_found, id: nil, credential_id: nil
end

#do_verify_idObject



18
19
20
21
22
23
# File 'lib/booth/adminland/onboardings/destroy.rb', line 18

def do_verify_id
  return Tron.success :valid_id_syntax if id

  log { "Invalid Onboarding ID #{raw_id.inspect}" }
  Tron.failure :invalid_id_syntax, id:, credential_id: nil
end