klaviyo_sdk 1.0.3.20220329 → 1.0.4.20220329

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/README.md +25 -3
  4. data/klaviyo_sdk.gemspec +1 -1
  5. data/lib/klaviyo_sdk/api/data_privacy_api.rb +2 -2
  6. data/lib/klaviyo_sdk/api/profiles_api.rb +66 -0
  7. data/lib/klaviyo_sdk/api_client.rb +1 -1
  8. data/lib/klaviyo_sdk/models/campaign.rb +198 -18
  9. data/lib/klaviyo_sdk/models/campaign_lists.rb +318 -0
  10. data/lib/klaviyo_sdk/models/campaigns.rb +487 -0
  11. data/lib/klaviyo_sdk/models/inline_object5.rb +0 -1
  12. data/lib/klaviyo_sdk/models/inline_response200.rb +218 -0
  13. data/lib/klaviyo_sdk.rb +3 -0
  14. metadata +6 -76
  15. data/docs/Campaign.md +0 -38
  16. data/docs/CampaignsApi.md +0 -707
  17. data/docs/CheckMembershipRequest.md +0 -22
  18. data/docs/DataPrivacyApi.md +0 -81
  19. data/docs/DeleteEmail.md +0 -18
  20. data/docs/DeletePerson.md +0 -18
  21. data/docs/DeletePhone.md +0 -18
  22. data/docs/DeprecatedGetListResponse.md +0 -30
  23. data/docs/DeprecatedGetListResponseData.md +0 -28
  24. data/docs/GlobalExclusionResponseData.md +0 -30
  25. data/docs/IdentifyPayload.md +0 -20
  26. data/docs/IdentifyPayloadProperties.md +0 -42
  27. data/docs/InlineObject.md +0 -18
  28. data/docs/InlineObject3.md +0 -18
  29. data/docs/InlineObject4.md +0 -18
  30. data/docs/InlineObject5.md +0 -22
  31. data/docs/ListsSegmentsApi.md +0 -1198
  32. data/docs/Metric.md +0 -28
  33. data/docs/MetricExport.md +0 -32
  34. data/docs/MetricTimeline.md +0 -24
  35. data/docs/MetricTimelineData.md +0 -34
  36. data/docs/MetricsApi.md +0 -329
  37. data/docs/Person.md +0 -56
  38. data/docs/PrivacyEmail.md +0 -18
  39. data/docs/PrivacyId.md +0 -18
  40. data/docs/PrivacyPhone.md +0 -18
  41. data/docs/ProfilesApi.md +0 -391
  42. data/docs/RenderedTemplate.md +0 -24
  43. data/docs/Template.md +0 -30
  44. data/docs/TemplatesApi.md +0 -541
  45. data/docs/TrackIdentifyApi.md +0 -267
  46. data/docs/TrackPayload.md +0 -24
  47. data/docs/TrackPayloadCustomerProperties.md +0 -20
  48. data/docs/TrackPayloadProperties.md +0 -22
  49. data/git_push.sh +0 -57
  50. data/klaviyo_sdk-1.0.3.2022.03.29.gem +0 -0
  51. data/spec/api/campaigns_api_spec.rb +0 -165
  52. data/spec/api/data_privacy_api_spec.rb +0 -47
  53. data/spec/api/lists_segments_api_spec.rb +0 -239
  54. data/spec/api/metrics_api_spec.rb +0 -96
  55. data/spec/api/profiles_api_spec.rb +0 -103
  56. data/spec/api/templates_api_spec.rb +0 -130
  57. data/spec/api/track_identify_api_spec.rb +0 -83
  58. data/spec/api_client_spec.rb +0 -226
  59. data/spec/configuration_spec.rb +0 -42
  60. data/spec/models/campaign_spec.rb +0 -94
  61. data/spec/models/check_membership_request_spec.rb +0 -46
  62. data/spec/models/delete_email_spec.rb +0 -34
  63. data/spec/models/delete_person_spec.rb +0 -34
  64. data/spec/models/delete_phone_spec.rb +0 -34
  65. data/spec/models/deprecated_get_list_response_data_spec.rb +0 -64
  66. data/spec/models/deprecated_get_list_response_spec.rb +0 -70
  67. data/spec/models/global_exclusion_response_data_spec.rb +0 -70
  68. data/spec/models/identify_payload_properties_spec.rb +0 -106
  69. data/spec/models/identify_payload_spec.rb +0 -40
  70. data/spec/models/inline_object3_spec.rb +0 -34
  71. data/spec/models/inline_object4_spec.rb +0 -34
  72. data/spec/models/inline_object5_spec.rb +0 -46
  73. data/spec/models/inline_object_spec.rb +0 -34
  74. data/spec/models/metric_export_spec.rb +0 -76
  75. data/spec/models/metric_spec.rb +0 -64
  76. data/spec/models/metric_timeline_data_spec.rb +0 -82
  77. data/spec/models/metric_timeline_spec.rb +0 -52
  78. data/spec/models/person_spec.rb +0 -148
  79. data/spec/models/privacy_email_spec.rb +0 -34
  80. data/spec/models/privacy_id_spec.rb +0 -34
  81. data/spec/models/privacy_phone_spec.rb +0 -34
  82. data/spec/models/rendered_template_spec.rb +0 -52
  83. data/spec/models/template_spec.rb +0 -70
  84. data/spec/models/track_payload_customer_properties_spec.rb +0 -40
  85. data/spec/models/track_payload_properties_spec.rb +0 -46
  86. data/spec/models/track_payload_spec.rb +0 -52
  87. data/spec/spec_helper.rb +0 -111
