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.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/README.md +121 -99
  4. data/klaviyo_sdk.gemspec +1 -1
  5. data/lib/klaviyo_sdk/api/campaigns_api.rb +1 -1
  6. data/lib/klaviyo_sdk/api/data_privacy_api.rb +3 -3
  7. data/lib/klaviyo_sdk/api/lists_segments_api.rb +1 -1
  8. data/lib/klaviyo_sdk/api/metrics_api.rb +1 -1
  9. data/lib/klaviyo_sdk/api/profiles_api.rb +67 -1
  10. data/lib/klaviyo_sdk/api/templates_api.rb +1 -1
  11. data/lib/klaviyo_sdk/api/track_identify_api.rb +1 -1
  12. data/lib/klaviyo_sdk/api_client.rb +2 -2
  13. data/lib/klaviyo_sdk/api_error.rb +1 -1
  14. data/lib/klaviyo_sdk/configuration.rb +1 -1
  15. data/lib/klaviyo_sdk/models/campaign.rb +202 -22
  16. data/lib/klaviyo_sdk/models/campaign_lists.rb +318 -0
  17. data/lib/klaviyo_sdk/models/campaigns.rb +487 -0
  18. data/lib/klaviyo_sdk/models/check_membership_request.rb +4 -4
  19. data/lib/klaviyo_sdk/models/delete_email.rb +4 -4
  20. data/lib/klaviyo_sdk/models/delete_person.rb +4 -4
  21. data/lib/klaviyo_sdk/models/delete_phone.rb +4 -4
  22. data/lib/klaviyo_sdk/models/deprecated_get_list_response.rb +4 -4
  23. data/lib/klaviyo_sdk/models/deprecated_get_list_response_data.rb +4 -4
  24. data/lib/klaviyo_sdk/models/global_exclusion_response_data.rb +4 -4
  25. data/lib/klaviyo_sdk/models/identify_payload.rb +4 -4
  26. data/lib/klaviyo_sdk/models/identify_payload_properties.rb +4 -4
  27. data/lib/klaviyo_sdk/models/inline_object.rb +9 -4
  28. data/lib/klaviyo_sdk/models/inline_object3.rb +4 -4
  29. data/lib/klaviyo_sdk/models/inline_object4.rb +4 -4
  30. data/lib/klaviyo_sdk/models/inline_object5.rb +4 -5
  31. data/lib/klaviyo_sdk/models/inline_response200.rb +218 -0
  32. data/lib/klaviyo_sdk/models/metric.rb +4 -4
  33. data/lib/klaviyo_sdk/models/metric_export.rb +4 -4
  34. data/lib/klaviyo_sdk/models/metric_timeline.rb +4 -4
  35. data/lib/klaviyo_sdk/models/metric_timeline_data.rb +4 -4
  36. data/lib/klaviyo_sdk/models/person.rb +4 -4
  37. data/lib/klaviyo_sdk/models/person.rb.bak +4 -4
  38. data/lib/klaviyo_sdk/models/privacy_email.rb +4 -4
  39. data/lib/klaviyo_sdk/models/privacy_id.rb +4 -4
  40. data/lib/klaviyo_sdk/models/privacy_phone.rb +4 -4
  41. data/lib/klaviyo_sdk/models/rendered_template.rb +4 -4
  42. data/lib/klaviyo_sdk/models/template.rb +4 -4
  43. data/lib/klaviyo_sdk/models/track_payload.rb +4 -4
  44. data/lib/klaviyo_sdk/models/track_payload_customer_properties.rb +4 -4
  45. data/lib/klaviyo_sdk/models/track_payload_properties.rb +4 -4
  46. data/lib/klaviyo_sdk/version.rb +1 -1
  47. data/lib/klaviyo_sdk.rb +10 -7
  48. metadata +6 -76
  49. data/docs/Campaign.md +0 -38
  50. data/docs/CampaignsApi.md +0 -707
  51. data/docs/CheckMembershipRequest.md +0 -22
  52. data/docs/DataPrivacyApi.md +0 -81
  53. data/docs/DeleteEmail.md +0 -18
  54. data/docs/DeletePerson.md +0 -18
  55. data/docs/DeletePhone.md +0 -18
  56. data/docs/DeprecatedGetListResponse.md +0 -30
  57. data/docs/DeprecatedGetListResponseData.md +0 -28
  58. data/docs/GlobalExclusionResponseData.md +0 -30
  59. data/docs/IdentifyPayload.md +0 -20
  60. data/docs/IdentifyPayloadProperties.md +0 -42
  61. data/docs/InlineObject.md +0 -18
  62. data/docs/InlineObject3.md +0 -18
  63. data/docs/InlineObject4.md +0 -18
  64. data/docs/InlineObject5.md +0 -22
  65. data/docs/ListsSegmentsApi.md +0 -1198
  66. data/docs/Metric.md +0 -28
  67. data/docs/MetricExport.md +0 -32
  68. data/docs/MetricTimeline.md +0 -24
  69. data/docs/MetricTimelineData.md +0 -34
  70. data/docs/MetricsApi.md +0 -329
  71. data/docs/Person.md +0 -56
  72. data/docs/PrivacyEmail.md +0 -18
  73. data/docs/PrivacyId.md +0 -18
  74. data/docs/PrivacyPhone.md +0 -18
  75. data/docs/ProfilesApi.md +0 -391
  76. data/docs/RenderedTemplate.md +0 -24
  77. data/docs/Template.md +0 -30
  78. data/docs/TemplatesApi.md +0 -541
  79. data/docs/TrackIdentifyApi.md +0 -267
  80. data/docs/TrackPayload.md +0 -24
  81. data/docs/TrackPayloadCustomerProperties.md +0 -20
  82. data/docs/TrackPayloadProperties.md +0 -22
  83. data/git_push.sh +0 -57
  84. data/klaviyo_sdk-1.0.0.20220329.gem +0 -0
  85. data/spec/api/campaigns_api_spec.rb +0 -165
  86. data/spec/api/data_privacy_api_spec.rb +0 -47
  87. data/spec/api/lists_segments_api_spec.rb +0 -239
  88. data/spec/api/metrics_api_spec.rb +0 -96
  89. data/spec/api/profiles_api_spec.rb +0 -103
  90. data/spec/api/templates_api_spec.rb +0 -130
  91. data/spec/api/track_identify_api_spec.rb +0 -83
  92. data/spec/api_client_spec.rb +0 -226
  93. data/spec/configuration_spec.rb +0 -42
  94. data/spec/models/campaign_spec.rb +0 -94
  95. data/spec/models/check_membership_request_spec.rb +0 -46
  96. data/spec/models/delete_email_spec.rb +0 -34
  97. data/spec/models/delete_person_spec.rb +0 -34
  98. data/spec/models/delete_phone_spec.rb +0 -34
  99. data/spec/models/deprecated_get_list_response_data_spec.rb +0 -64
  100. data/spec/models/deprecated_get_list_response_spec.rb +0 -70
  101. data/spec/models/global_exclusion_response_data_spec.rb +0 -70
  102. data/spec/models/identify_payload_properties_spec.rb +0 -106
  103. data/spec/models/identify_payload_spec.rb +0 -40
  104. data/spec/models/inline_object3_spec.rb +0 -34
  105. data/spec/models/inline_object4_spec.rb +0 -34
  106. data/spec/models/inline_object5_spec.rb +0 -46
  107. data/spec/models/inline_object_spec.rb +0 -34
  108. data/spec/models/metric_export_spec.rb +0 -76
  109. data/spec/models/metric_spec.rb +0 -64
  110. data/spec/models/metric_timeline_data_spec.rb +0 -82
  111. data/spec/models/metric_timeline_spec.rb +0 -52
  112. data/spec/models/person_spec.rb +0 -148
  113. data/spec/models/privacy_email_spec.rb +0 -34
  114. data/spec/models/privacy_id_spec.rb +0 -34
  115. data/spec/models/privacy_phone_spec.rb +0 -34
  116. data/spec/models/rendered_template_spec.rb +0 -52
  117. data/spec/models/template_spec.rb +0 -70
  118. data/spec/models/track_payload_customer_properties_spec.rb +0 -40
  119. data/spec/models/track_payload_properties_spec.rb +0 -46
  120. data/spec/models/track_payload_spec.rb +0 -52
  121. data/spec/spec_helper.rb +0 -111
