Class: Klaviyo::Profiles
Constant Summary collapse
- PERSON =
'person'
- PEOPLE =
'people'
- SEARCH =
'search'
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::KL_USER_AGENT, Client::KL_VERSION, Client::METRIC, Client::METRICS, Client::TIMELINE, Client::V1_API, Client::V2_API
Class Method Summary collapse
-
.get_person_attributes(person_id, api_key: nil) ⇒ Object
Retrieve all the data attributes for a Klaviyo Person ID.
-
.get_person_metric_timeline(person_id, metric_id, since: nil, count: DEFAULT_COUNT, sort: DEFAULT_SORT_DESC, api_key: nil) ⇒ Object
Listing a person’s event timeline for a particular metric.
-
.get_person_metrics_timeline(person_id, since: nil, count: DEFAULT_COUNT, sort: DEFAULT_SORT_DESC, api_key: nil) ⇒ Object
Listing a person’s event timeline.
-
.get_profile_id_by_email(email, api_key: nil) ⇒ JSON
Retrieves the id of the profile given email.
-
.update_person_attributes(person_id, kwargs = {}) ⇒ Object
Add or update one more more attributes for a Person.
Class Method Details
.get_person_attributes(person_id, api_key: nil) ⇒ Object
Retrieve all the data attributes for a Klaviyo Person ID.
23 24 25 26 |
# File 'lib/klaviyo/apis/profiles.rb', line 23 def self.get_person_attributes(person_id, api_key: nil) path = "#{PERSON}/#{person_id}" v1_request(HTTP_GET, path, api_key: api_key) end |
.get_person_metric_timeline(person_id, metric_id, since: nil, count: DEFAULT_COUNT, sort: DEFAULT_SORT_DESC, api_key: nil) ⇒ Object
Listing a person’s event timeline for a particular metric
62 63 64 65 66 67 68 69 70 |
# File 'lib/klaviyo/apis/profiles.rb', line 62 def self.get_person_metric_timeline(person_id, metric_id, since: nil, count: DEFAULT_COUNT, sort: DEFAULT_SORT_DESC, api_key: nil) path = "#{PERSON}/#{person_id}/#{METRIC}/#{metric_id}/#{TIMELINE}" params = { :since => since, :count => count, :sort => sort } v1_request(HTTP_GET, path, api_key: api_key, **params) end |
.get_person_metrics_timeline(person_id, since: nil, count: DEFAULT_COUNT, sort: DEFAULT_SORT_DESC, api_key: nil) ⇒ Object
Listing a person’s event timeline
44 45 46 47 48 49 50 51 52 |
# File 'lib/klaviyo/apis/profiles.rb', line 44 def self.get_person_metrics_timeline(person_id, since: nil, count: DEFAULT_COUNT, sort: DEFAULT_SORT_DESC, api_key: nil) path = "#{PERSON}/#{person_id}/#{METRICS}/#{TIMELINE}" params = { :since => since, :count => count, :sort => sort } v1_request(HTTP_GET, path, api_key: api_key, **params) end |
.get_profile_id_by_email(email, api_key: nil) ⇒ JSON
Retrieves the id of the profile given email
11 12 13 14 15 16 17 |
# File 'lib/klaviyo/apis/profiles.rb', line 11 def self.get_profile_id_by_email(email, api_key: nil) path = "#{PEOPLE}/#{SEARCH}" params = { :email => email } v2_request(HTTP_GET, path, api_key: api_key, **params) end |
.update_person_attributes(person_id, kwargs = {}) ⇒ Object
Add or update one more more attributes for a Person
32 33 34 35 |
# File 'lib/klaviyo/apis/profiles.rb', line 32 def self.update_person_attributes(person_id, kwargs = {}) path = "#{PERSON}/#{person_id}" v1_request(HTTP_PUT, path, **kwargs) end |