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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c77f994257e4610a1394c7cec1321e2ac26990cfe4ca24f19b9e00e72807493
4
- data.tar.gz: ec0aec23e49bad119b958c3cfc7333b7a933077657fb8a5fadb30da90f436477
3
+ metadata.gz: 31d15ae559ae4623fbf67d23e13065e9d681beb0857187019f4e0ef5ffdb494c
4
+ data.tar.gz: d824f8c18899a9549fdcde77c2489f523603ff2a292d58e28e9f5cfadbcf4c1a
5
5
  SHA512:
6
- metadata.gz: 6766d3434eb770101a036d367d77feea6ad5ede13967aac7b9567572c9bfbeec18105b79d5bbbb10162ea94df1194a1c3ca3f7d2e69f0db1172c63778beafdda
7
- data.tar.gz: b165fd1b7857a695f14124a3a4a88723a91df60133bcd3e60db9df3fd27745927fcdc31a6e4913ee0b8a8b88da8cee5082350322d20ffeaaed8fdcd0baa0c428
6
+ metadata.gz: a284b7b92afa55f941b3048c6d7d20d6723c124161921281e3ab58642f6e4a393530849962b66342d3355163d604485682d60625ef403551c7e12baa93e9ae69
7
+ data.tar.gz: 2eabe9255ad433ecaddf6ae19f653661495d81a0d5b588e360a69cd83ec8bd8d9a199e9a1e0d0ea9ce768d702a5df656672a58e872f299b8196d6640cd24693b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## CHANGELOG
2
2
 
3
+ ### 1.0.4.20220329
4
+ * Add support for /v2/people/search endpoint
5
+ * Update campaign and campaign_lists models
6
+
7
+ ### 1.0.3.20220329
8
+ * Fix one of the error codes that the retry logic relies on (from 400 to 429)
9
+
3
10
  ### 1.0.2.20220329
4
11
  * Use Klaviyo as the module name for the sdk instead of the more generic Client
5
12
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Klaviyo Ruby SDK
2
2
 
3
- - SDK version: 1.0.3.20220329
3
+ - SDK version: 1.0.4.20220329
4
4
 
5
5
  ## Helpful Resources
6
6
 
@@ -60,13 +60,13 @@ gem build klaviyo_sdk.gemspec
60
60
  Then install the gem locally:
61
61
 
62
62
  ```shell
63
- gem install ./klaviyo_sdk-1.0.3.20220329.gem
63
+ gem install ./klaviyo_sdk-1.0.4.20220329.gem
64
64
  ```
65
65
 
66
66
 
67
67
  Finally add this to the Gemfile:
68
68
 
69
- gem 'klaviyo_sdk', '~> 1.0.3.20220329'
69
+ gem 'klaviyo_sdk', '~> 1.0.4.20220329'
70
70
 
71
71
  To install directly from rubygems:
72
72
 
@@ -792,6 +792,28 @@ response = Klaviyo::Profiles.get_profile(person_id)
792
792
 
793
793
 
794
794
 
795
+ #### [Get Profile ID](https://developers.klaviyo.com/en/reference/get-profile-id)
796
+
797
+ ```ruby
798
+ Klaviyo::Profiles.get_profile_id(opts)
799
+ ```
800
+
801
+ #### Example:
802
+ ```ruby
803
+ opts = {
804
+ query_params: {
805
+ email: 'george.washington@klaviyo.com',
806
+ phone_number: '555-555-5555',
807
+ external_id: 'EXTERNAL_ID'
808
+ }
809
+ }
810
+
811
+ response = Klaviyo::Profiles.get_profile_id(opts)
812
+ ```
813
+
814
+
815
+
816
+
795
817
  #### [Get Profile's Events for a Specific Metric](https://developers.klaviyo.com/en/reference/profile-metric-timeline)
796
818
 
