klaviyo_sdk 1.0.1.20220329 → 1.0.4.20220329
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/CHANGELOG.md +13 -0
- data/README.md +121 -99
- data/klaviyo_sdk.gemspec +1 -1
- data/lib/klaviyo_sdk/api/campaigns_api.rb +1 -1
- data/lib/klaviyo_sdk/api/data_privacy_api.rb +3 -3
- data/lib/klaviyo_sdk/api/lists_segments_api.rb +1 -1
- data/lib/klaviyo_sdk/api/metrics_api.rb +1 -1
- data/lib/klaviyo_sdk/api/profiles_api.rb +67 -1
- data/lib/klaviyo_sdk/api/templates_api.rb +1 -1
- data/lib/klaviyo_sdk/api/track_identify_api.rb +1 -1
- data/lib/klaviyo_sdk/api_client.rb +2 -2
- data/lib/klaviyo_sdk/api_error.rb +1 -1
- data/lib/klaviyo_sdk/configuration.rb +1 -1
- data/lib/klaviyo_sdk/models/campaign.rb +202 -22
- data/lib/klaviyo_sdk/models/campaign_lists.rb +318 -0
- data/lib/klaviyo_sdk/models/campaigns.rb +487 -0
- data/lib/klaviyo_sdk/models/check_membership_request.rb +4 -4
- data/lib/klaviyo_sdk/models/delete_email.rb +4 -4
- data/lib/klaviyo_sdk/models/delete_person.rb +4 -4
- data/lib/klaviyo_sdk/models/delete_phone.rb +4 -4
- data/lib/klaviyo_sdk/models/deprecated_get_list_response.rb +4 -4
- data/lib/klaviyo_sdk/models/deprecated_get_list_response_data.rb +4 -4
- data/lib/klaviyo_sdk/models/global_exclusion_response_data.rb +4 -4
- data/lib/klaviyo_sdk/models/identify_payload.rb +4 -4
- data/lib/klaviyo_sdk/models/identify_payload_properties.rb +4 -4
- data/lib/klaviyo_sdk/models/inline_object.rb +9 -4
- data/lib/klaviyo_sdk/models/inline_object3.rb +4 -4
- data/lib/klaviyo_sdk/models/inline_object4.rb +4 -4
- data/lib/klaviyo_sdk/models/inline_object5.rb +4 -5
- data/lib/klaviyo_sdk/models/inline_response200.rb +218 -0
- data/lib/klaviyo_sdk/models/metric.rb +4 -4
- data/lib/klaviyo_sdk/models/metric_export.rb +4 -4
- data/lib/klaviyo_sdk/models/metric_timeline.rb +4 -4
- data/lib/klaviyo_sdk/models/metric_timeline_data.rb +4 -4
- data/lib/klaviyo_sdk/models/person.rb +4 -4
- data/lib/klaviyo_sdk/models/person.rb.bak +4 -4
- data/lib/klaviyo_sdk/models/privacy_email.rb +4 -4
- data/lib/klaviyo_sdk/models/privacy_id.rb +4 -4
- data/lib/klaviyo_sdk/models/privacy_phone.rb +4 -4
- data/lib/klaviyo_sdk/models/rendered_template.rb +4 -4
- data/lib/klaviyo_sdk/models/template.rb +4 -4
- data/lib/klaviyo_sdk/models/track_payload.rb +4 -4
- data/lib/klaviyo_sdk/models/track_payload_customer_properties.rb +4 -4
- data/lib/klaviyo_sdk/models/track_payload_properties.rb +4 -4
- data/lib/klaviyo_sdk/version.rb +1 -1
- data/lib/klaviyo_sdk.rb +10 -7
- metadata +6 -76
- data/docs/Campaign.md +0 -38
- data/docs/CampaignsApi.md +0 -707
- data/docs/CheckMembershipRequest.md +0 -22
- data/docs/DataPrivacyApi.md +0 -81
- data/docs/DeleteEmail.md +0 -18
- data/docs/DeletePerson.md +0 -18
- data/docs/DeletePhone.md +0 -18
- data/docs/DeprecatedGetListResponse.md +0 -30
- data/docs/DeprecatedGetListResponseData.md +0 -28
- data/docs/GlobalExclusionResponseData.md +0 -30
- data/docs/IdentifyPayload.md +0 -20
- data/docs/IdentifyPayloadProperties.md +0 -42
- data/docs/InlineObject.md +0 -18
- data/docs/InlineObject3.md +0 -18
- data/docs/InlineObject4.md +0 -18
- data/docs/InlineObject5.md +0 -22
- data/docs/ListsSegmentsApi.md +0 -1198
- data/docs/Metric.md +0 -28
- data/docs/MetricExport.md +0 -32
- data/docs/MetricTimeline.md +0 -24
- data/docs/MetricTimelineData.md +0 -34
- data/docs/MetricsApi.md +0 -329
- data/docs/Person.md +0 -56
- data/docs/PrivacyEmail.md +0 -18
- data/docs/PrivacyId.md +0 -18
- data/docs/PrivacyPhone.md +0 -18
- data/docs/ProfilesApi.md +0 -391
- data/docs/RenderedTemplate.md +0 -24
- data/docs/Template.md +0 -30
- data/docs/TemplatesApi.md +0 -541
- data/docs/TrackIdentifyApi.md +0 -267
- data/docs/TrackPayload.md +0 -24
- data/docs/TrackPayloadCustomerProperties.md +0 -20
- data/docs/TrackPayloadProperties.md +0 -22
- data/git_push.sh +0 -57
- data/klaviyo_sdk-1.0.0.20220329.gem +0 -0
- data/spec/api/campaigns_api_spec.rb +0 -165
- data/spec/api/data_privacy_api_spec.rb +0 -47
- data/spec/api/lists_segments_api_spec.rb +0 -239
- data/spec/api/metrics_api_spec.rb +0 -96
- data/spec/api/profiles_api_spec.rb +0 -103
- data/spec/api/templates_api_spec.rb +0 -130
- data/spec/api/track_identify_api_spec.rb +0 -83
- data/spec/api_client_spec.rb +0 -226
- data/spec/configuration_spec.rb +0 -42
- data/spec/models/campaign_spec.rb +0 -94
- data/spec/models/check_membership_request_spec.rb +0 -46
- data/spec/models/delete_email_spec.rb +0 -34
- data/spec/models/delete_person_spec.rb +0 -34
- data/spec/models/delete_phone_spec.rb +0 -34
- data/spec/models/deprecated_get_list_response_data_spec.rb +0 -64
- data/spec/models/deprecated_get_list_response_spec.rb +0 -70
- data/spec/models/global_exclusion_response_data_spec.rb +0 -70
- data/spec/models/identify_payload_properties_spec.rb +0 -106
- data/spec/models/identify_payload_spec.rb +0 -40
- data/spec/models/inline_object3_spec.rb +0 -34
- data/spec/models/inline_object4_spec.rb +0 -34
- data/spec/models/inline_object5_spec.rb +0 -46
- data/spec/models/inline_object_spec.rb +0 -34
- data/spec/models/metric_export_spec.rb +0 -76
- data/spec/models/metric_spec.rb +0 -64
- data/spec/models/metric_timeline_data_spec.rb +0 -82
- data/spec/models/metric_timeline_spec.rb +0 -52
- data/spec/models/person_spec.rb +0 -148
- data/spec/models/privacy_email_spec.rb +0 -34
- data/spec/models/privacy_id_spec.rb +0 -34
- data/spec/models/privacy_phone_spec.rb +0 -34
- data/spec/models/rendered_template_spec.rb +0 -52
- data/spec/models/template_spec.rb +0 -70
- data/spec/models/track_payload_customer_properties_spec.rb +0 -40
- data/spec/models/track_payload_properties_spec.rb +0 -46
- data/spec/models/track_payload_spec.rb +0 -52
- data/spec/spec_helper.rb +0 -111
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.
|
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'
|
@@ -12,7 +12,7 @@ OpenAPI Generator version: 5.4.0
|
|
12
12
|
|
13
13
|
require 'cgi'
|
14
14
|
|
15
|
-
module
|
15
|
+
module Klaviyo
|
16
16
|
class DataPrivacyApi
|
17
17
|
attr_accessor :api_client
|
18
18
|
|
@@ -20,7 +20,7 @@ module Client
|
|
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 Client
|
|
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
|
@@ -12,7 +12,7 @@ OpenAPI Generator version: 5.4.0
|
|
12
12
|
|
13
13
|
require 'cgi'
|
14
14
|
|
15
|
-
module
|
15
|
+
module Klaviyo
|
16
16
|
class ProfilesApi
|
17
17
|
attr_accessor :api_client
|
18
18
|
|
@@ -146,6 +146,72 @@ module Client
|
|
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'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.
|
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]
|
@@ -17,7 +17,7 @@ require 'tempfile'
|
|
17
17
|
require 'time'
|
18
18
|
require 'typhoeus'
|
19
19
|
|
20
|
-
module
|
20
|
+
module Klaviyo
|
21
21
|
class ApiClient
|
22
22
|
# The Configuration object holding settings to be used in the API client.
|
23
23
|
attr_accessor :config
|
@@ -31,7 +31,7 @@ module Client
|
|
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.
|
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
|
@@ -13,7 +13,7 @@ OpenAPI Generator version: 5.4.0
|
|
13
13
|
require 'date'
|
14
14
|
require 'time'
|
15
15
|
|
16
|
-
module
|
16
|
+
module Klaviyo
|
17
17
|
class Campaign
|
18
18
|
attr_accessor :object
|
19
19
|
|
@@ -27,16 +27,56 @@ module Client
|
|
27
27
|
|
28
28
|
attr_accessor :from_name
|
29
29
|
|
30
|
-
attr_accessor :
|
30
|
+
attr_accessor :lists
|
31
31
|
|
32
|
-
attr_accessor :
|
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 Client
|
|
46
86
|
:'subject' => :'subject',
|
47
87
|
:'from_email' => :'from_email',
|
48
88
|
:'from_name' => :'from_name',
|
49
|
-
:'
|
50
|
-
:'
|
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
|
-
:'
|
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 Client
|
|
68
117
|
:'subject' => :'String',
|
69
118
|
:'from_email' => :'String',
|
70
119
|
:'from_name' => :'String',
|
71
|
-
:'
|
72
|
-
:'
|
120
|
+
:'lists' => :'Array<CampaignLists>',
|
121
|
+
:'excluded_lists' => :'Array<CampaignLists>',
|
73
122
|
:'status' => :'String',
|
74
|
-
:'
|
75
|
-
:'
|
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
|
|
@@ -86,13 +145,13 @@ module Client
|
|
86
145
|
# @param [Hash] attributes Model attributes in the form of hash
|
87
146
|
def initialize(attributes = {})
|
88
147
|
if (!attributes.is_a?(Hash))
|
89
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `
|
148
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Klaviyo::Campaign` initialize method"
|
90
149
|
end
|
91
150
|
|
92
151
|
# check to see if the attribute exists and convert string to symbol for hash key
|
93
152
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
94
153
|
if (!self.class.attribute_map.key?(k.to_sym))
|
95
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `
|
154
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Klaviyo::Campaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
96
155
|
end
|
97
156
|
h[k.to_sym] = v
|
98
157
|
}
|
@@ -121,13 +180,15 @@ module Client
|
|
121
180
|
self.from_name = attributes[:'from_name']
|
122
181
|
end
|
123
182
|
|
124
|
-
if attributes.key?(:'
|
125
|
-
|
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?(:'
|
129
|
-
if (value = attributes[:'
|
130
|
-
self.
|
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 Client
|
|
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 Client
|
|
168
339
|
subject == o.subject &&
|
169
340
|
from_email == o.from_email &&
|
170
341
|
from_name == o.from_name &&
|
171
|
-
|
172
|
-
|
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
|
-
|
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 Client
|
|
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,
|
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
|
@@ -254,7 +434,7 @@ module Client
|
|
254
434
|
end
|
255
435
|
else # model
|
256
436
|
# models (e.g. Pet) or oneOf
|
257
|
-
klass =
|
437
|
+
klass = Klaviyo.const_get(type)
|
258
438
|
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
259
439
|
end
|
260
440
|
end
|