@@ -13,7 +13,7 @@ OpenAPI Generator version: 5.4.0
13
13
  require 'date'
14
14
  require 'time'
15
15
 
16
- module Client
16
+ module Klaviyo
17
17
  class GlobalExclusionResponseData
18
18
  attr_accessor :object
19
19
 
@@ -70,13 +70,13 @@ module Client
70
70
  # @param [Hash] attributes Model attributes in the form of hash
71
71
  def initialize(attributes = {})
72
72
  if (!attributes.is_a?(Hash))
73
- fail ArgumentError, "The input argument (attributes) must be a hash in `Client::GlobalExclusionResponseData` initialize method"
73
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Klaviyo::GlobalExclusionResponseData` initialize method"
74
74
  end
75
75
 
76
76
  # check to see if the attribute exists and convert string to symbol for hash key
77
77
  attributes = attributes.each_with_object({}) { |(k, v), h|
78
78
  if (!self.class.attribute_map.key?(k.to_sym))
79
- fail ArgumentError, "`#{k}` is not a valid attribute in `Client::GlobalExclusionResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
79
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Klaviyo::GlobalExclusionResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
80
80
  end
81
81
  h[k.to_sym] = v
82
82
  }
@@ -218,7 +218,7 @@ module Client
218
218
  end