797
819
  ```ruby
data/klaviyo_sdk.gemspec CHANGED
@@ -17,7 +17,7 @@ require "klaviyo_sdk/version"
17
17
 
18
18
  Gem::Specification.new do |s|
19
19
  s.name = "klaviyo_sdk"
20
- s.version = "1.0.3.20220329"
20
+ s.version = "1.0.4.20220329"
21
21
  s.authors = ['Klaviyo Team']
22
22
  s.email = ['libraries@klaviyo.com']
23
23
  s.summary = 'You heard us, a Ruby wrapper for the Klaviyo API'
@@ -20,7 +20,7 @@ module Klaviyo
20
20
  @api_client = api_client
21
21
  end
22
22
  # Request a Deletion
23
- # Request a data privacy-compliant deletion for the person record corresponding to an email address, phone number, or person identifier. **If multiple person records exist for the provided identifier, only one of them will be deleted.** The arguments should be sent as content type application/json. Note that only **one** identifier (email, phone_number, or person_id) can be specified. In addition to your API key, you need to set exactly one of the following parameters: `email`, `phone_number`, `or person_id`, along with the associated `string` value. Examples: Email: `{\"email\":\"abraham.lincoln@klaviyo.com\"}` Phone Number: `{\"phone_number\":\"+13239169023\"}` Person ID: `{\"person_id\":\"PERSON_ID\"}`
23
+ # Request a data privacy-compliant deletion for the person record corresponding to an email address, phone number, or person identifier. **If multiple person records exist for the provided identifier, only one of them will be deleted.** The arguments should be sent as content type application/json. Note that only **one** identifier (email, phone_number, or person_id) can be specified. In addition to your Private API key, you need to set exactly one of the following parameters: `email`, `phone_number`, `or person_id`, along with the associated `string` value. Examples: Email: `{\"email\":\"abraham.lincoln@klaviyo.com\"}` Phone Number: `{\"phone_number\":\"+13239169023\"}` Person ID: `{\"person_id\":\"PERSON_ID\"}`
24
24
  # @param [Hash] opts the optional parameters
25
25
  # @option opts [String] :body
26
26
  # @return [String]
@@ -30,7 +30,7 @@ module Klaviyo
30
30
  end
31
31
 
32
32
  # Request a Deletion
33
- # Request a data privacy-compliant deletion for the person record corresponding to an email address, phone number, or person identifier. **If multiple person records exist for the provided identifier, only one of them will be deleted.** The arguments should be sent as content type application/json. Note that only **one** identifier (email, phone_number, or person_id) can be specified. In addition to your API key, you need to set exactly one of the following parameters: `email`, `phone_number`, `or person_id`, along with the associated `string` value. Examples: Email: `{\"email\":\"abraham.lincoln@klaviyo.com\"}` Phone Number: `{\"phone_number\":\"+13239169023\"}` Person ID: `{\"person_id\":\"PERSON_ID\"}`
33
+ # Request a data privacy-compliant deletion for the person record corresponding to an email address, phone number, or person identifier. **If multiple person records exist for the provided identifier, only one of them will be deleted.** The arguments should be sent as content type application/json. Note that only **one** identifier (email, phone_number, or person_id) can be specified. In addition to your Private API key, you need to set exactly one of the following parameters: `email`, `phone_number`, `or person_id`, along with the associated `string` value. Examples: Email: `{\"email\":\"abraham.lincoln@klaviyo.com\"}` Phone Number: `{\"phone_number\":\"+13239169023\"}` Person ID: `{\"person_id\":\"PERSON_ID\"}`
34
34
  # @param [Hash] opts the optional parameters
35
35
  # @option opts [String] :body
36
36
  # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
@@ -146,6 +146,72 @@ module Klaviyo
146
146
  return data, status_code, headers
147
147
  end
148
148
 
149
+ # Get Profile ID
150
+ # Get a profile's Klaviyo ID given exactly one corresponding identifier: `email`, `phone_number`, or `external_id`. NOTE: calling this endpoint with multiple identifiers will result in an error.
151
+ # @param [Hash] opts the optional parameters
152
+ # @option opts [String] :email
153
+ # @option opts [String] :phone_number
154
+ # @option opts [String] :external_id
155
+ # @return [InlineResponse200]
156
+ def get_profile_id(opts = {})
157
+ data, _status_code, _headers = get_profile_id_with_http_info(opts)
158
+ data
159
+ end
160
+
161
+ # Get Profile ID
162
+ # Get a profile&#39;s Klaviyo ID given exactly one corresponding identifier: &#x60;email&#x60;, &#x60;phone_number&#x60;, or &#x60;external_id&#x60;. NOTE: calling this endpoint with multiple identifiers will result in an error.
163
+ # @param [Hash] opts the optional parameters
164
+ # @option opts [String] :email
165
+ # @option opts [String] :phone_number
166
+ # @option opts [String] :external_id
167
+ # @return [Array<(InlineResponse200, Integer, Hash)>] InlineResponse200 data, response status code and response headers
168
+ def get_profile_id_with_http_info(opts = {})
169
+ if @api_client.config.debugging
170
+ @api_client.config.logger.debug 'Calling API: ProfilesApi.get_profile_id ...'
171
+ end
172
+ # resource path
173
+ local_var_path = '/v2/people/search'
174
+
175
+ # query parameters
176
+ query_params = opts[:query_params] || {}
177
+ query_params[:'email'] = opts[:'email'] if !opts[:'email'].nil?
178
+ query_params[:'phone_number'] = opts[:'phone_number'] if !opts[:'phone_number'].nil?
179
+ query_params[:'external_id'] = opts[:'external_id'] if !opts[:'external_id'].nil?
180
+
181
+ # header parameters
182
+ header_params = opts[:header_params] || {}
183
+ # HTTP header 'Accept' (if needed)
184
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
185
+
186
+ # form parameters
187
+ form_params = opts[:form_params] || {}
188
+
189
+ # http body (model)
190
+ post_body = opts[:body]
191
+
192
+ # return_type
193
+ return_type = opts[:debug_return_type] || 'InlineResponse200'
194
+
195
+ # auth_names
196
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
197
+
198
+ new_options = opts.merge(
199
+ :operation => :"ProfilesApi.get_profile_id",
200
+ :header_params => header_params,
201
+ :query_params => query_params,
202
+ :form_params => form_params,
203
+ :body => post_body,
204
+ :auth_names => auth_names,
205
+ :return_type => return_type
206
+ )
207
+
208
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
209
+ if @api_client.config.debugging
210
+ @api_client.config.logger.debug "API called: ProfilesApi#get_profile_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
211
+ end
212
+ return data, status_code, headers
213
+ end
214
+
149
215
  # Get Profile's Events for a Specific Metric
150
216
  # Returns a person's batched timeline for one specific event type.
151
217
  # @param person_id [String]
@@ -31,7 +31,7 @@ module Klaviyo
31
31
  # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
32
32
  def initialize(config = Configuration.default)
33
33
  @config = config
34
- @user_agent = "klaviyo-ruby/1.0.3.20220329"
34
+ @user_agent = "klaviyo-ruby/1.0.4.20220329"
35
35
  @default_headers = {
36
36
  'Content-Type' => 'application/json',
37
37
  'User-Agent' => @user_agent
@@ -27,16 +27,56 @@ module Klaviyo
27
27
 
28
28
  attr_accessor :from_name
29
29
 
30
- attr_accessor :list_id
30
+ attr_accessor :lists
31
31
 
32
- attr_accessor :template
32
+ attr_accessor :excluded_lists
33
33
 
34
34
  attr_accessor :status
35
35
 
36
+ attr_accessor :status_id
37
+
38
+ attr_accessor :status_label
39
+
36
40
  attr_accessor :sent_at
37
41
 
42
+ attr_accessor :send_time
43
+
38
44
  attr_accessor :created
39
45
 
46
+ attr_accessor :updated
47
+
48
+ attr_accessor :num_recipients
49
+
50
+ attr_accessor :campaign_type
51
+
52
+ attr_accessor :is_segmented
53
+
54
+ attr_accessor :message_type
55
+
56
+ attr_accessor :template
57
+
58
+ class EnumAttributeValidator
59
+ attr_reader :datatype
60
+ attr_reader :allowable_values
61
+
62
+ def initialize(datatype, allowable_values)
63
+ @allowable_values = allowable_values.map do |value|
64
+ case datatype.to_s
65
+ when /Integer/i
66
+ value.to_i
67
+ when /Float/i
68
+ value.to_f
69
+ else
70
+ value
71
+ end
72
+ end
73
+ end
74
+
75
+ def valid?(value)
76
+ !value || allowable_values.include?(value)
77
+ end
78
+ end
79
+
40
80
  # Attribute mapping from ruby-style variable name to JSON key.
41
81
  def self.attribute_map
42
82
  {
@@ -46,11 +86,20 @@ module Klaviyo
46
86
  :'subject' => :'subject',
47
87
  :'from_email' => :'from_email',
48
88
  :'from_name' => :'from_name',
49
- :'list_id' => :'list_id',
50
- :'template' => :'template',
89
+ :'lists' => :'lists',
90
+ :'excluded_lists' => :'excluded_lists',
51
91
  :'status' => :'status',
92
+ :'status_id' => :'status_id',
93
+ :'status_label' => :'status_label',
52
94
  :'sent_at' => :'sent_at',
53
- :'created' => :'created'
95
+ :'send_time' => :'send_time',
96
+ :'created' => :'created',
97
+ :'updated' => :'updated',
98
+ :'num_recipients' => :'num_recipients',
99
+ :'campaign_type' => :'campaign_type',
100
+ :'is_segmented' => :'is_segmented',
101
+ :'message_type' => :'message_type',
102
+ :'template' => :'template'
54
103
  }
55
104
  end
56
105
 
@@ -68,17 +117,27 @@ module Klaviyo
68
117
  :'subject' => :'String',
69
118
  :'from_email' => :'String',
70
119
  :'from_name' => :'String',
71
- :'list_id' => :'String',
72
- :'template' => :'Hash<String, Object>',
120
+ :'lists' => :'Array<CampaignLists>',
121
+ :'excluded_lists' => :'Array<CampaignLists>',
73
122
  :'status' => :'String',
74
- :'sent_at' => :'String',
75
- :'created' => :'String'
123
+ :'status_id' => :'Integer',
124
+ :'status_label' => :'String',
125
+ :'sent_at' => :'Time',
126
+ :'send_time' => :'Time',
127
+ :'created' => :'Time',
128
+ :'updated' => :'Time',
129
+ :'num_recipients' => :'Integer',
130
+ :'campaign_type' => :'String',
131
+ :'is_segmented' => :'Boolean',
132
+ :'message_type' => :'String',
133
+ :'template' => :'Hash<String, Object>'
76
134
  }
77
135
  end
78
136
 
79
137
  # List of attributes with nullable: true
80
138
  def self.openapi_nullable
81
139
  Set.new([
140
+ :'sent_at',
82
141
  ])
83
142
  end
84
143
 
@@ -121,13 +180,15 @@ module Klaviyo
121
180
  self.from_name = attributes[:'from_name']
122
181
  end
123
182
 
124
- if attributes.key?(:'list_id')
125
- self.list_id = attributes[:'list_id']
183
+ if attributes.key?(:'lists')
184
+ if (value = attributes[:'lists']).is_a?(Array)
185
+ self.lists = value
186
+ end
126
187
  end
127
188
 
128
- if attributes.key?(:'template')
129
- if (value = attributes[:'template']).is_a?(Hash)
130
- self.template = value
189
+ if attributes.key?(:'excluded_lists')
190
+ if (value = attributes[:'excluded_lists']).is_a?(Array)
191
+ self.excluded_lists = value
131
192
  end
132
193
  end
133
194
 
@@ -135,28 +196,138 @@ module Klaviyo
135
196
  self.status = attributes[:'status']
136
197
  end
137
198
 
199
+ if attributes.key?(:'status_id')
200
+ self.status_id = attributes[:'status_id']
201
+ end
202
+
203
+ if attributes.key?(:'status_label')
204
+ self.status_label = attributes[:'status_label']
205
+ end
206
+
138
207
  if attributes.key?(:'sent_at')
139
208
  self.sent_at = attributes[:'sent_at']
140
209
  end
141
210
 
211
+ if attributes.key?(:'send_time')
212
+ self.send_time = attributes[:'send_time']
213
+ end
214
+
142
215
  if attributes.key?(:'created')
143
216
  self.created = attributes[:'created']
144
217
  end
218
+
219
+ if attributes.key?(:'updated')
220
+ self.updated = attributes[:'updated']
221
+ end
222
+
223
+ if attributes.key?(:'num_recipients')
224
+ self.num_recipients = attributes[:'num_recipients']
225
+ end
226
+
227
+ if attributes.key?(:'campaign_type')
228
+ self.campaign_type = attributes[:'campaign_type']
229
+ end
230
+
231
+ if attributes.key?(:'is_segmented')
232
+ self.is_segmented = attributes[:'is_segmented']
233
+ end
234
+
235
+ if attributes.key?(:'message_type')
236
+ self.message_type = attributes[:'message_type']
237
+ end
238
+
239
+ if attributes.key?(:'template')
240
+ if (value = attributes[:'template']).is_a?(Hash)
241
+ self.template = value
242
+ end
243
+ end
145
244
  end
146
245
 
147
246
  # Show invalid properties with the reasons. Usually used together with valid?
148
247
  # @return Array for valid properties with the reasons
149
248
  def list_invalid_properties
150
249
  invalid_properties = Array.new
250
+ if !@status_id.nil? && @status_id > 13
251
+ invalid_properties.push('invalid value for "status_id", must be smaller than or equal to 13.')
252
+ end
253
+
254
+ if !@status_id.nil? && @status_id < 0
255
+ invalid_properties.push('invalid value for "status_id", must be greater than or equal to 0.')
256
+ end
257
+
151
258
  invalid_properties
152
259
  end
153
260
 
154
261
  # Check to see if the all the properties in the model are valid
155
262
  # @return true if the model is valid
156
263
  def valid?
264
+ status_validator = EnumAttributeValidator.new('String', ["draft", "sent", "cancelled", "queued", "cancelled_no_recipients_smart_sending", "cancelled_no_recipients_scheduling", "cancelled_account_disabled", "scheduling", "sending", "sending_timezones", "variations_sent", "preparing_to_schedule", "cancelled_internal_error"])
265
+ return false unless status_validator.valid?(@status)
266
+ return false if !@status_id.nil? && @status_id > 13
267
+ return false if !@status_id.nil? && @status_id < 0
268
+ status_label_validator = EnumAttributeValidator.new('String', ["Scheduled", "Sent", "Draft", "Cancelled", "Adding Recipients", "Sending", "Variations Sent", "Sending Segments", "Cancelled: Smart Sending", "Preparing to send", "Cancelled: Account Disabled", "Cancelled: No Recipients", "Preparing to schedule", "Cancelled: Internal Error"])
269
+ return false unless status_label_validator.valid?(@status_label)
270
+ campaign_type_validator = EnumAttributeValidator.new('String', ["Timezone", "REGULAR", "A/B Content", "A/B Send Time", "Batch", "A/B Segments by Send Time", "A/B Segments by Send Time (STO)", "SMS Segments by Message Per Second"])
271
+ return false unless campaign_type_validator.valid?(@campaign_type)
272
+ message_type_validator = EnumAttributeValidator.new('String', ["email", "sms", "push"])
273
+ return false unless message_type_validator.valid?(@message_type)
157
274
  true
158
275
  end
159
276
 
277
+ # Custom attribute writer method checking allowed values (enum).
278
+ # @param [Object] status Object to be assigned
279
+ def status=(status)
280
+ validator = EnumAttributeValidator.new('String', ["draft", "sent", "cancelled", "queued", "cancelled_no_recipients_smart_sending", "cancelled_no_recipients_scheduling", "cancelled_account_disabled", "scheduling", "sending", "sending_timezones", "variations_sent", "preparing_to_schedule", "cancelled_internal_error"])
281
+ unless validator.valid?(status)
282
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
283
+ end
284
+ @status = status
285
+ end
286
+
287
+ # Custom attribute writer method with validation
288
+ # @param [Object] status_id Value to be assigned
289
+ def status_id=(status_id)
290
+ if !status_id.nil? && status_id > 13
291
+ fail ArgumentError, 'invalid value for "status_id", must be smaller than or equal to 13.'
292
+ end
293
+
294
+ if !status_id.nil? && status_id < 0
295
+ fail ArgumentError, 'invalid value for "status_id", must be greater than or equal to 0.'
296
+ end
297
+
298
+ @status_id = status_id
299
+ end
300
+
301
+ # Custom attribute writer method checking allowed values (enum).
302
+ # @param [Object] status_label Object to be assigned
303
+ def status_label=(status_label)
304
+ validator = EnumAttributeValidator.new('String', ["Scheduled", "Sent", "Draft", "Cancelled", "Adding Recipients", "Sending", "Variations Sent", "Sending Segments", "Cancelled: Smart Sending", "Preparing to send", "Cancelled: Account Disabled", "Cancelled: No Recipients", "Preparing to schedule", "Cancelled: Internal Error"])
305
+ unless validator.valid?(status_label)
306
+ fail ArgumentError, "invalid value for \"status_label\", must be one of #{validator.allowable_values}."
307
+ end
308
+ @status_label = status_label
309
+ end
310
+
311
+ # Custom attribute writer method checking allowed values (enum).
312
+ # @param [Object] campaign_type Object to be assigned
313
+ def campaign_type=(campaign_type)
314
+ validator = EnumAttributeValidator.new('String', ["Timezone", "REGULAR", "A/B Content", "A/B Send Time", "Batch", "A/B Segments by Send Time", "A/B Segments by Send Time (STO)", "SMS Segments by Message Per Second"])
315
+ unless validator.valid?(campaign_type)
316
+ fail ArgumentError, "invalid value for \"campaign_type\", must be one of #{validator.allowable_values}."
317
+ end
318
+ @campaign_type = campaign_type
319
+ end
320
+
321
+ # Custom attribute writer method checking allowed values (enum).
322
+ # @param [Object] message_type Object to be assigned
323
+ def message_type=(message_type)
324
+ validator = EnumAttributeValidator.new('String', ["email", "sms", "push"])
325
+ unless validator.valid?(message_type)
326
+ fail ArgumentError, "invalid value for \"message_type\", must be one of #{validator.allowable_values}."
327
+ end
328
+ @message_type = message_type
329
+ end
330
+
160
331
  # Checks equality by comparing each attribute.
161
332
  # @param [Object] Object to be compared
162
333
  def ==(o)
@@ -168,11 +339,20 @@ module Klaviyo
168
339
  subject == o.subject &&
169
340
  from_email == o.from_email &&
170
341
  from_name == o.from_name &&
171
- list_id == o.list_id &&
172
- template == o.template &&
342
+ lists == o.lists &&
343
+ excluded_lists == o.excluded_lists &&
173
344
  status == o.status &&
345
+ status_id == o.status_id &&
346
+ status_label == o.status_label &&
174
347
  sent_at == o.sent_at &&
175
- created == o.created
348
+ send_time == o.send_time &&
349
+ created == o.created &&
350
+ updated == o.updated &&
351
+ num_recipients == o.num_recipients &&
352
+ campaign_type == o.campaign_type &&
353
+ is_segmented == o.is_segmented &&
354
+ message_type == o.message_type &&
355
+ template == o.template
176
356
  end
177
357
 
178
358
  # @see the `==` method
@@ -184,7 +364,7 @@ module Klaviyo
184
364
  # Calculates hash code according to all attributes.
185
365
  # @return [Integer] Hash code
186
366
  def hash
187
- [object, id, name, subject, from_email, from_name, list_id, template, status, sent_at, created].hash
367
+ [object, id, name, subject, from_email, from_name, lists, excluded_lists, status, status_id, status_label, sent_at, send_time, created, updated, num_recipients, campaign_type, is_segmented, message_type, template].hash
188
368
  end
189
369
 
190
370
  # Builds the object from hash