Class: Klaviyo::DataPrivacy

Inherits:
Client
  • Object
show all
Defined in:
lib/klaviyo/apis/data_privacy.rb

Constant Summary collapse

DATA_PRIVACY =
'data-privacy'
DELETION_REQUEST =
'deletion-request'

Constants inherited from Client

Client::ALL, Client::BASE_API_URL, Client::CONTENT_JSON, Client::CONTENT_URL_FORM, Client::DEFAULT_COUNT, Client::DEFAULT_PAGE, Client::DEFAULT_SORT_DESC, Client::HTTP_DELETE, Client::HTTP_GET, Client::HTTP_POST, Client::HTTP_PUT, Client::METRIC, Client::METRICS, Client::TIMELINE, Client::V1_API, Client::V2_API

Class Method Summary collapse

Class Method Details

.request_profile_deletion(id_type, identifier) ⇒ Object

Submits a data privacy-related deletion request

Parameters:

  • id_type (String)

    ‘email’ or ‘phone_number’ or ‘person_id

  • identifier (String)

    value for the identifier specified

Returns:

  • a dictionary with a confirmation that deletion task submitted for the customer



10
11
12
13
14
15
16
17
# File 'lib/klaviyo/apis/data_privacy.rb', line 10

def self.request_profile_deletion(id_type, identifier)
  unless ['email', 'phone_number', 'person_id'].include? id_type
    raise Klaviyo::KlaviyoError.new(INVALID_ID_TYPE_ERROR)
  end
  identifier = { id_type => identifier }      
  path = "#{DATA_PRIVACY}/#{DELETION_REQUEST}"
  v2_request(HTTP_POST, path, identifier)
end