219
219
  else # model
220
220
  # models (e.g. Pet) or oneOf
221
- klass = Client.const_get(type)
221
+ klass = Klaviyo.const_get(type)
222
222
  klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
223
223
  end
224
224
  end
@@ -13,7 +13,7 @@ OpenAPI Generator version: 5.4.0
13
13
  require 'date'
14
14
  require 'time'
15
15
 
16
- module Client
16
+ module Klaviyo
17
17
  class IdentifyPayload
18
18
  attr_accessor :token
19
19
 
@@ -50,13 +50,13 @@ module Client
50
50
  # @param [Hash] attributes Model attributes in the form of hash
51
51
  def initialize(attributes = {})
52
52
  if (!attributes.is_a?(Hash))
53
- fail ArgumentError, "The input argument (attributes) must be a hash in `Client::IdentifyPayload` initialize method"
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Klaviyo::IdentifyPayload` initialize method"
54
54
  end
55
55
 
56
56
  # check to see if the attribute exists and convert string to symbol for hash key
57
57
  attributes = attributes.each_with_object({}) { |(k, v), h|
58
58
  if (!self.class.attribute_map.key?(k.to_sym))
59
- fail ArgumentError, "`#{k}` is not a valid attribute in `Client::IdentifyPayload`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Klaviyo::IdentifyPayload`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
60
  end
61
61
  h[k.to_sym] = v
62
62
  }
@@ -181,7 +181,7 @@ module Client
181
181
  end
182
182
  else # model
183
183
  # models (e.g. Pet) or oneOf
184
- klass = Client.const_get(type)
184
+ klass = Klaviyo.const_get(type)
185
185
  klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
186
186
  end
187
187
  end
@@ -13,7 +13,7 @@ OpenAPI Generator version: 5.4.0
13
13
  require 'date'
14
14
  require 'time'
15
15
 
16
- module Client
16
+ module Klaviyo
17
17
  class IdentifyPayloadProperties
18
18
  attr_accessor :_email
19
19
 
@@ -95,13 +95,13 @@ module Client
95
95
  # @param [Hash] attributes Model attributes in the form of hash
96
96
  def initialize(attributes = {})
97
97
  if (!attributes.is_a?(Hash))
