Class: Spree::Customers::DataExport
- Inherits:
-
Object
- Object
- Spree::Customers::DataExport
- Includes:
- PersonalDataMatching
- Defined in:
- app/services/spree/customers/data_export.rb
Overview
Assembles everything a store holds about one person, for GDPR Art. 15 (right of access) and Art. 20 (portability).
Art. 20 asks for a "structured, commonly used and machine-readable" format, which is why this returns a plain hash destined for JSON rather than the CSV the admin exports use — a customer's data is nested, and flattening orders and their line items into a spreadsheet loses the structure the regulation asks to preserve.
Read-only and side-effect free: the caller decides whether the result is streamed, written to a file or attached to a request record.
Instance Method Summary collapse
- #call ⇒ Hash
-
#initialize(customer:, store: nil) ⇒ DataExport
constructor
A new instance of DataExport.
Constructor Details
#initialize(customer:, store: nil) ⇒ DataExport
Returns a new instance of DataExport.
24 25 26 27 |
# File 'app/services/spree/customers/data_export.rb', line 24 def initialize(customer:, store: nil) @customer = customer @store = store end |
Instance Method Details
#call ⇒ Hash
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/services/spree/customers/data_export.rb', line 30 def call { account: account, marketing_consent: , consent_records: , addresses: addresses, orders: orders, draft_orders: draft_orders, order_groups: order_groups, carts: carts, payment_sources: payment_sources, connected_logins: connected_logins, store_credits: store_credits, gift_cards: gift_cards, wishlists: wishlists, custom_fields: custom_fields, companies: companies, tax_identifiers: tax_identifiers, exported_at: Time.current.iso8601 } end |