late-sdk 0.0.98 → 0.0.99

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 (125) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +53 -0
  3. data/docs/Ad.md +58 -0
  4. data/docs/AdAudiencesApi.md +365 -0
  5. data/docs/AdBudget.md +20 -0
  6. data/docs/AdCampaign.md +40 -0
  7. data/docs/AdCampaignsApi.md +165 -0
  8. data/docs/AdMetrics.md +34 -0
  9. data/docs/AdSchedule.md +20 -0
  10. data/docs/AddUsersToAdAudience200Response.md +22 -0
  11. data/docs/AddUsersToAdAudienceRequest.md +18 -0
  12. data/docs/AddUsersToAdAudienceRequestUsersInner.md +20 -0
  13. data/docs/AdsApi.md +726 -0
  14. data/docs/BoostPostRequest.md +36 -0
  15. data/docs/BoostPostRequestBudget.md +20 -0
  16. data/docs/BoostPostRequestSchedule.md +20 -0
  17. data/docs/BoostPostRequestTargeting.md +24 -0
  18. data/docs/CreateAdAudience201Response.md +20 -0
  19. data/docs/CreateAdAudienceRequest.md +36 -0
  20. data/docs/CreateStandaloneAdRequest.md +56 -0
  21. data/docs/GetAd200Response.md +18 -0
  22. data/docs/GetAdAnalytics200Response.md +20 -0
  23. data/docs/GetAdAnalytics200ResponseAd.md +24 -0
  24. data/docs/GetAdAnalytics200ResponseAnalytics.md +22 -0
  25. data/docs/GetAdAnalytics200ResponseAnalyticsDailyInner.md +36 -0
  26. data/docs/GetAdAudience200Response.md +20 -0
  27. data/docs/ListAdAccounts200Response.md +18 -0
  28. data/docs/ListAdAccounts200ResponseAccountsInner.md +24 -0
  29. data/docs/ListAdAudiences200Response.md +18 -0
  30. data/docs/ListAdAudiences200ResponseAudiencesInner.md +32 -0
  31. data/docs/ListAdCampaigns200Response.md +20 -0
  32. data/docs/ListAds200Response.md +20 -0
  33. data/docs/SearchAdInterests200Response.md +18 -0
  34. data/docs/SearchAdInterests200ResponseInterestsInner.md +22 -0
  35. data/docs/SyncExternalAds200Response.md +24 -0
  36. data/docs/UpdateAd200Response.md +20 -0
  37. data/docs/UpdateAdCampaignStatus200Response.md +22 -0
  38. data/docs/UpdateAdCampaignStatusRequest.md +20 -0
  39. data/docs/UpdateAdRequest.md +24 -0
  40. data/docs/UpdateAdRequestBudget.md +20 -0
  41. data/docs/UpdateAdRequestTargeting.md +24 -0
  42. data/lib/late-sdk/api/ad_audiences_api.rb +368 -0
  43. data/lib/late-sdk/api/ad_campaigns_api.rb +201 -0
  44. data/lib/late-sdk/api/ads_api.rb +719 -0
  45. data/lib/late-sdk/models/ad.rb +399 -0
  46. data/lib/late-sdk/models/ad_budget.rb +190 -0
  47. data/lib/late-sdk/models/ad_campaign.rb +293 -0
  48. data/lib/late-sdk/models/ad_metrics.rb +222 -0
  49. data/lib/late-sdk/models/ad_schedule.rb +156 -0
  50. data/lib/late-sdk/models/add_users_to_ad_audience200_response.rb +165 -0
  51. data/lib/late-sdk/models/add_users_to_ad_audience_request.rb +175 -0
  52. data/lib/late-sdk/models/add_users_to_ad_audience_request_users_inner.rb +157 -0
  53. data/lib/late-sdk/models/boost_post_request.rb +350 -0
  54. data/lib/late-sdk/models/boost_post_request_budget.rb +215 -0
  55. data/lib/late-sdk/models/boost_post_request_schedule.rb +157 -0
  56. data/lib/late-sdk/models/boost_post_request_targeting.rb +234 -0
  57. data/lib/late-sdk/models/create_ad_audience201_response.rb +156 -0
  58. data/lib/late-sdk/models/create_ad_audience_request.rb +391 -0
  59. data/lib/late-sdk/models/create_standalone_ad_request.rb +585 -0
  60. data/lib/late-sdk/models/get_ad200_response.rb +147 -0
  61. data/lib/late-sdk/models/get_ad_analytics200_response.rb +156 -0
  62. data/lib/late-sdk/models/get_ad_analytics200_response_ad.rb +174 -0
  63. data/lib/late-sdk/models/get_ad_analytics200_response_analytics.rb +169 -0
  64. data/lib/late-sdk/models/get_ad_analytics200_response_analytics_daily_inner.rb +238 -0
  65. data/lib/late-sdk/models/get_ad_audience200_response.rb +157 -0
  66. data/lib/late-sdk/models/list_ad_accounts200_response.rb +149 -0
  67. data/lib/late-sdk/models/list_ad_accounts200_response_accounts_inner.rb +175 -0
  68. data/lib/late-sdk/models/list_ad_audiences200_response.rb +149 -0
  69. data/lib/late-sdk/models/list_ad_audiences200_response_audiences_inner.rb +244 -0
  70. data/lib/late-sdk/models/list_ad_campaigns200_response.rb +158 -0
  71. data/lib/late-sdk/models/list_ads200_response.rb +158 -0
  72. data/lib/late-sdk/models/search_ad_interests200_response.rb +149 -0
  73. data/lib/late-sdk/models/search_ad_interests200_response_interests_inner.rb +165 -0
  74. data/lib/late-sdk/models/sync_external_ads200_response.rb +177 -0
  75. data/lib/late-sdk/models/update_ad200_response.rb +156 -0
  76. data/lib/late-sdk/models/update_ad_campaign_status200_response.rb +169 -0
  77. data/lib/late-sdk/models/update_ad_campaign_status_request.rb +216 -0
  78. data/lib/late-sdk/models/update_ad_request.rb +208 -0
  79. data/lib/late-sdk/models/update_ad_request_budget.rb +191 -0
  80. data/lib/late-sdk/models/update_ad_request_targeting.rb +235 -0
  81. data/lib/late-sdk/version.rb +1 -1
  82. data/lib/late-sdk.rb +39 -0
  83. data/openapi.yaml +684 -0
  84. data/spec/api/ad_audiences_api_spec.rb +98 -0
  85. data/spec/api/ad_campaigns_api_spec.rb +67 -0
  86. data/spec/api/ads_api_spec.rb +163 -0
  87. data/spec/models/ad_budget_spec.rb +46 -0
  88. data/spec/models/ad_campaign_spec.rb +110 -0
  89. data/spec/models/ad_metrics_spec.rb +84 -0
  90. data/spec/models/ad_schedule_spec.rb +42 -0
  91. data/spec/models/ad_spec.rb +172 -0
  92. data/spec/models/add_users_to_ad_audience200_response_spec.rb +48 -0
  93. data/spec/models/add_users_to_ad_audience_request_spec.rb +36 -0
  94. data/spec/models/add_users_to_ad_audience_request_users_inner_spec.rb +42 -0
  95. data/spec/models/boost_post_request_budget_spec.rb +46 -0
  96. data/spec/models/boost_post_request_schedule_spec.rb +42 -0
  97. data/spec/models/boost_post_request_spec.rb +94 -0
  98. data/spec/models/boost_post_request_targeting_spec.rb +54 -0
  99. data/spec/models/create_ad_audience201_response_spec.rb +42 -0
  100. data/spec/models/create_ad_audience_request_spec.rb +94 -0
  101. data/spec/models/create_standalone_ad_request_spec.rb +166 -0
  102. data/spec/models/get_ad200_response_spec.rb +36 -0
  103. data/spec/models/get_ad_analytics200_response_ad_spec.rb +54 -0
  104. data/spec/models/get_ad_analytics200_response_analytics_daily_inner_spec.rb +90 -0
  105. data/spec/models/get_ad_analytics200_response_analytics_spec.rb +48 -0
  106. data/spec/models/get_ad_analytics200_response_spec.rb +42 -0
  107. data/spec/models/get_ad_audience200_response_spec.rb +42 -0
  108. data/spec/models/list_ad_accounts200_response_accounts_inner_spec.rb +54 -0
  109. data/spec/models/list_ad_accounts200_response_spec.rb +36 -0
  110. data/spec/models/list_ad_audiences200_response_audiences_inner_spec.rb +82 -0
  111. data/spec/models/list_ad_audiences200_response_spec.rb +36 -0
  112. data/spec/models/list_ad_campaigns200_response_spec.rb +42 -0
  113. data/spec/models/list_ads200_response_spec.rb +42 -0
  114. data/spec/models/search_ad_interests200_response_interests_inner_spec.rb +48 -0
  115. data/spec/models/search_ad_interests200_response_spec.rb +36 -0
  116. data/spec/models/sync_external_ads200_response_spec.rb +54 -0
  117. data/spec/models/update_ad200_response_spec.rb +42 -0
  118. data/spec/models/update_ad_campaign_status200_response_spec.rb +48 -0
  119. data/spec/models/update_ad_campaign_status_request_spec.rb +50 -0
  120. data/spec/models/update_ad_request_budget_spec.rb +46 -0
  121. data/spec/models/update_ad_request_spec.rb +58 -0
  122. data/spec/models/update_ad_request_targeting_spec.rb +54 -0
  123. data/zernio-sdk-0.0.99.gem +0 -0
  124. metadata +158 -2
  125. data/zernio-sdk-0.0.98.gem +0 -0
