Class: KlaviyoAPI::EventsApi
- Inherits:
-
Object
- Object
- KlaviyoAPI::EventsApi
- Defined in:
- lib/klaviyo-api-sdk/api/events_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#create_event(event_create_query_v2, opts = {}) ⇒ nil
Create Event Create a new event to track a profile’s activity.
-
#create_event_with_http_info(event_create_query_v2, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Create Event Create a new event to track a profile's activity.
-
#get_event(id, opts = {}) ⇒ Hash<String, Object>
Get Event Get an event with the given event ID.
*Rate limits*:
Burst: ‘10/s`
Steady: `150/m` Scopes: `events:read`. -
#get_event_metric(id, opts = {}) ⇒ Hash<String, Object>
Get Event Metric Get the metric for an event with the given event ID.
*Rate limits*:
Burst: ‘350/s`
Steady: `3500/m` Scopes: `events:read` `metrics:read`. -
#get_event_metric_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Get Event Metric Get the metric for an event with the given event ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` Scopes: `events:read` `metrics:read`.
-
#get_event_profile(id, opts = {}) ⇒ Hash<String, Object>
Get Event Profile Get the profile associated with an event with the given event ID.
*Rate limits*:
Burst: ‘350/s`
Steady: `3500/m` Scopes: `events:read` `profiles:read`. -
#get_event_profile_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Get Event Profile Get the profile associated with an event with the given event ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` Scopes: `events:read` `profiles:read`.
-
#get_event_relationships_metric(id, opts = {}) ⇒ Hash<String, Object>
Get Event Relationships Metric Get a list of related Metrics for an Event
*Rate limits*:
Burst: ‘350/s`
Steady: `3500/m` Scopes: `events:read` `metrics:read`. -
#get_event_relationships_metric_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Get Event Relationships Metric Get a list of related Metrics for an Event<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` Scopes: `events:read` `metrics:read`.
-
#get_event_relationships_profile(id, opts = {}) ⇒ Hash<String, Object>
Get Event Relationships Profile Get profile [relationships](developers.klaviyo.com/en/reference/api_overview#relationships) for an event with the given event ID.
*Rate limits*:
Burst: ‘350/s`
Steady: `3500/m` Scopes: `events:read` `profiles:read`. -
#get_event_relationships_profile_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Get Event Relationships Profile Get profile [relationships](developers.klaviyo.com/en/reference/api_overview#relationships) for an event with the given event ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` Scopes: `events:read` `profiles:read`.
-
#get_event_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Get Event Get an event with the given event ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` Scopes: `events:read`.
-
#get_events(opts = {}) ⇒ Hash<String, Object>
Get Events Get all events in an account Requests can be sorted by the following fields: ‘datetime`, `timestamp` Returns a maximum of 200 events per page.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` Scopes: `events:read`. -
#get_events_with_http_info(opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Get Events Get all events in an account Requests can be sorted by the following fields: `datetime`, `timestamp` Returns a maximum of 200 events per page.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` Scopes: `events:read`.
-
#initialize(api_client = ApiClient.default) ⇒ EventsApi
constructor
A new instance of EventsApi.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/klaviyo-api-sdk/api/events_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#create_event(event_create_query_v2, opts = {}) ⇒ nil
Create Event Create a new event to track a profile’s activity. Successful response indicates that the event was validated and submitted for processing, but does not guarantee that processing is complete.
*Rate limits*:
Burst: ‘350/s`
Steady: `3500/m` Scopes: `events:write`
27 28 29 30 |
# File 'lib/klaviyo-api-sdk/api/events_api.rb', line 27 def create_event(event_create_query_v2, opts = {}) create_event_with_http_info(event_create_query_v2, opts) nil end |
#create_event_with_http_info(event_create_query_v2, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Create Event Create a new event to track a profile's activity. Successful response indicates that the event was validated and submitted for processing, but does not guarantee that processing is complete.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` Scopes: `events:write`
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/klaviyo-api-sdk/api/events_api.rb', line 37 def create_event_with_http_info(event_create_query_v2, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EventsApi.create_event ...' end # verify the required parameter 'event_create_query_v2' is set if @api_client.config.client_side_validation && event_create_query_v2.nil? fail ArgumentError, "Missing the required parameter 'event_create_query_v2' when calling EventsApi.create_event" end # resource path local_var_path = '/api/events/' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['API_REVISION'] || "2024-02-15" # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(event_create_query_v2) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] = opts.merge( :operation => :"EventsApi.create_event", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: EventsApi#create_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_event(id, opts = {}) ⇒ Hash<String, Object>
Get Event Get an event with the given event ID.
*Rate limits*:
Burst: ‘10/s`
Steady: `150/m` Scopes: `events:read`
101 102 103 104 |
# File 'lib/klaviyo-api-sdk/api/events_api.rb', line 101 def get_event(id, opts = {}) data, _status_code, _headers = get_event_with_http_info(id, opts) data end |
#get_event_metric(id, opts = {}) ⇒ Hash<String, Object>
Get Event Metric Get the metric for an event with the given event ID.
*Rate limits*:
Burst: ‘350/s`
Steady: `3500/m` Scopes: `events:read` `metrics:read`
191 192 193 194 |
# File 'lib/klaviyo-api-sdk/api/events_api.rb', line 191 def get_event_metric(id, opts = {}) data, _status_code, _headers = get_event_metric_with_http_info(id, opts) data end |
#get_event_metric_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Get Event Metric Get the metric for an event with the given event ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` Scopes: `events:read` `metrics:read`
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/klaviyo-api-sdk/api/events_api.rb', line 202 def get_event_metric_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EventsApi.get_event_metric ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling EventsApi.get_event_metric" end allowable_values = ["name", "created", "updated", "integration"] if @api_client.config.client_side_validation && opts[:'fields_metric'] && !opts[:'fields_metric'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"fields_metric\", must include one of #{allowable_values}" end # resource path local_var_path = '/api/events/{id}/metric/'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'fields[metric]'] = @api_client.build_collection_param(opts[:'fields_metric'], :csv) if !opts[:'fields_metric'].nil? # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['API_REVISION'] || "2024-02-15" # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Hash<String, Object>' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] = opts.merge( :operation => :"EventsApi.get_event_metric", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: EventsApi#get_event_metric\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_event_profile(id, opts = {}) ⇒ Hash<String, Object>
Get Event Profile Get the profile associated with an event with the given event ID.
*Rate limits*:
Burst: ‘350/s`
Steady: `3500/m` Scopes: `events:read` `profiles:read`
264 265 266 267 |
# File 'lib/klaviyo-api-sdk/api/events_api.rb', line 264 def get_event_profile(id, opts = {}) data, _status_code, _headers = get_event_profile_with_http_info(id, opts) data end |
#get_event_profile_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Get Event Profile Get the profile associated with an event with the given event ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` Scopes: `events:read` `profiles:read`
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
# File 'lib/klaviyo-api-sdk/api/events_api.rb', line 276 def get_event_profile_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EventsApi.get_event_profile ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling EventsApi.get_event_profile" end allowable_values = ["subscriptions", "predictive_analytics"] if @api_client.config.client_side_validation && opts[:'additional_fields_profile'] && !opts[:'additional_fields_profile'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"additional_fields_profile\", must include one of #{allowable_values}" end allowable_values = ["email", "phone_number", "external_id", "first_name", "last_name", "organization", "title", "image", "created", "updated", "last_event_date", "location", "location.address1", "location.address2", "location.city", "location.country", "location.latitude", "location.longitude", "location.region", "location.zip", "location.timezone", "location.ip", "properties", "subscriptions", "subscriptions.email", "subscriptions.email.marketing", "subscriptions.email.marketing.can_receive_email_marketing", "subscriptions.email.marketing.consent", "subscriptions.email.marketing.consent_timestamp", "subscriptions.email.marketing.last_updated", "subscriptions.email.marketing.method", "subscriptions.email.marketing.method_detail", "subscriptions.email.marketing.custom_method_detail", "subscriptions.email.marketing.double_optin", "subscriptions.email.marketing.suppression", "subscriptions.email.marketing.list_suppressions", "subscriptions.sms", "subscriptions.sms.marketing", "subscriptions.sms.marketing.can_receive_sms_marketing", "subscriptions.sms.marketing.consent", "subscriptions.sms.marketing.consent_timestamp", "subscriptions.sms.marketing.method", "subscriptions.sms.marketing.method_detail", "subscriptions.sms.marketing.last_updated", "predictive_analytics", "predictive_analytics.historic_clv", "predictive_analytics.predicted_clv", "predictive_analytics.total_clv", "predictive_analytics.historic_number_of_orders", "predictive_analytics.predicted_number_of_orders", "predictive_analytics.average_days_between_orders", "predictive_analytics.average_order_value", "predictive_analytics.churn_probability", "predictive_analytics.expected_date_of_next_order"] if @api_client.config.client_side_validation && opts[:'fields_profile'] && !opts[:'fields_profile'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"fields_profile\", must include one of #{allowable_values}" end # resource path local_var_path = '/api/events/{id}/profile/'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'additional-fields[profile]'] = @api_client.build_collection_param(opts[:'additional_fields_profile'], :csv) if !opts[:'additional_fields_profile'].nil? query_params[:'fields[profile]'] = @api_client.build_collection_param(opts[:'fields_profile'], :csv) if !opts[:'fields_profile'].nil? # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['API_REVISION'] || "2024-02-15" # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Hash<String, Object>' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] = opts.merge( :operation => :"EventsApi.get_event_profile", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: EventsApi#get_event_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_event_relationships_metric(id, opts = {}) ⇒ Hash<String, Object>
Get Event Relationships Metric Get a list of related Metrics for an Event
*Rate limits*:
Burst: ‘350/s`
Steady: `3500/m` Scopes: `events:read` `metrics:read`
341 342 343 344 |
# File 'lib/klaviyo-api-sdk/api/events_api.rb', line 341 def get_event_relationships_metric(id, opts = {}) data, _status_code, _headers = get_event_relationships_metric_with_http_info(id, opts) data end |
#get_event_relationships_metric_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Get Event Relationships Metric Get a list of related Metrics for an Event<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` Scopes: `events:read` `metrics:read`
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 |
# File 'lib/klaviyo-api-sdk/api/events_api.rb', line 351 def get_event_relationships_metric_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EventsApi.get_event_relationships_metric ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling EventsApi.get_event_relationships_metric" end # resource path local_var_path = '/api/events/{id}/relationships/metric/'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['API_REVISION'] || "2024-02-15" # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Hash<String, Object>' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] = opts.merge( :operation => :"EventsApi.get_event_relationships_metric", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: EventsApi#get_event_relationships_metric\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_event_relationships_profile(id, opts = {}) ⇒ Hash<String, Object>
Get Event Relationships Profile Get profile [relationships](developers.klaviyo.com/en/reference/api_overview#relationships) for an event with the given event ID.
*Rate limits*:
Burst: ‘350/s`
Steady: `3500/m` Scopes: `events:read` `profiles:read`
406 407 408 409 |
# File 'lib/klaviyo-api-sdk/api/events_api.rb', line 406 def get_event_relationships_profile(id, opts = {}) data, _status_code, _headers = get_event_relationships_profile_with_http_info(id, opts) data end |
#get_event_relationships_profile_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Get Event Relationships Profile Get profile [relationships](developers.klaviyo.com/en/reference/api_overview#relationships) for an event with the given event ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` Scopes: `events:read` `profiles:read`
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 |
# File 'lib/klaviyo-api-sdk/api/events_api.rb', line 416 def get_event_relationships_profile_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EventsApi.get_event_relationships_profile ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling EventsApi.get_event_relationships_profile" end # resource path local_var_path = '/api/events/{id}/relationships/profile/'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['API_REVISION'] || "2024-02-15" # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Hash<String, Object>' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] = opts.merge( :operation => :"EventsApi.get_event_relationships_profile", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: EventsApi#get_event_relationships_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_event_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Get Event Get an event with the given event ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` Scopes: `events:read`
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'lib/klaviyo-api-sdk/api/events_api.rb', line 115 def get_event_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EventsApi.get_event ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling EventsApi.get_event" end allowable_values = ["timestamp", "event_properties", "datetime", "uuid"] if @api_client.config.client_side_validation && opts[:'fields_event'] && !opts[:'fields_event'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"fields_event\", must include one of #{allowable_values}" end allowable_values = ["name", "created", "updated", "integration"] if @api_client.config.client_side_validation && opts[:'fields_metric'] && !opts[:'fields_metric'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"fields_metric\", must include one of #{allowable_values}" end allowable_values = ["email", "phone_number", "external_id", "first_name", "last_name", "organization", "title", "image", "created", "updated", "last_event_date", "location", "location.address1", "location.address2", "location.city", "location.country", "location.latitude", "location.longitude", "location.region", "location.zip", "location.timezone", "location.ip", "properties"] if @api_client.config.client_side_validation && opts[:'fields_profile'] && !opts[:'fields_profile'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"fields_profile\", must include one of #{allowable_values}" end allowable_values = ["attributions", "metric", "profile"] if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}" end # resource path local_var_path = '/api/events/{id}/'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'fields[event]'] = @api_client.build_collection_param(opts[:'fields_event'], :csv) if !opts[:'fields_event'].nil? query_params[:'fields[metric]'] = @api_client.build_collection_param(opts[:'fields_metric'], :csv) if !opts[:'fields_metric'].nil? query_params[:'fields[profile]'] = @api_client.build_collection_param(opts[:'fields_profile'], :csv) if !opts[:'fields_profile'].nil? query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil? # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['API_REVISION'] || "2024-02-15" # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Hash<String, Object>' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] = opts.merge( :operation => :"EventsApi.get_event", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: EventsApi#get_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_events(opts = {}) ⇒ Hash<String, Object>
Get Events Get all events in an account Requests can be sorted by the following fields: ‘datetime`, `timestamp` Returns a maximum of 200 events per page.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` Scopes: `events:read`
477 478 479 480 |
# File 'lib/klaviyo-api-sdk/api/events_api.rb', line 477 def get_events(opts = {}) data, _status_code, _headers = get_events_with_http_info(opts) data end |
#get_events_with_http_info(opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Get Events Get all events in an account Requests can be sorted by the following fields: `datetime`, `timestamp` Returns a maximum of 200 events per page.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` Scopes: `events:read`
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 |
# File 'lib/klaviyo-api-sdk/api/events_api.rb', line 493 def get_events_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EventsApi.get_events ...' end allowable_values = ["timestamp", "event_properties", "datetime", "uuid"] if @api_client.config.client_side_validation && opts[:'fields_event'] && !opts[:'fields_event'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"fields_event\", must include one of #{allowable_values}" end allowable_values = ["name", "created", "updated", "integration"] if @api_client.config.client_side_validation && opts[:'fields_metric'] && !opts[:'fields_metric'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"fields_metric\", must include one of #{allowable_values}" end allowable_values = ["email", "phone_number", "external_id", "first_name", "last_name", "organization", "title", "image", "created", "updated", "last_event_date", "location", "location.address1", "location.address2", "location.city", "location.country", "location.latitude", "location.longitude", "location.region", "location.zip", "location.timezone", "location.ip", "properties"] if @api_client.config.client_side_validation && opts[:'fields_profile'] && !opts[:'fields_profile'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"fields_profile\", must include one of #{allowable_values}" end allowable_values = ["attributions", "metric", "profile"] if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}" end allowable_values = ["datetime", "-datetime", "timestamp", "-timestamp"] if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort']) fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}" end # resource path local_var_path = '/api/events/' # query parameters query_params = opts[:query_params] || {} query_params[:'fields[event]'] = @api_client.build_collection_param(opts[:'fields_event'], :csv) if !opts[:'fields_event'].nil? query_params[:'fields[metric]'] = @api_client.build_collection_param(opts[:'fields_metric'], :csv) if !opts[:'fields_metric'].nil? query_params[:'fields[profile]'] = @api_client.build_collection_param(opts[:'fields_profile'], :csv) if !opts[:'fields_profile'].nil? query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil? query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil? query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['API_REVISION'] || "2024-02-15" # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Hash<String, Object>' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] = opts.merge( :operation => :"EventsApi.get_events", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: EventsApi#get_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |