Module: CommandTower::Services::Account::Push::CtSupport
- Defined in:
- app/services/command_tower/services/account/push/ct_support.rb
Overview
Shared CT Endpoints helpers for Account push capability services.
Class Method Summary collapse
Class Method Details
.ensure_verified!(owner_user_id:, safe_view:) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/services/command_tower/services/account/push/ct_support.rb', line 11 def ensure_verified!(owner_user_id:, safe_view:) return safe_view if safe_view.verification_state.to_s == "verified" CommandTower::Messaging::Endpoints.mark_verified( owner_user_id:, endpoint_id: safe_view.id, ) end |
.map_ct_exception!(error) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/services/command_tower/services/account/push/ct_support.rb', line 20 def map_ct_exception!(error) case error when CommandTower::Messaging::Endpoints::NotFoundError CommandTower::Errors::Account::PushEndpointNotFoundError.new when CommandTower::Messaging::Endpoints::ValidationError if error..to_s.include?("disabled") CommandTower::Errors::Account::PushCapabilityUnavailableError.new else CommandTower::Errors::ValidationError.new(details: { base: "Invalid push token" }) end else CommandTower::Errors::InternalError.new end end |