@@ -0,0 +1,399 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
5
+
6
+ The version of the OpenAPI document: 1.0.1
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Late
17
+ class Ad < ApiModelBase
18
+ attr_accessor :_id
19
+
20
+ attr_accessor :name
21
+
22
+ attr_accessor :platform
23
+
24
+ attr_accessor :status
25
+
26
+ attr_accessor :ad_type
27
+
28
+ attr_accessor :goal
29
+
30
+ # True for ads synced from platform ad managers
31
+ attr_accessor :is_external
32
+
33
+ attr_accessor :budget
34
+
35
+ attr_accessor :metrics
36
+
37
+ attr_accessor :platform_ad_id
38
+
39
+ attr_accessor :platform_ad_account_id
40
+
41
+ attr_accessor :platform_campaign_id
42
+
43
+ attr_accessor :platform_ad_set_id
44
+
45
+ attr_accessor :campaign_name
46
+
47
+ attr_accessor :ad_set_name
48
+
49
+ # Platform-specific creative data
50
+ attr_accessor :creative
51
+
52
+ attr_accessor :targeting
53
+
54
+ attr_accessor :schedule
55
+
56
+ attr_accessor :rejection_reason
57
+
58
+ attr_accessor :created_at
59
+
60
+ attr_accessor :updated_at
61
+
62
+ class EnumAttributeValidator
63
+ attr_reader :datatype
64
+ attr_reader :allowable_values
65
+
66
+ def initialize(datatype, allowable_values)
67
+ @allowable_values = allowable_values.map do |value|
68
+ case datatype.to_s
69
+ when /Integer/i
70
+ value.to_i
71
+ when /Float/i
72
+ value.to_f
73
+ else
74
+ value
75
+ end
76
+ end
77
+ end
78
+
79
+ def valid?(value)
80
+ !value || allowable_values.include?(value)
81
+ end
82
+ end
83
+
84
+ # Attribute mapping from ruby-style variable name to JSON key.
85
+ def self.attribute_map
86
+ {
87
+ :'_id' => :'_id',
88
+ :'name' => :'name',
89
+ :'platform' => :'platform',
90
+ :'status' => :'status',
91
+ :'ad_type' => :'adType',
92
+ :'goal' => :'goal',
93
+ :'is_external' => :'isExternal',
94
+ :'budget' => :'budget',
95
+ :'metrics' => :'metrics',
96
+ :'platform_ad_id' => :'platformAdId',
97
+ :'platform_ad_account_id' => :'platformAdAccountId',
98
+ :'platform_campaign_id' => :'platformCampaignId',
99
+ :'platform_ad_set_id' => :'platformAdSetId',
100
+ :'campaign_name' => :'campaignName',
101
+ :'ad_set_name' => :'adSetName',
102
+ :'creative' => :'creative',
103
+ :'targeting' => :'targeting',
104
+ :'schedule' => :'schedule',
105
+ :'rejection_reason' => :'rejectionReason',
106
+ :'created_at' => :'createdAt',
107
+ :'updated_at' => :'updatedAt'
108
+ }
109
+ end
110
+
111
+ # Returns attribute mapping this model knows about
112
+ def self.acceptable_attribute_map
113
+ attribute_map
114
+ end
115
+
116
+ # Returns all the JSON keys this model knows about
117
+ def self.acceptable_attributes
118
+ acceptable_attribute_map.values
119
+ end
120
+
121
+ # Attribute type mapping.
122
+ def self.openapi_types
123
+ {
124
+ :'_id' => :'String',
125
+ :'name' => :'String',
126
+ :'platform' => :'String',
127
+ :'status' => :'String',
128
+ :'ad_type' => :'String',
129
+ :'goal' => :'String',
130
+ :'is_external' => :'Boolean',
131
+ :'budget' => :'AdBudget',
132
+ :'metrics' => :'AdMetrics',
133
+ :'platform_ad_id' => :'String',
134
+ :'platform_ad_account_id' => :'String',
135
+ :'platform_campaign_id' => :'String',
136
+ :'platform_ad_set_id' => :'String',
137
+ :'campaign_name' => :'String',
138
+ :'ad_set_name' => :'String',
139
+ :'creative' => :'Object',
140
+ :'targeting' => :'Object',
141
+ :'schedule' => :'AdSchedule',
142
+ :'rejection_reason' => :'String',
143
+ :'created_at' => :'Time',
144
+ :'updated_at' => :'Time'
145
+ }
146
+ end
147
+
148
+ # List of attributes with nullable: true
149
+ def self.openapi_nullable
150
+ Set.new([
151
+ ])
152
+ end
153
+
154
+ # Initializes the object
155
+ # @param [Hash] attributes Model attributes in the form of hash
156
+ def initialize(attributes = {})
157
+ if (!attributes.is_a?(Hash))
158
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Late::Ad` initialize method"
159
+ end
160
+
161
+ # check to see if the attribute exists and convert string to symbol for hash key
162
+ acceptable_attribute_map = self.class.acceptable_attribute_map
163
+ attributes = attributes.each_with_object({}) { |(k, v), h|
164
+ if (!acceptable_attribute_map.key?(k.to_sym))
165
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Late::Ad`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
166
+ end
167
+ h[k.to_sym] = v
168
+ }
169
+
170
+ if attributes.key?(:'_id')
171
+ self._id = attributes[:'_id']
172
+ end
173
+
174
+ if attributes.key?(:'name')
175
+ self.name = attributes[:'name']
176
+ end
177
+
178
+ if attributes.key?(:'platform')
179
+ self.platform = attributes[:'platform']
180
+ end
181
+
182
+ if attributes.key?(:'status')
183
+ self.status = attributes[:'status']
184
+ end
185
+
186
+ if attributes.key?(:'ad_type')
187
+ self.ad_type = attributes[:'ad_type']
188
+ end
189
+
190
+ if attributes.key?(:'goal')
191
+ self.goal = attributes[:'goal']
192
+ end
193
+
194
+ if attributes.key?(:'is_external')
195
+ self.is_external = attributes[:'is_external']
196
+ end
197
+
198
+ if attributes.key?(:'budget')
199
+ self.budget = attributes[:'budget']
200
+ end
201
+
202
+ if attributes.key?(:'metrics')
203
+ self.metrics = attributes[:'metrics']
204
+ end
205
+
206
+ if attributes.key?(:'platform_ad_id')
207
+ self.platform_ad_id = attributes[:'platform_ad_id']
208
+ end
209
+
210
+ if attributes.key?(:'platform_ad_account_id')
211
+ self.platform_ad_account_id = attributes[:'platform_ad_account_id']
212
+ end
213
+
214
+ if attributes.key?(:'platform_campaign_id')
215
+ self.platform_campaign_id = attributes[:'platform_campaign_id']
216
+ end
217
+
218
+ if attributes.key?(:'platform_ad_set_id')
219
+ self.platform_ad_set_id = attributes[:'platform_ad_set_id']
220
+ end
221
+
222
+ if attributes.key?(:'campaign_name')
223
+ self.campaign_name = attributes[:'campaign_name']
224
+ end
225
+
226
+ if attributes.key?(:'ad_set_name')
227
+ self.ad_set_name = attributes[:'ad_set_name']
228
+ end
229
+
230
+ if attributes.key?(:'creative')
231
+ self.creative = attributes[:'creative']
232
+ end
233
+
234
+ if attributes.key?(:'targeting')
235
+ self.targeting = attributes[:'targeting']
236
+ end
237
+
238
+ if attributes.key?(:'schedule')
239
+ self.schedule = attributes[:'schedule']
240
+ end
241
+
242
+ if attributes.key?(:'rejection_reason')
243
+ self.rejection_reason = attributes[:'rejection_reason']
244
+ end
245
+
246
+ if attributes.key?(:'created_at')
247
+ self.created_at = attributes[:'created_at']
248
+ end
249
+
250
+ if attributes.key?(:'updated_at')
251
+ self.updated_at = attributes[:'updated_at']
252
+ end
253
+ end
254
+
255
+ # Show invalid properties with the reasons. Usually used together with valid?
256
+ # @return Array for valid properties with the reasons
257
+ def list_invalid_properties
258
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
259
+ invalid_properties = Array.new
260
+ invalid_properties
261
+ end
262
+
263
+ # Check to see if the all the properties in the model are valid
264
+ # @return true if the model is valid
265
+ def valid?
266
+ warn '[DEPRECATED] the `valid?` method is obsolete'
267
+ platform_validator = EnumAttributeValidator.new('String', ["facebook", "instagram", "tiktok", "linkedin", "pinterest", "google", "twitter"])
268
+ return false unless platform_validator.valid?(@platform)
269
+ status_validator = EnumAttributeValidator.new('String', ["active", "paused", "pending_review", "rejected", "completed", "cancelled", "error"])
270
+ return false unless status_validator.valid?(@status)
271
+ ad_type_validator = EnumAttributeValidator.new('String', ["boost", "standalone"])
272
+ return false unless ad_type_validator.valid?(@ad_type)
273
+ goal_validator = EnumAttributeValidator.new('String', ["engagement", "traffic", "awareness", "video_views"])
274
+ return false unless goal_validator.valid?(@goal)
275
+ true
276
+ end
277
+
278
+ # Custom attribute writer method checking allowed values (enum).
279
+ # @param [Object] platform Object to be assigned
280
+ def platform=(platform)
281
+ validator = EnumAttributeValidator.new('String', ["facebook", "instagram", "tiktok", "linkedin", "pinterest", "google", "twitter"])
282
+ unless validator.valid?(platform)
283
+ fail ArgumentError, "invalid value for \"platform\", must be one of #{validator.allowable_values}."
284
+ end
285
+ @platform = platform
286
+ end
287
+
288
+ # Custom attribute writer method checking allowed values (enum).
289
+ # @param [Object] status Object to be assigned
290
+ def status=(status)
291
+ validator = EnumAttributeValidator.new('String', ["active", "paused", "pending_review", "rejected", "completed", "cancelled", "error"])
292
+ unless validator.valid?(status)
293
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
294
+ end
295
+ @status = status
296
+ end
297
+
298
+ # Custom attribute writer method checking allowed values (enum).
299
+ # @param [Object] ad_type Object to be assigned
300
+ def ad_type=(ad_type)
301
+ validator = EnumAttributeValidator.new('String', ["boost", "standalone"])
302
+ unless validator.valid?(ad_type)
303
+ fail ArgumentError, "invalid value for \"ad_type\", must be one of #{validator.allowable_values}."
304
+ end
305
+ @ad_type = ad_type
306
+ end
307
+
308
+ # Custom attribute writer method checking allowed values (enum).
309
+ # @param [Object] goal Object to be assigned
310
+ def goal=(goal)
311
+ validator = EnumAttributeValidator.new('String', ["engagement", "traffic", "awareness", "video_views"])
312
+ unless validator.valid?(goal)
313
+ fail ArgumentError, "invalid value for \"goal\", must be one of #{validator.allowable_values}."
314
+ end
315
+ @goal = goal
316
+ end
317
+
318
+ # Checks equality by comparing each attribute.
319
+ # @param [Object] Object to be compared
320
+ def ==(o)
321
+ return true if self.equal?(o)
322
+ self.class == o.class &&
323
+ _id == o._id &&
324
+ name == o.name &&
325
+ platform == o.platform &&
326
+ status == o.status &&
327
+ ad_type == o.ad_type &&
328
+ goal == o.goal &&
329
+ is_external == o.is_external &&
330
+ budget == o.budget &&
331
+ metrics == o.metrics &&
332
+ platform_ad_id == o.platform_ad_id &&
333
+ platform_ad_account_id == o.platform_ad_account_id &&
334
+ platform_campaign_id == o.platform_campaign_id &&
335
+ platform_ad_set_id == o.platform_ad_set_id &&
336
+ campaign_name == o.campaign_name &&
337
+ ad_set_name == o.ad_set_name &&
338
+ creative == o.creative &&
339
+ targeting == o.targeting &&
340
+ schedule == o.schedule &&
341
+ rejection_reason == o.rejection_reason &&
342
+ created_at == o.created_at &&
343
+ updated_at == o.updated_at
344
+ end
345
+
346
+ # @see the `==` method
347
+ # @param [Object] Object to be compared
348
+ def eql?(o)
349
+ self == o
350
+ end
351
+
352
+ # Calculates hash code according to all attributes.
353
+ # @return [Integer] Hash code
354
+ def hash
355
+ [_id, name, platform, status, ad_type, goal, is_external, budget, metrics, platform_ad_id, platform_ad_account_id, platform_campaign_id, platform_ad_set_id, campaign_name, ad_set_name, creative, targeting, schedule, rejection_reason, created_at, updated_at].hash
356
+ end
357
+
358
+ # Builds the object from hash
359
+ # @param [Hash] attributes Model attributes in the form of hash
360
+ # @return [Object] Returns the model itself
361
+ def self.build_from_hash(attributes)
362
+ return nil unless attributes.is_a?(Hash)
363
+ attributes = attributes.transform_keys(&:to_sym)
364
+ transformed_hash = {}
365
+ openapi_types.each_pair do |key, type|
366
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
367
+ transformed_hash["#{key}"] = nil
368
+ elsif type =~ /\AArray<(.*)>/i
369
+ # check to ensure the input is an array given that the attribute
370
+ # is documented as an array but the input is not
371
+ if attributes[attribute_map[key]].is_a?(Array)
372
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
373
+ end
374
+ elsif !attributes[attribute_map[key]].nil?
375
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
376
+ end
377
+ end
378
+ new(transformed_hash)
379
+ end
380
+
381
+ # Returns the object in the form of hash
382
+ # @return [Hash] Returns the object in the form of hash
383
+ def to_hash
384
+ hash = {}
385
+ self.class.attribute_map.each_pair do |attr, param|
386
+ value = self.send(attr)
387
+ if value.nil?
388
+ is_nullable = self.class.openapi_nullable.include?(attr)
389
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
390
+ end
391
+
392
+ hash[param] = _to_hash(value)
393
+ end
394
+ hash
395
+ end
396
+
397
+ end
398
+
399
+ end
@@ -0,0 +1,190 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
5
+
6
+ The version of the OpenAPI document: 1.0.1
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Late
17
+ class AdBudget < ApiModelBase
18
+ attr_accessor :amount
19
+
20
+ attr_accessor :type
21
+
22
+ class EnumAttributeValidator
23
+ attr_reader :datatype
24
+ attr_reader :allowable_values
25
+
26
+ def initialize(datatype, allowable_values)
27
+ @allowable_values = allowable_values.map do |value|
28
+ case datatype.to_s
29
+ when /Integer/i
30
+ value.to_i
31
+ when /Float/i
32
+ value.to_f
33
+ else
34
+ value
35
+ end
36
+ end
37
+ end
38
+
39
+ def valid?(value)
40
+ !value || allowable_values.include?(value)
41
+ end
42
+ end
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'amount' => :'amount',
48
+ :'type' => :'type'
49
+ }
50
+ end
51
+
52
+ # Returns attribute mapping this model knows about
53
+ def self.acceptable_attribute_map
54
+ attribute_map
55
+ end
56
+
57
+ # Returns all the JSON keys this model knows about
58
+ def self.acceptable_attributes
59
+ acceptable_attribute_map.values
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.openapi_types
64
+ {
65
+ :'amount' => :'Float',
66
+ :'type' => :'String'
67
+ }
68
+ end
69
+
70
+ # List of attributes with nullable: true
71
+ def self.openapi_nullable
72
+ Set.new([
73
+ ])
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Late::AdBudget` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ acceptable_attribute_map = self.class.acceptable_attribute_map
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!acceptable_attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Late::AdBudget`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'amount')
93
+ self.amount = attributes[:'amount']
94
+ end
95
+
96
+ if attributes.key?(:'type')
97
+ self.type = attributes[:'type']
98
+ end
99
+ end
100
+
101
+ # Show invalid properties with the reasons. Usually used together with valid?
102
+ # @return Array for valid properties with the reasons
103
+ def list_invalid_properties
104
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
105
+ invalid_properties = Array.new
106
+ invalid_properties
107
+ end
108
+
109
+ # Check to see if the all the properties in the model are valid
110
+ # @return true if the model is valid
111
+ def valid?
112
+ warn '[DEPRECATED] the `valid?` method is obsolete'
113
+ type_validator = EnumAttributeValidator.new('String', ["daily", "lifetime"])
114
+ return false unless type_validator.valid?(@type)
115
+ true
116
+ end
117
+
118
+ # Custom attribute writer method checking allowed values (enum).
119
+ # @param [Object] type Object to be assigned
120
+ def type=(type)
121
+ validator = EnumAttributeValidator.new('String', ["daily", "lifetime"])
122
+ unless validator.valid?(type)
123
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
124
+ end
125
+ @type = type
126
+ end
127
+
128
+ # Checks equality by comparing each attribute.
129
+ # @param [Object] Object to be compared
130
+ def ==(o)
131
+ return true if self.equal?(o)
132
+ self.class == o.class &&
133
+ amount == o.amount &&
134
+ type == o.type
135
+ end
136
+
137
+ # @see the `==` method
138
+ # @param [Object] Object to be compared
139
+ def eql?(o)
140
+ self == o
141
+ end
142
+
143
+ # Calculates hash code according to all attributes.
144
+ # @return [Integer] Hash code
145
+ def hash
146
+ [amount, type].hash
147
+ end
148
+
149
+ # Builds the object from hash
150
+ # @param [Hash] attributes Model attributes in the form of hash
151
+ # @return [Object] Returns the model itself
152
+ def self.build_from_hash(attributes)
153
+ return nil unless attributes.is_a?(Hash)
154
+ attributes = attributes.transform_keys(&:to_sym)
155
+ transformed_hash = {}
156
+ openapi_types.each_pair do |key, type|
157
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
158
+ transformed_hash["#{key}"] = nil
159
+ elsif type =~ /\AArray<(.*)>/i
160
+ # check to ensure the input is an array given that the attribute
161
+ # is documented as an array but the input is not
162
+ if attributes[attribute_map[key]].is_a?(Array)
163
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
164
+ end
165
+ elsif !attributes[attribute_map[key]].nil?
166
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
167
+ end
168
+ end
169
+ new(transformed_hash)
170
+ end
171
+
172
+ # Returns the object in the form of hash
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_hash
175
+ hash = {}
176
+ self.class.attribute_map.each_pair do |attr, param|
177
+ value = self.send(attr)
178
+ if value.nil?
179
+ is_nullable = self.class.openapi_nullable.include?(attr)
180
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
181
+ end
182
+
183
+ hash[param] = _to_hash(value)
184
+ end
185
+ hash
186
+ end
187
+
188
+ end
189
+
190
+ end