98
- fail ArgumentError, "The input argument (attributes) must be a hash in `Client::IdentifyPayloadProperties` initialize method"
98
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Klaviyo::IdentifyPayloadProperties` initialize method"
99
99
  end
100
100
 
101
101
  # check to see if the attribute exists and convert string to symbol for hash key
102
102
  attributes = attributes.each_with_object({}) { |(k, v), h|
103
103
  if (!self.class.attribute_map.key?(k.to_sym))
104
- fail ArgumentError, "`#{k}` is not a valid attribute in `Client::IdentifyPayloadProperties`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
104
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Klaviyo::IdentifyPayloadProperties`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
105
105
  end
106
106
  h[k.to_sym] = v
107
107
  }
@@ -271,7 +271,7 @@ module Client
271
271
  end
272
272
  else # model
273
273
  # models (e.g. Pet) or oneOf
274
- klass = Client.const_get(type)
274
+ klass = Klaviyo.const_get(type)
275
275
  klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
276
276
  end
277
277
  end
@@ -13,7 +13,7 @@ OpenAPI Generator version: 5.4.0
13
13
  require 'date'
14
14
  require 'time'
15
15
 
16
- module Client
16
+ module Klaviyo
17
17
  class InlineObject
18
18
  attr_accessor :exchange_id
19
19
 
@@ -46,13 +46,13 @@ module Client
46
46
  # @param [Hash] attributes Model attributes in the form of hash
47
47
  def initialize(attributes = {})
48
48
  if (!attributes.is_a?(Hash))
49
- fail ArgumentError, "The input argument (attributes) must be a hash in `Client::InlineObject` initialize method"
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Klaviyo::InlineObject` initialize method"
50
50
  end
51
51
 
52
52
  # check to see if the attribute exists and convert string to symbol for hash key
53
53
  attributes = attributes.each_with_object({}) { |(k, v), h|
54
54
  if (!self.class.attribute_map.key?(k.to_sym))
55
- fail ArgumentError, "`#{k}` is not a valid attribute in `Client::InlineObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Klaviyo::InlineObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
56
  end
57
57
  h[k.to_sym] = v
58
58
  }
@@ -68,12 +68,17 @@ module Client
68
68
  # @return Array for valid properties with the reasons
69
69
  def list_invalid_properties
70
70
  invalid_properties = Array.new
71
+ if @exchange_id.nil?
72
+ invalid_properties.push('invalid value for "exchange_id", exchange_id cannot be nil.')
73
+ end
74
+
71
75
  invalid_properties
72
76
  end
73
77
 
74
78
  # Check to see if the all the properties in the model are valid
75
79
  # @return true if the model is valid
76
80
  def valid?
81
+ return false if @exchange_id.nil?
77
82
  true
78
83
  end
79
84
 
@@ -164,7 +169,7 @@ module Client
164
169
  end
165
170
  else # model
166
171
  # models (e.g. Pet) or oneOf
167
- klass = Client.const_get(type)
172
+ klass = Klaviyo.const_get(type)
168
173
  klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
169
174
  end
170
175
  end
@@ -13,7 +13,7 @@ OpenAPI Generator version: 5.4.0
13
13
  require 'date'
14
14
  require 'time'
15
15
 
16
- module Client
16
+ module Klaviyo
17
17
  # The profiles that you would like to subscribe. Each object in the list must have either an email or phone number key. You can also provide additional properties as key-value pairs. If you are a GDPR compliant business, you will need to include `$consent` in your API call. `$consent` is a list-type, Klaviyo special property and only accepts some subset of the following: `[\"email\", \"web\", \"sms\", \"directmail\", \"mobile\"]`. If you are updating consent for a phone number or would like to send an opt-in SMS to the profile (for double opt-in lists), include an `sms_consent` key in the profile with a value of `true` or `false`.
18
18
  class InlineObject3
19
19
  attr_accessor :profiles
@@ -47,13 +47,13 @@ module Client
47
47
  # @param [Hash] attributes Model attributes in the form of hash
48
48
  def initialize(attributes = {})
49
49
  if (!attributes.is_a?(Hash))
50
- fail ArgumentError, "The input argument (attributes) must be a hash in `Client::InlineObject3` initialize method"
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Klaviyo::InlineObject3` initialize method"
51
51
  end
52
52
 
53
53
  # check to see if the attribute exists and convert string to symbol for hash key
54
54
  attributes = attributes.each_with_object({}) { |(k, v), h|
55
55
  if (!self.class.attribute_map.key?(k.to_sym))
56
- fail ArgumentError, "`#{k}` is not a valid attribute in `Client::InlineObject3`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Klaviyo::InlineObject3`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
57
  end
58
58
  h[k.to_sym] = v
59
59
  }
@@ -170,7 +170,7 @@ module Client
170
170
  end
171
171
  else # model
172
172
  # models (e.g. Pet) or oneOf
173
- klass = Client.const_get(type)
173
+ klass = Klaviyo.const_get(type)
174
174
  klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
175
175
  end
176
176
  end
@@ -13,7 +13,7 @@ OpenAPI Generator version: 5.4.0
13
13
  require 'date'
14
14
  require 'time'
15
15
 
16
- module Client
16
+ module Klaviyo
17
17
  # The profiles that you would like to add to the list. Each object in the array must have an `email` or `phone_number`. You can also provide additional properties as key-value pairs.
18
18
  class InlineObject4
19
19
  attr_accessor :profiles
@@ -47,13 +47,13 @@ module Client
47
47
  # @param [Hash] attributes Model attributes in the form of hash
48
48
  def initialize(attributes = {})
49
49
  if (!attributes.is_a?(Hash))
50
- fail ArgumentError, "The input argument (attributes) must be a hash in `Client::InlineObject4` initialize method"
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Klaviyo::InlineObject4` initialize method"
51
51
  end
52
52
 
53
53
  # check to see if the attribute exists and convert string to symbol for hash key
54
54
  attributes = attributes.each_with_object({}) { |(k, v), h|
55
55
  if (!self.class.attribute_map.key?(k.to_sym))
56
- fail ArgumentError, "`#{k}` is not a valid attribute in `Client::InlineObject4`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Klaviyo::InlineObject4`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
57
  end
58
58
  h[k.to_sym] = v
59
59
  }
@@ -198,7 +198,7 @@ module Client
198
198
  end
199
199
  else # model
200
200
  # models (e.g. Pet) or oneOf
201
- klass = Client.const_get(type)
201
+ klass = Klaviyo.const_get(type)
202
202
  klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
203
203
  end
204
204
  end
@@ -13,8 +13,7 @@ OpenAPI Generator version: 5.4.0
13
13
  require 'date'
14
14
  require 'time'
15
15
 
16
- module Client
17
- # The profiles that you would like to remove from the list. Example: { \"emails\":[\"george.washington@klaviyo.com\",\"abraham.lincoln@klaviyo.com\"], \"phone_numbers\":[\"+13239169023\"], \"push_tokens\":[\"03df25c845d460bcdad7802d2vf6fc1dfde97283bf75cc993eb6dca835ea2e2r\"] }
16
+ module Klaviyo
18
17
  class InlineObject5
19
18
  attr_accessor :emails
20
19
 
@@ -55,13 +54,13 @@ module Client
55
54
  # @param [Hash] attributes Model attributes in the form of hash
56
55
  def initialize(attributes = {})
57
56
  if (!attributes.is_a?(Hash))
58
- fail ArgumentError, "The input argument (attributes) must be a hash in `Client::InlineObject5` initialize method"
57
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Klaviyo::InlineObject5` initialize method"
59
58
  end
60
59
 
61
60
  # check to see if the attribute exists and convert string to symbol for hash key
62
61
  attributes = attributes.each_with_object({}) { |(k, v), h|
63
62
  if (!self.class.attribute_map.key?(k.to_sym))
64
- fail ArgumentError, "`#{k}` is not a valid attribute in `Client::InlineObject5`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Klaviyo::InlineObject5`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
64
  end
66
65
  h[k.to_sym] = v
67
66
  }
@@ -232,7 +231,7 @@ module Client
232
231
  end
233
232
  else # model
234
233
  # models (e.g. Pet) or oneOf
235
- klass = Client.const_get(type)
234
+ klass = Klaviyo.const_get(type)
236
235
  klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
237
236
  end
238
237
  end
@@ -0,0 +1,218 @@
1
+ =begin
2
+ #Klaviyo API
3
+
4
+ #Empowering creators to own their destiny
5
+
6
+ The version of the OpenAPI document: 2022.03.29
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Klaviyo
17
+ class InlineResponse200
18
+ attr_accessor :id
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'id' => :'id'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'id' => :'String'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Klaviyo::InlineResponse200` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Klaviyo::InlineResponse200`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'id')
61
+ self.id = attributes[:'id']
62
+ end
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
69
+ invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ true
76
+ end
77
+
78
+ # Checks equality by comparing each attribute.
79
+ # @param [Object] Object to be compared
80
+ def ==(o)
81
+ return true if self.equal?(o)
82
+ self.class == o.class &&
83
+ id == o.id
84
+ end
85
+
86
+ # @see the `==` method
87
+ # @param [Object] Object to be compared
88
+ def eql?(o)
89
+ self == o
90
+ end
91
+
92
+ # Calculates hash code according to all attributes.
93
+ # @return [Integer] Hash code
94
+ def hash
95
+ [id].hash
96
+ end
97
+
98
+ # Builds the object from hash
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @return [Object] Returns the model itself
101
+ def self.build_from_hash(attributes)
102
+ new.build_from_hash(attributes)
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+ self.class.openapi_types.each_pair do |key, type|
111
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
112
+ self.send("#{key}=", nil)
113
+ elsif type =~ /\AArray<(.*)>/i
114
+ # check to ensure the input is an array given that the attribute
115
+ # is documented as an array but the input is not
116
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
117
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
118
+ end
119
+ elsif !attributes[self.class.attribute_map[key]].nil?
120
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
121
+ end
122
+ end
123
+
124
+ self
125
+ end
126
+
127
+ # Deserializes the data based on type
128
+ # @param string type Data type
129
+ # @param string value Value to be deserialized
130
+ # @return [Object] Deserialized data
131
+ def _deserialize(type, value)
132
+ case type.to_sym
133
+ when :Time
134
+ Time.parse(value)
135
+ when :Date
136
+ Date.parse(value)
137
+ when :String
138
+ value.to_s
139
+ when :Integer
140
+ value.to_i
141
+ when :Float
142
+ value.to_f
143
+ when :Boolean
144
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
145
+ true
146
+ else
147
+ false
148
+ end
149
+ when :Object
150
+ # generic object (usually a Hash), return directly
151
+ value
152
+ when /\AArray<(?<inner_type>.+)>\z/
153
+ inner_type = Regexp.last_match[:inner_type]
154
+ value.map { |v| _deserialize(inner_type, v) }
155
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
156
+ k_type = Regexp.last_match[:k_type]
157
+ v_type = Regexp.last_match[:v_type]
158
+ {}.tap do |hash|
159
+ value.each do |k, v|
160
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
161
+ end
162
+ end
163
+ else # model
164
+ # models (e.g. Pet) or oneOf
165
+ klass = Klaviyo.const_get(type)
166
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
167
+ end
168
+ end
169
+
170
+ # Returns the string representation of the object
171
+ # @return [String] String presentation of the object
172
+ def to_s
173
+ to_hash.to_s
174
+ end
175
+
176
+ # to_body is an alias to to_hash (backward compatibility)
177
+ # @return [Hash] Returns the object in the form of hash
178
+ def to_body
179
+ to_hash
180
+ end
181
+
182
+ # Returns the object in the form of hash
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_hash
185
+ hash = {}
186
+ self.class.attribute_map.each_pair do |attr, param|
187
+ value = self.send(attr)
188
+ if value.nil?
189
+ is_nullable = self.class.openapi_nullable.include?(attr)
190
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
191
+ end
192
+
193
+ hash[param] = _to_hash(value)
194
+ end
195
+ hash
196
+ end
197
+
198
+ # Outputs non-array value in the form of hash
199
+ # For object, use to_hash. Otherwise, just return the value
200
+ # @param [Object] value Any valid value
201
+ # @return [Hash] Returns the value in the form of hash
202
+ def _to_hash(value)
203
+ if value.is_a?(Array)
204
+ value.compact.map { |v| _to_hash(v) }
205
+ elsif value.is_a?(Hash)
206
+ {}.tap do |hash|
207
+ value.each { |k, v| hash[k] = _to_hash(v) }
208
+ end
209
+ elsif value.respond_to? :to_hash
210
+ value.to_hash
211
+ else
212
+ value
213
+ end
214
+ end
215
+
216
+ end
217
+
218
+ end
@@ -13,7 +13,7 @@ OpenAPI Generator version: 5.4.0
13
13
  require 'date'
