klaviyo 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/klaviyo.gemspec +2 -2
- data/lib/klaviyo/apis/data_privacy.rb +19 -0
- data/lib/klaviyo/apis/profiles.rb +14 -0
- data/lib/klaviyo/klaviyo_module.rb +2 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28360ee80e88095a3cab7c279740506e843483536659a59b2ac4473e2163e489
|
4
|
+
data.tar.gz: 68e8e4561cdb1790f786b195a83ae3ea557aaf69ff9c7c9356b09cee33f724d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46def1393ec8838ccfe6c966f0aa0e0651fa3354b6c580a42e764245636aab1e7cc7894d221c405fd23abed2c7bed2ea3a0cc3f1b04841f2ee061538bf5297b0
|
7
|
+
data.tar.gz: 4d5bd8ee0ae050dc333c0b2cf5b3c4be06875a08ea9b6bfa1c3479f755b0d44c255facc7c6cafec76d094714ed74e8bb94ac137fe302b22f29ac12e9477e5bb0
|
data/klaviyo.gemspec
CHANGED
@@ -2,8 +2,8 @@ files = ['klaviyo.gemspec', '{lib}/**/**/*'].map {|f| Dir[f]}.flatten
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'klaviyo'
|
5
|
-
s.version = '2.0.
|
6
|
-
s.date = '2021-
|
5
|
+
s.version = '2.0.4'
|
6
|
+
s.date = '2021-04-02'
|
7
7
|
s.summary = 'You heard us, a Ruby wrapper for the Klaviyo API'
|
8
8
|
s.description = 'Ruby wrapper for the Klaviyo API'
|
9
9
|
s.authors = ['Klaviyo Team']
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Klaviyo
|
2
|
+
class DataPrivacy < Client
|
3
|
+
DATA_PRIVACY = 'data-privacy'
|
4
|
+
DELETION_REQUEST = 'deletion-request'
|
5
|
+
|
6
|
+
# Submits a data privacy-related deletion request
|
7
|
+
# @param id_type [String] 'email' or 'phone_number' or 'person_id
|
8
|
+
# @param identifier [String] value for the identifier specified
|
9
|
+
# @return a dictionary with a confirmation that deletion task submitted for the customer
|
10
|
+
def self.request_profile_deletion(id_type, identifier)
|
11
|
+
unless ['email', 'phone_number', 'person_id'].include? id_type
|
12
|
+
raise Klaviyo::KlaviyoError.new(INVALID_ID_TYPE_ERROR)
|
13
|
+
end
|
14
|
+
identifier = { id_type => identifier }
|
15
|
+
path = "#{DATA_PRIVACY}/#{DELETION_REQUEST}"
|
16
|
+
v2_request(HTTP_POST, path, identifier)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -1,6 +1,20 @@
|
|
1
1
|
module Klaviyo
|
2
2
|
class Profiles < Client
|
3
3
|
PERSON = 'person'
|
4
|
+
PEOPLE = 'people'
|
5
|
+
SEARCH = 'search'
|
6
|
+
|
7
|
+
# Retrieves the id of the profile given email
|
8
|
+
# @param email [String] the email of the profile
|
9
|
+
# @return [JSON] a JSON object containing id of the profile
|
10
|
+
def self.get_profile_id_by_email(email)
|
11
|
+
path = "#{PEOPLE}/#{SEARCH}"
|
12
|
+
params = {
|
13
|
+
:email => email
|
14
|
+
}
|
15
|
+
v2_request(HTTP_GET, path, params)
|
16
|
+
end
|
17
|
+
|
4
18
|
|
5
19
|
# Retrieve all the data attributes for a Klaviyo Person ID.
|
6
20
|
# @param person_id [String] the id of the profile
|
@@ -9,6 +9,7 @@ require_relative 'apis/lists'
|
|
9
9
|
require_relative 'apis/metrics'
|
10
10
|
require_relative 'apis/profiles'
|
11
11
|
require_relative 'apis/campaigns'
|
12
|
+
require_relative 'apis/data_privacy'
|
12
13
|
|
13
14
|
module Klaviyo
|
14
15
|
class << self
|
@@ -21,4 +22,5 @@ module Klaviyo
|
|
21
22
|
NO_PRIVATE_API_KEY_ERROR = 'Please provide your Private API key for this request'
|
22
23
|
NO_PUBLIC_API_KEY_ERROR = 'Please provide your Public API key for this request'
|
23
24
|
REQUIRED_ARG_ERROR = 'You must identify a user by email, ID or phone_number'
|
25
|
+
INVALID_ID_TYPE_ERROR = 'Invalid id_type provided, must be one of: email, phone_number, person_id'
|
24
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: klaviyo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Klaviyo Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- klaviyo.gemspec
|
76
76
|
- lib/klaviyo.rb
|
77
77
|
- lib/klaviyo/apis/campaigns.rb
|
78
|
+
- lib/klaviyo/apis/data_privacy.rb
|
78
79
|
- lib/klaviyo/apis/lists.rb
|
79
80
|
- lib/klaviyo/apis/metrics.rb
|
80
81
|
- lib/klaviyo/apis/profiles.rb
|