data/docs/TemplatesApi.md DELETED
@@ -1,541 +0,0 @@
1
- # Klaviyo::TemplatesApi
2
-
3
- All URIs are relative to *https://a.klaviyo.com/api*
4
-
5
- | Method | HTTP request | Description |
6
- | ------ | ------------ | ----------- |
7
- | [**clone_template**](TemplatesApi.md#clone_template) | **POST** /v1/email-template/{template_id}/clone | Clone Template |
8
- | [**create_template**](TemplatesApi.md#create_template) | **POST** /v1/email-templates | Create New Template |
9
- | [**delete_template**](TemplatesApi.md#delete_template) | **DELETE** /v1/email-template/{template_id} | Delete Template |
10
- | [**get_templates**](TemplatesApi.md#get_templates) | **GET** /v1/email-templates | Get All Templates |
11
- | [**render_template**](TemplatesApi.md#render_template) | **POST** /v1/email-template/{template_id}/render | Render Template |
12
- | [**send_template**](TemplatesApi.md#send_template) | **POST** /v1/email-template/{template_id}/send | Render and Send Template |
13
- | [**update_template**](TemplatesApi.md#update_template) | **PUT** /v1/email-template/{template_id} | Update Template |
14
-
15
-
16
- ## clone_template
17
-
18
- > <Template> clone_template(template_id, name)
19
-
20
- Clone Template
21
-
22
- Creates a copy of a given template with a new name.
23
-
24
- ### Examples
25
-
26
- ```ruby
27
- require 'time'
28
- require 'klaviyo_sdk'
29
- # setup authorization
30
- Klaviyo.configure do |config|
31
- # Configure API key authorization: ApiKeyAuth
32
- config.api_key['ApiKeyAuth'] = 'YOUR API KEY'
33
- # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
34
- # config.api_key_prefix['ApiKeyAuth'] = 'Bearer'
35
- end
36
-
37
- api_instance = Klaviyo::TemplatesApi.new
38
- template_id = 'TEMPLATE_ID' # String |
39
- name = 'name_example' # String | The new name of the email template.
40
-
41
- begin
42
- # Clone Template
43
- result = api_instance.clone_template(template_id, name)
44
- p result
45
- rescue Klaviyo::ApiError => e
46
- puts "Error when calling TemplatesApi->clone_template: #{e}"
47
- end
48
- ```
49
-
50
- #### Using the clone_template_with_http_info variant
51
-
52
- This returns an Array which contains the response data, status code and headers.
53
-
54
- > <Array(<Template>, Integer, Hash)> clone_template_with_http_info(template_id, name)
55
-
56
- ```ruby
57
- begin
58
- # Clone Template
59
- data, status_code, headers = api_instance.clone_template_with_http_info(template_id, name)
60
- p status_code # => 2xx
61
- p headers # => { ... }
62
- p data # => <Template>
63
- rescue Klaviyo::ApiError => e
64
- puts "Error when calling TemplatesApi->clone_template_with_http_info: #{e}"
65
- end
66
- ```
67
-
68
- ### Parameters
69
-
70
- | Name | Type | Description | Notes |
71
- | ---- | ---- | ----------- | ----- |
72
- | **template_id** | **String** | | [default to &#39;TEMPLATE_ID&#39;] |
73
- | **name** | **String** | The new name of the email template. | [default to &#39;My Cloned Template&#39;] |
74
-
75
- ### Return type
76
-
77
- [**Template**](Template.md)
78
-
79
- ### Authorization
80
-
81
- [ApiKeyAuth](../README.md#ApiKeyAuth)
82
-
83
- ### HTTP request headers
84
-
85
- - **Content-Type**: application/x-www-form-urlencoded
86
- - **Accept**: application/json
87
-
88
-
89
- ## create_template
90
-
91
- > <Template> create_template(name, html)
92
-
93
- Create New Template
94
-
95
- Creates a new email template.
96
-
97
- ### Examples
98
-
99
- ```ruby
100
- require 'time'
101
- require 'klaviyo_sdk'
102
- # setup authorization
103
- Klaviyo.configure do |config|
104
- # Configure API key authorization: ApiKeyAuth
105
- config.api_key['ApiKeyAuth'] = 'YOUR API KEY'
106
- # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
107
- # config.api_key_prefix['ApiKeyAuth'] = 'Bearer'
108
- end
109
-
110
- api_instance = Klaviyo::TemplatesApi.new
111
- name = 'name_example' # String | The name of the email template.
112
- html = 'html_example' # String |
113
-
114
- begin
115
- # Create New Template
116
- result = api_instance.create_template(name, html)
117
- p result
118
- rescue Klaviyo::ApiError => e
119
- puts "Error when calling TemplatesApi->create_template: #{e}"
120
- end
121
- ```
122
-
123
- #### Using the create_template_with_http_info variant
124
-
125
- This returns an Array which contains the response data, status code and headers.
126
-
127
- > <Array(<Template>, Integer, Hash)> create_template_with_http_info(name, html)
128
-
129
- ```ruby
130
- begin
131
- # Create New Template
132
- data, status_code, headers = api_instance.create_template_with_http_info(name, html)
133
- p status_code # => 2xx
134
- p headers # => { ... }
135
- p data # => <Template>
136
- rescue Klaviyo::ApiError => e
137
- puts "Error when calling TemplatesApi->create_template_with_http_info: #{e}"
138
- end
139
- ```
140
-
141
- ### Parameters
142
-
143
- | Name | Type | Description | Notes |
144
- | ---- | ---- | ----------- | ----- |
145
- | **name** | **String** | The name of the email template. | [default to &#39;New Template Name&#39;] |
146
- | **html** | **String** | | [default to &#39;&lt;html&gt;&lt;body&gt;&lt;p&gt;This is an email for {{ email }}.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;&#39;] |
147
-
148
- ### Return type
149
-
150
- [**Template**](Template.md)
151
-
152
- ### Authorization
153
-
154
- [ApiKeyAuth](../README.md#ApiKeyAuth)
155
-
156
- ### HTTP request headers
157
-
158
- - **Content-Type**: application/x-www-form-urlencoded
159
- - **Accept**: application/json
160
-
161
-
162
- ## delete_template
163
-
164
- > Hash&lt;String, Object&gt; delete_template(template_id)
165
-
166
- Delete Template
167
-
168
- Deletes a given template.
169
-
170
- ### Examples
171
-
172
- ```ruby
173
- require 'time'
174
- require 'klaviyo_sdk'
175
- # setup authorization
176
- Klaviyo.configure do |config|
177
- # Configure API key authorization: ApiKeyAuth
178
- config.api_key['ApiKeyAuth'] = 'YOUR API KEY'
179
- # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
180
- # config.api_key_prefix['ApiKeyAuth'] = 'Bearer'
181
- end
182
-
183
- api_instance = Klaviyo::TemplatesApi.new
184
- template_id = 'TEMPLATE_ID' # String |
185
-
186
- begin
187
- # Delete Template
188
- result = api_instance.delete_template(template_id)
189
- p result
190
- rescue Klaviyo::ApiError => e
191
- puts "Error when calling TemplatesApi->delete_template: #{e}"
192
- end
193
- ```
194
-
195
- #### Using the delete_template_with_http_info variant
196
-
197
- This returns an Array which contains the response data, status code and headers.
198
-
199
- > <Array(Hash&lt;String, Object&gt;, Integer, Hash)> delete_template_with_http_info(template_id)
200
-
201
- ```ruby
202
- begin
203
- # Delete Template
204
- data, status_code, headers = api_instance.delete_template_with_http_info(template_id)
205
- p status_code # => 2xx
206
- p headers # => { ... }
207
- p data # => Hash&lt;String, Object&gt;
208
- rescue Klaviyo::ApiError => e
209
- puts "Error when calling TemplatesApi->delete_template_with_http_info: #{e}"
210
- end
211
- ```
212
-
213
- ### Parameters
214
-
215
- | Name | Type | Description | Notes |
216
- | ---- | ---- | ----------- | ----- |
217
- | **template_id** | **String** | | [default to &#39;TEMPLATE_ID&#39;] |
218
-
219
- ### Return type
220
-
221
- **Hash&lt;String, Object&gt;**
222
-
223
- ### Authorization
224
-
225
- [ApiKeyAuth](../README.md#ApiKeyAuth)
226
-
227
- ### HTTP request headers
228
-
229
- - **Content-Type**: Not defined
230
- - **Accept**: application/json
231
-
232
-
233
- ## get_templates
234
-
235
- > Hash&lt;String, Object&gt; get_templates(opts)
236
-
237
- Get All Templates
238
-
239
- Returns a list of all the email templates you've created. The templates are returned in sorted order by `name`.
240
-
241
- ### Examples
242
-
243
- ```ruby
244
- require 'time'
245
- require 'klaviyo_sdk'
246
- # setup authorization
247
- Klaviyo.configure do |config|
248
- # Configure API key authorization: ApiKeyAuth
249
- config.api_key['ApiKeyAuth'] = 'YOUR API KEY'
250
- # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
251
- # config.api_key_prefix['ApiKeyAuth'] = 'Bearer'
252
- end
253
-
254
- api_instance = Klaviyo::TemplatesApi.new
255
- opts = {
256
- page: 0, # Integer | For pagination, which page of results to return. Default = 0
257
- count: 100 # Integer | For pagination, the number of results to return. Max = 100
258
- }
259
-
260
- begin
261
- # Get All Templates
262
- result = api_instance.get_templates(opts)
263
- p result
264
- rescue Klaviyo::ApiError => e
265
- puts "Error when calling TemplatesApi->get_templates: #{e}"
266
- end
267
- ```
268
-
269
- #### Using the get_templates_with_http_info variant
270
-
271
- This returns an Array which contains the response data, status code and headers.
272
-
273
- > <Array(Hash&lt;String, Object&gt;, Integer, Hash)> get_templates_with_http_info(opts)
274
-
275
- ```ruby
276
- begin
277
- # Get All Templates
278
- data, status_code, headers = api_instance.get_templates_with_http_info(opts)
279
- p status_code # => 2xx
280
- p headers # => { ... }
281
- p data # => Hash&lt;String, Object&gt;
282
- rescue Klaviyo::ApiError => e
283
- puts "Error when calling TemplatesApi->get_templates_with_http_info: #{e}"
284
- end
285
- ```
286
-
287
- ### Parameters
288
-
289
- | Name | Type | Description | Notes |
290
- | ---- | ---- | ----------- | ----- |
291
- | **page** | **Integer** | For pagination, which page of results to return. Default &#x3D; 0 | [optional][default to 0] |
292
- | **count** | **Integer** | For pagination, the number of results to return. Max &#x3D; 100 | [optional][default to 50] |
293
-
294
- ### Return type
295
-
296
- **Hash&lt;String, Object&gt;**
297
-
298
- ### Authorization
299
-
300
- [ApiKeyAuth](../README.md#ApiKeyAuth)
301
-
302
- ### HTTP request headers
303
-
304
- - **Content-Type**: Not defined
305
- - **Accept**: application/json
306
-
307
-
308
- ## render_template
309
-
310
- > <RenderedTemplate> render_template(template_id, opts)
311
-
312
- Render Template
313
-
314
- Renders the specified template with the provided data and return HTML and text versions of the email.
315
-
316
- ### Examples
317
-
318
- ```ruby
319
- require 'time'
320
- require 'klaviyo_sdk'
321
- # setup authorization
322
- Klaviyo.configure do |config|
323
- # Configure API key authorization: ApiKeyAuth
324
- config.api_key['ApiKeyAuth'] = 'YOUR API KEY'
325
- # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
326
- # config.api_key_prefix['ApiKeyAuth'] = 'Bearer'
327
- end
328
-
329
- api_instance = Klaviyo::TemplatesApi.new
330
- template_id = 'TEMPLATE_ID' # String |
331
- opts = {
332
- context: 'context_example' # String | This is the context your email template will be rendered with. Email templates are rendered with contexts in a similar manner to how Django templates are rendered. This means that nested template variables can be referenced via dot notation and template variables without corresponding context values are treated as falsy and output nothing.
333
- }
334
-
335
- begin
336
- # Render Template
337
- result = api_instance.render_template(template_id, opts)
338
- p result
339
- rescue Klaviyo::ApiError => e
340
- puts "Error when calling TemplatesApi->render_template: #{e}"
341
- end
342
- ```
343
-
344
- #### Using the render_template_with_http_info variant
345
-
346
- This returns an Array which contains the response data, status code and headers.
347
-
348
- > <Array(<RenderedTemplate>, Integer, Hash)> render_template_with_http_info(template_id, opts)
349
-
350
- ```ruby
351
- begin
352
- # Render Template
353
- data, status_code, headers = api_instance.render_template_with_http_info(template_id, opts)
354
- p status_code # => 2xx
355
- p headers # => { ... }
356
- p data # => <RenderedTemplate>
357
- rescue Klaviyo::ApiError => e
358
- puts "Error when calling TemplatesApi->render_template_with_http_info: #{e}"
359
- end
360
- ```
361
-
362
- ### Parameters
363
-
364
- | Name | Type | Description | Notes |
365
- | ---- | ---- | ----------- | ----- |
366
- | **template_id** | **String** | | [default to &#39;TEMPLATE_ID&#39;] |
367
- | **context** | **String** | This is the context your email template will be rendered with. Email templates are rendered with contexts in a similar manner to how Django templates are rendered. This means that nested template variables can be referenced via dot notation and template variables without corresponding context values are treated as falsy and output nothing. | [optional][default to &#39;{ \&quot;name\&quot; : \&quot;George Washington\&quot;, \&quot;state\&quot; : \&quot;VA\&quot; }&#39;] |
368
-
369
- ### Return type
370
-
371
- [**RenderedTemplate**](RenderedTemplate.md)
372
-
373
- ### Authorization
374
-
375
- [ApiKeyAuth](../README.md#ApiKeyAuth)
376
-
377
- ### HTTP request headers
378
-
379
- - **Content-Type**: application/x-www-form-urlencoded
380
- - **Accept**: application/json
381
-
382
-
383
- ## send_template
384
-
385
- > <RenderedTemplate> send_template(template_id, from_email, from_name, subject, to, opts)
386
-
387
- Render and Send Template
388
-
389
- Renders the specified template with the provided data and send the contents in an email via the service specified. This API is intended to test templates only, and is rate limited to the following thresholds: 100/hour, 1,000/day.
390
-
391
- ### Examples
392
-
393
- ```ruby
394
- require 'time'
395
- require 'klaviyo_sdk'
396
- # setup authorization
397
- Klaviyo.configure do |config|
398
- # Configure API key authorization: ApiKeyAuth
399
- config.api_key['ApiKeyAuth'] = 'YOUR API KEY'
400
- # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
401
- # config.api_key_prefix['ApiKeyAuth'] = 'Bearer'
402
- end
403
-
404
- api_instance = Klaviyo::TemplatesApi.new
405
- template_id = 'TEMPLATE_ID' # String |
406
- from_email = 'from_email_example' # String |
407
- from_name = 'from_name_example' # String |
408
- subject = 'subject_example' # String |
409
- to = 'to_example' # String | **Mixed**. string, or JSON encoded array of objects with \\\"email\\\" and \\\"name\\\" keys. `abraham.lincoln@klaviyo.com` OR `[{\\\"name\\\":\\\"Abraham Lincoln\\\",\\\"email\\\":\\\"abraham.lincoln@klaviyo.com\\\"}]`
410
- opts = {
411
- context: 'context_example' # String | Optional, JSON object. This is the context your email template will be rendered with. Email templates are rendered with contexts in a similar manner to how Django templates are rendered. This means that nested template variables can be referenced via dot notation and template variables without corresponding context values are treated as falsy and output nothing. ex: `{ \\\"name\\\" : \\\"George Washington\\\", \\\"state\\\" : \\\"VA\\\" }`
412
- }
413
-
414
- begin
415
- # Render and Send Template
416
- result = api_instance.send_template(template_id, from_email, from_name, subject, to, opts)
417
- p result
418
- rescue Klaviyo::ApiError => e
419
- puts "Error when calling TemplatesApi->send_template: #{e}"
420
- end
421
- ```
422
-
423
- #### Using the send_template_with_http_info variant
424
-
425
- This returns an Array which contains the response data, status code and headers.
426
-
427
- > <Array(<RenderedTemplate>, Integer, Hash)> send_template_with_http_info(template_id, from_email, from_name, subject, to, opts)
428
-
429
- ```ruby
430
- begin
431
- # Render and Send Template
432
- data, status_code, headers = api_instance.send_template_with_http_info(template_id, from_email, from_name, subject, to, opts)
433
- p status_code # => 2xx
434
- p headers # => { ... }
435
- p data # => <RenderedTemplate>
436
- rescue Klaviyo::ApiError => e
437
- puts "Error when calling TemplatesApi->send_template_with_http_info: #{e}"
438
- end
439
- ```
440
-
441
- ### Parameters
442
-
443
- | Name | Type | Description | Notes |
444
- | ---- | ---- | ----------- | ----- |
445
- | **template_id** | **String** | | [default to &#39;TEMPLATE_ID&#39;] |
446
- | **from_email** | **String** | | [default to &#39;george.washington@klaviyo.com&#39;] |
447
- | **from_name** | **String** | | [default to &#39;George Washington&#39;] |
448
- | **subject** | **String** | | [default to &#39;Happy Fourth!&#39;] |
449
- | **to** | **String** | **Mixed**. string, or JSON encoded array of objects with \\\&quot;email\\\&quot; and \\\&quot;name\\\&quot; keys. &#x60;abraham.lincoln@klaviyo.com&#x60; OR &#x60;[{\\\&quot;name\\\&quot;:\\\&quot;Abraham Lincoln\\\&quot;,\\\&quot;email\\\&quot;:\\\&quot;abraham.lincoln@klaviyo.com\\\&quot;}]&#x60; | [default to &#39;[{\&quot;name\&quot;:\&quot;Abraham Lincoln\&quot;,\&quot;email\&quot;:\&quot;abraham.lincoln@klaviyo.com\&quot;}]&#39;] |
450
- | **context** | **String** | Optional, JSON object. This is the context your email template will be rendered with. Email templates are rendered with contexts in a similar manner to how Django templates are rendered. This means that nested template variables can be referenced via dot notation and template variables without corresponding context values are treated as falsy and output nothing. ex: &#x60;{ \\\&quot;name\\\&quot; : \\\&quot;George Washington\\\&quot;, \\\&quot;state\\\&quot; : \\\&quot;VA\\\&quot; }&#x60; | [optional][default to &#39;{ \&quot;name\&quot; : \&quot;George Washington\&quot;, \&quot;state\&quot; : \&quot;VA\&quot; }&#39;] |
451
-
452
- ### Return type
453
-
454
- [**RenderedTemplate**](RenderedTemplate.md)
455
-
456
- ### Authorization
457
-
458
- [ApiKeyAuth](../README.md#ApiKeyAuth)
459
-
460
- ### HTTP request headers
461
-
462
- - **Content-Type**: application/x-www-form-urlencoded
463
- - **Accept**: application/json
464
-
465
-
466
- ## update_template
467
-
468
- > <Template> update_template(template_id, opts)
469
-
470
- Update Template
471
-
472
- Updates the name and/or HTML content of a template. Only updates imported HTML templates; does not currently update drag & drop templates.
473
-
474
- ### Examples
475
-
476
- ```ruby
477
- require 'time'
478
- require 'klaviyo_sdk'
479
- # setup authorization
480
- Klaviyo.configure do |config|
481
- # Configure API key authorization: ApiKeyAuth
482
- config.api_key['ApiKeyAuth'] = 'YOUR API KEY'
483
- # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
484
- # config.api_key_prefix['ApiKeyAuth'] = 'Bearer'
485
- end
486
-
487
- api_instance = Klaviyo::TemplatesApi.new
488
- template_id = 'TEMPLATE_ID' # String |
489
- opts = {
490
- name: 'name_example', # String | The new name of the email template.
491
- html: 'html_example' # String | The new HTML content for this template.
492
- }
493
-
494
- begin
495
- # Update Template
496
- result = api_instance.update_template(template_id, opts)
497
- p result
498
- rescue Klaviyo::ApiError => e
499
- puts "Error when calling TemplatesApi->update_template: #{e}"
500
- end
501
- ```
502
-
503
- #### Using the update_template_with_http_info variant
504
-
505
- This returns an Array which contains the response data, status code and headers.
506
-
507
- > <Array(<Template>, Integer, Hash)> update_template_with_http_info(template_id, opts)
508
-
509
- ```ruby
510
- begin
511
- # Update Template
512
- data, status_code, headers = api_instance.update_template_with_http_info(template_id, opts)
513
- p status_code # => 2xx
514
- p headers # => { ... }
515
- p data # => <Template>
516
- rescue Klaviyo::ApiError => e
517
- puts "Error when calling TemplatesApi->update_template_with_http_info: #{e}"
518
- end
519
- ```
520
-
521
- ### Parameters
522
-
523
- | Name | Type | Description | Notes |
524
- | ---- | ---- | ----------- | ----- |
525
- | **template_id** | **String** | | [default to &#39;TEMPLATE_ID&#39;] |
526
- | **name** | **String** | The new name of the email template. | [optional] |
527
- | **html** | **String** | The new HTML content for this template. | [optional] |
528
-
529
- ### Return type
530
-
531
- [**Template**](Template.md)
532
-
533
- ### Authorization
534
-
535
- [ApiKeyAuth](../README.md#ApiKeyAuth)
536
-
537
- ### HTTP request headers
538
-
539
- - **Content-Type**: application/x-www-form-urlencoded
540
- - **Accept**: application/json
541
-