14
14
  require 'time'
15
15
 
16
- module Client
16
+ module Klaviyo
17
17
  class Metric
18
18
  attr_accessor :object
19
19
 
@@ -66,13 +66,13 @@ module Client
66
66
  # @param [Hash] attributes Model attributes in the form of hash
67
67
  def initialize(attributes = {})
68
68
  if (!attributes.is_a?(Hash))
69
- fail ArgumentError, "The input argument (attributes) must be a hash in `Client::Metric` initialize method"
69
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Klaviyo::Metric` initialize method"
70
70
  end
71
71
 
72
72
  # check to see if the attribute exists and convert string to symbol for hash key
73
73
  attributes = attributes.each_with_object({}) { |(k, v), h|
74
74
  if (!self.class.attribute_map.key?(k.to_sym))
75
- fail ArgumentError, "`#{k}` is not a valid attribute in `Client::Metric`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
75
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Klaviyo::Metric`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
76
76
  end
77
77
  h[k.to_sym] = v
78
78
  }
@@ -209,7 +209,7 @@ module Client
209
209
  end
210
210
  else # model
211
211
  # models (e.g. Pet) or oneOf
212
- klass = Client.const_get(type)
212
+ klass = Klaviyo.const_get(type)
213
213
  klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
214
214
  end
215
215
  end
@@ -13,7 +13,7 @@ OpenAPI Generator version: 5.4.0
13
13
  require 'date'
14
14
  require 'time'
15
15
 
16
- module Client
16
+ module Klaviyo
17
17
  class MetricExport
18
18
  attr_accessor :metric
19
19
 
@@ -74,13 +74,13 @@ module Client
74
74
  # @param [Hash] attributes Model attributes in the form of hash
75
75
  def initialize(attributes = {})
76
76
  if (!attributes.is_a?(Hash))
77
- fail ArgumentError, "The input argument (attributes) must be a hash in `Client::MetricExport` initialize method"
77
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Klaviyo::MetricExport` initialize method"
78
78
  end
79
79
 
80
80
  # check to see if the attribute exists and convert string to symbol for hash key
81
81
  attributes = attributes.each_with_object({}) { |(k, v), h|
82
82
  if (!self.class.attribute_map.key?(k.to_sym))
83
- fail ArgumentError, "`#{k}` is not a valid attribute in `Client::MetricExport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
83
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Klaviyo::MetricExport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
84
84
  end
85
85
  h[k.to_sym] = v
86
86
  }
@@ -229,7 +229,7 @@ module Client
229
229
  end
230
230
  else # model
231
231
  # models (e.g. Pet) or oneOf
232
- klass = Client.const_get(type)
232
+ klass = Klaviyo.const_get(type)
233
233
  klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
234
234
  end
235
235
  end
@@ -13,7 +13,7 @@ OpenAPI Generator version: 5.4.0
13
13
  require 'date'
14
14
  require 'time'
15
15
 
16
- module Client
16
+ module Klaviyo
17
17
  class MetricTimeline
18
18
  attr_accessor :object
19
19
 
