Class: Privacy::ScrubService
- Inherits:
-
Object
- Object
- Privacy::ScrubService
- Defined in:
- app/services/privacy/scrub_service.rb
Overview
Service object: tier 1+2 PII scrub for a Party.
Defined Under Namespace
Classes: Result
Constant Summary collapse
- REDACTED_NAME =
Placeholder values shared across the codebase so a partial scrub is
detectable later (e.g. find_each onfull_name ILIKE 'REDACTED-%'). 'REDACTED'- REDACTED_CITY =
'REDACTED'- REDACTED_ZIP =
'00000'- REDACTED_DOMAIN =
'privacy.warmlyyours.com'
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(party:) ⇒ ScrubService
constructor
A new instance of ScrubService.
Constructor Details
#initialize(party:) ⇒ ScrubService
Returns a new instance of ScrubService.
45 46 47 48 |
# File 'app/services/privacy/scrub_service.rb', line 45 def initialize(party:) @party = party @summary = {} end |
Class Method Details
.call(party:) ⇒ Object
41 42 43 |
# File 'app/services/privacy/scrub_service.rb', line 41 def self.call(party:) new(party: party).call end |
Instance Method Details
#call ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'app/services/privacy/scrub_service.rb', line 50 def call ActiveRecord::Base.transaction do scrub_tier_1! scrub_tier_2! destroy_account! purge_paper_trail! end Result.new(scrubbed?: true, summary: @summary, error: nil) rescue StandardError => e Rails.logger.error "Privacy::ScrubService failed for party=#{@party&.id}: #{e.class}: #{e.}" Result.new(scrubbed?: false, summary: @summary, error: "#{e.class}: #{e.}") end |