@@ -58,13 +58,13 @@ module Client
58
58
  # @param [Hash] attributes Model attributes in the form of hash
59
59
  def initialize(attributes = {})
60
60
  if (!attributes.is_a?(Hash))
61
- fail ArgumentError, "The input argument (attributes) must be a hash in `Client::MetricTimeline` initialize method"
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Klaviyo::MetricTimeline` initialize method"
62
62
  end
63
63
 
64
64
  # check to see if the attribute exists and convert string to symbol for hash key
65
65
  attributes = attributes.each_with_object({}) { |(k, v), h|
66
66
  if (!self.class.attribute_map.key?(k.to_sym))
67
- fail ArgumentError, "`#{k}` is not a valid attribute in `Client::MetricTimeline`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Klaviyo::MetricTimeline`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
68
  end
69
69
  h[k.to_sym] = v
70
70
  }
@@ -215,7 +215,7 @@ module Client
215
215
  end
216
216
  else # model
217
217
  # models (e.g. Pet) or oneOf
218
- klass = Client.const_get(type)
218
+ klass = Klaviyo.const_get(type)
219
219
  klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
220
220
  end
221
221
  end
@@ -13,7 +13,7 @@ OpenAPI Generator version: 5.4.0
13
13
  require 'date'
14
14
  require 'time'
15
15
 
16
- module Client
16
+ module Klaviyo
17
17
  class MetricTimelineData
18
18
  attr_accessor :object
19
19
 
@@ -78,13 +78,13 @@ module Client
78
78
  # @param [Hash] attributes Model attributes in the form of hash
79
79
  def initialize(attributes = {})
80
80
  if (!attributes.is_a?(Hash))
81
- fail ArgumentError, "The input argument (attributes) must be a hash in `Client::MetricTimelineData` initialize method"
81
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Klaviyo::MetricTimelineData` initialize method"
82
82
  end
83
83
 
84
84
  # check to see if the attribute exists and convert string to symbol for hash key
85
85
  attributes = attributes.each_with_object({}) { |(k, v), h|
86
86
  if (!self.class.attribute_map.key?(k.to_sym))
87
- fail ArgumentError, "`#{k}` is not a valid attribute in `Client::MetricTimelineData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Klaviyo::MetricTimelineData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
88
88
  end
89
89
  h[k.to_sym] = v
90
90
  }
@@ -238,7 +238,7 @@ module Client
238
238
  end
239
239
  else # model
240
240
  # models (e.g. Pet) or oneOf
241
- klass = Client.const_get(type)
241
+ klass = Klaviyo.const_get(type)
242
242
  klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
243
243
  end
244
244
  end
@@ -13,7 +13,7 @@ OpenAPI Generator version: 5.4.0
13
13
  require 'date'
14
14
  require 'time'
15
15
 
16
- module Client
16
+ module Klaviyo
17
17
  class Person
18
18
  attr_accessor :object
19
19
 
@@ -122,13 +122,13 @@ module Client
122
122
  # @param [Hash] attributes Model attributes in the form of hash
123
123
  def initialize(attributes = {})
124
124
  if (!attributes.is_a?(Hash))
125
- fail ArgumentError, "The input argument (attributes) must be a hash in `Client::Person` initialize method"
125
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Klaviyo::Person` initialize method"
126
126
  end
127
127
 
128
128
  # check to see if the attribute exists and convert string to symbol for hash key
129
129
  attributes = attributes.each_with_object({}) { |(k, v), h|
130
130
  if (!self.class.attribute_map.key?(k.to_sym))
131
- fail ArgumentError, "`#{k}` is not a valid attribute in `Client::Person`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
131
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Klaviyo::Person`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
132
132
  end
133
133
  h[k.to_sym] = v
134
134
  }
@@ -333,7 +333,7 @@ module Client
333
333
  end
334
334
  else # model
335
335
  # models (e.g. Pet) or oneOf
336
- klass = Client.const_get(type)
336
+ klass = Klaviyo.const_get(type)
337
337
  klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
338
338
  end
339
339
  end