late-sdk 0.0.528 → 0.0.530

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 (62) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +20 -9
  3. data/docs/AdsApi.md +301 -11
  4. data/docs/CreateAdInsightsReportRequest.md +8 -0
  5. data/docs/CreateCallAdRequest.md +80 -0
  6. data/docs/CreateMessagingAdRequest.md +78 -0
  7. data/docs/CreateStandaloneAdRequest.md +2 -0
  8. data/docs/CreateStandaloneAdRequestCarouselCardsInner.md +26 -0
  9. data/docs/{CreateCtwaAdRequest.md → CtwaAdRequestBody.md} +10 -10
  10. data/docs/{CreateCtwaAdRequestCitiesInner.md → CtwaAdRequestBodyCitiesInner.md} +2 -2
  11. data/docs/{CreateCtwaAdRequestCreativesInner.md → CtwaAdRequestBodyCreativesInner.md} +3 -3
  12. data/docs/{CreateCtwaAdRequestCreativesInnerVideo.md → CtwaAdRequestBodyCreativesInnerVideo.md} +2 -2
  13. data/docs/{CreateCtwaAdRequestPlacements.md → CtwaAdRequestBodyPlacements.md} +2 -2
  14. data/docs/{CreateCtwaAdRequestRegionsInner.md → CtwaAdRequestBodyRegionsInner.md} +2 -2
  15. data/docs/{CreateCtwaAdRequestVideo.md → CtwaAdRequestBodyVideo.md} +2 -2
  16. data/docs/{CreateCtwaAdRequestZipsInner.md → CtwaAdRequestBodyZipsInner.md} +2 -2
  17. data/docs/GenerateAdPreviews200Response.md +18 -0
  18. data/docs/GenerateAdPreviews200ResponsePreviewsInner.md +20 -0
  19. data/docs/GenerateAdPreviewsRequest.md +26 -0
  20. data/docs/GetAdPreviews200Response.md +20 -0
  21. data/lib/zernio-sdk/api/ads_api.rb +295 -13
  22. data/lib/zernio-sdk/models/create_ad_insights_report_request.rb +43 -1
  23. data/lib/zernio-sdk/models/create_call_ad_request.rb +869 -0
  24. data/lib/zernio-sdk/models/create_messaging_ad_request.rb +844 -0
  25. data/lib/zernio-sdk/models/create_standalone_ad_request.rb +41 -1
  26. data/lib/zernio-sdk/models/create_standalone_ad_request_carousel_cards_inner.rb +243 -0
  27. data/lib/zernio-sdk/models/{create_ctwa_ad_request.rb → ctwa_ad_request_body.rb} +12 -12
  28. data/lib/zernio-sdk/models/{create_ctwa_ad_request_cities_inner.rb → ctwa_ad_request_body_cities_inner.rb} +3 -3
  29. data/lib/zernio-sdk/models/{create_ctwa_ad_request_creatives_inner.rb → ctwa_ad_request_body_creatives_inner.rb} +4 -4
  30. data/lib/zernio-sdk/models/{create_ctwa_ad_request_creatives_inner_video.rb → ctwa_ad_request_body_creatives_inner_video.rb} +3 -3
  31. data/lib/zernio-sdk/models/{create_ctwa_ad_request_placements.rb → ctwa_ad_request_body_placements.rb} +3 -3
  32. data/lib/zernio-sdk/models/{create_ctwa_ad_request_regions_inner.rb → ctwa_ad_request_body_regions_inner.rb} +3 -3
  33. data/lib/zernio-sdk/models/{create_ctwa_ad_request_video.rb → ctwa_ad_request_body_video.rb} +3 -3
  34. data/lib/zernio-sdk/models/{create_ctwa_ad_request_zips_inner.rb → ctwa_ad_request_body_zips_inner.rb} +3 -3
  35. data/lib/zernio-sdk/models/generate_ad_previews200_response.rb +149 -0
  36. data/lib/zernio-sdk/models/generate_ad_previews200_response_previews_inner.rb +158 -0
  37. data/lib/zernio-sdk/models/generate_ad_previews_request.rb +254 -0
  38. data/lib/zernio-sdk/models/get_ad_previews200_response.rb +158 -0
  39. data/lib/zernio-sdk/version.rb +1 -1
  40. data/lib/zernio-sdk.rb +15 -8
  41. data/openapi.yaml +516 -320
  42. data/spec/api/ads_api_spec.rb +56 -3
  43. data/spec/models/create_ad_insights_report_request_spec.rb +24 -0
  44. data/spec/models/create_call_ad_request_spec.rb +238 -0
  45. data/spec/models/create_messaging_ad_request_spec.rb +236 -0
  46. data/spec/models/create_standalone_ad_request_carousel_cards_inner_spec.rb +60 -0
  47. data/spec/models/create_standalone_ad_request_spec.rb +6 -0
  48. data/spec/models/{create_ctwa_ad_request_cities_inner_spec.rb → ctwa_ad_request_body_cities_inner_spec.rb} +6 -6
  49. data/spec/models/{create_ctwa_ad_request_creatives_inner_spec.rb → ctwa_ad_request_body_creatives_inner_spec.rb} +6 -6
  50. data/spec/models/{create_ctwa_ad_request_creatives_inner_video_spec.rb → ctwa_ad_request_body_creatives_inner_video_spec.rb} +6 -6
  51. data/spec/models/{create_ctwa_ad_request_placements_spec.rb → ctwa_ad_request_body_placements_spec.rb} +6 -6
  52. data/spec/models/{create_ctwa_ad_request_regions_inner_spec.rb → ctwa_ad_request_body_regions_inner_spec.rb} +6 -6
  53. data/spec/models/{create_ctwa_ad_request_spec.rb → ctwa_ad_request_body_spec.rb} +6 -6
  54. data/spec/models/{create_ctwa_ad_request_video_spec.rb → ctwa_ad_request_body_video_spec.rb} +6 -6
  55. data/spec/models/{create_ctwa_ad_request_zips_inner_spec.rb → ctwa_ad_request_body_zips_inner_spec.rb} +6 -6
  56. data/spec/models/generate_ad_previews200_response_previews_inner_spec.rb +42 -0
  57. data/spec/models/generate_ad_previews200_response_spec.rb +36 -0
  58. data/spec/models/generate_ad_previews_request_spec.rb +60 -0
  59. data/spec/models/get_ad_previews200_response_spec.rb +42 -0
  60. data/zernio-sdk-0.0.530.gem +0 -0
  61. metadata +62 -34
  62. data/zernio-sdk-0.0.528.gem +0 -0
@@ -0,0 +1,869 @@
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.4
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 Zernio
17
+ class CreateCallAdRequest < ApiModelBase
18
+ # Facebook or Instagram SocialAccount ID.
19
+ attr_accessor :account_id
20
+
21
+ # Meta ad account ID, e.g. `act_123456789`.
22
+ attr_accessor :ad_account_id
23
+
24
+ # Ad display name. Used to derive campaign / ad set names. On the multi-creative shape, each ad's Meta name gets a \" #N\" suffix (1-indexed) so Ads Manager shows them as a numbered batch.
25
+ attr_accessor :name
26
+
27
+ # Single-creative shape only. Mutually exclusive with `creatives[]`.
28
+ attr_accessor :headline
29
+
30
+ # Primary text shown above the image / video. Single-creative shape only. Mutually exclusive with `creatives[]`.
31
+ attr_accessor :body
32
+
33
+ # Image asset for single-creative shape. Mutually exclusive with `video` and with `creatives[]`. Required on the single-creative shape if `video` is not supplied.
34
+ attr_accessor :image_url
35
+
36
+ attr_accessor :video
37
+
38
+ # Multi-creative shape: N CTWA ads under one campaign + one ad set, sharing budget and targeting. Mutually exclusive with the top-level single-creative fields (`headline` / `body` / `imageUrl` / `video`). Each entry must supply its own headline, body, and exactly one of `imageUrl` / `video`.
39
+ attr_accessor :creatives
40
+
41
+ # Budget amount in the ad account's currency major units (e.g. dollars for USD, not cents). Must be > 0.
42
+ attr_accessor :budget_amount
43
+
44
+ attr_accessor :budget_type
45
+
46
+ # ISO 4217 currency code matching the ad account's currency (e.g. `USD`). Optional; Meta infers from the ad account when omitted.
47
+ attr_accessor :currency
48
+
49
+ # ISO 8601 datetime. Required when `budgetType` is `lifetime`.
50
+ attr_accessor :end_date
51
+
52
+ # ISO 3166-1 alpha-2 country codes. Defaults to `[\"US\"]` only when no other geo (`cities`, `regions`, `zips`, `metros`, `customLocations`) is supplied.
53
+ attr_accessor :countries
54
+
55
+ # City-level geo targeting for local CTWA campaigns. Each entry maps to Meta's TargetingGeoLocationCity. `key` is Meta's city ID. `radius` and `distance_unit` are coupled: set both or neither. Meta enforces a minimum city radius (~17 km / 10 mi); smaller values resolve to a 0-size audience and the ad fails at launch. For a tighter catchment use customLocations (lat/lng).
56
+ attr_accessor :cities
57
+
58
+ # Region / state-level geo targeting. `key` is Meta's region ID (lookupable via GET /v1/ads/targeting/search?type=region).
59
+ attr_accessor :regions
60
+
61
+ # ZIP / postal-code geo targeting. `key` is the platform's postal id resolved via /v1/ads/targeting/search.
62
+ attr_accessor :zips
63
+
64
+ # DMA / metro-area geo targeting. `key` is Meta's metro id (e.g. `DMA:807`).
65
+ attr_accessor :metros
66
+
67
+ # Point-radius geo (Meta `geo_locations.custom_locations`). Use for targeting a radius around a specific lat/long when no Meta city/region key fits. `distanceUnit` is required.
68
+ attr_accessor :custom_locations
69
+
70
+ attr_accessor :age_min
71
+
72
+ attr_accessor :age_max
73
+
74
+ attr_accessor :interests
75
+
76
+ # Custom audience ID to target.
77
+ attr_accessor :audience_id
78
+
79
+ attr_accessor :placements
80
+
81
+ # Meta's Advantage+ audience expansion. `0` (default) keeps targeting strict; `1` lets Meta expand beyond the supplied targeting when its delivery system finds better matches. Always sent on CREATE (Meta requires it).
82
+ attr_accessor :advantage_audience
83
+
84
+ # Defaults to `OUTCOME_ENGAGEMENT`. `OUTCOME_SALES` and `OUTCOME_LEADS` require additional account configuration (Dataset linked to the WABA for sales) and may be rejected by Meta if missing.
85
+ attr_accessor :objective
86
+
87
+ # Meta bid strategy applied to the shared ad set. Defaults to `LOWEST_COST_WITHOUT_CAP` (auto-bid) when omitted. `LOWEST_COST_WITH_BID_CAP` and `COST_CAP` require `bidAmount`. `LOWEST_COST_WITH_MIN_ROAS` requires `roasAverageFloor`. CTWA's `optimization_goal` is fixed to `CONVERSATIONS`, but the bid strategy is independent.
88
+ attr_accessor :bid_strategy
89
+
90
+ # Whole currency units (e.g. `5` = $5.00 on a USD account). Required when `bidStrategy` is `LOWEST_COST_WITH_BID_CAP` or `COST_CAP`; rejected otherwise.
91
+ attr_accessor :bid_amount
92
+
93
+ # Decimal ROAS multiplier (e.g. `2.0` = 2.0× ROAS floor). Required when `bidStrategy` is `LOWEST_COST_WITH_MIN_ROAS`; rejected otherwise. Meta enforces its own upper bound server-side.
94
+ attr_accessor :roas_average_floor
95
+
96
+ # Legal entity that benefits from the ad. Required when targeting EU users (EU DSA, Article 26). Optional if the ad account has a default beneficiary: set it once via `PATCH /v1/ads/accounts` or in Meta Ads Manager, and Meta fills it in whenever the field is omitted.
97
+ attr_accessor :dsa_beneficiary
98
+
99
+ # Legal entity that pays for the ad. Can differ from `dsaBeneficiary` (for example, an agency paying for a client's ads). Same rules as `dsaBeneficiary`: required for EU targeting unless the ad account has a default payor.
100
+ attr_accessor :dsa_payor
101
+
102
+ # E.164 number the CALL_NOW CTA dials (e.g. +34600111222).
103
+ attr_accessor :phone_number
104
+
105
+ # Website shown as the creative's link. Required: Meta rejects tel: as link_data.link; the phone number rides only the CTA.
106
+ attr_accessor :link_url
107
+
108
+ class EnumAttributeValidator
109
+ attr_reader :datatype
110
+ attr_reader :allowable_values
111
+
112
+ def initialize(datatype, allowable_values)
113
+ @allowable_values = allowable_values.map do |value|
114
+ case datatype.to_s
115
+ when /Integer/i
116
+ value.to_i
117
+ when /Float/i
118
+ value.to_f
119
+ else
120
+ value
121
+ end
122
+ end
123
+ end
124
+
125
+ def valid?(value)
126
+ !value || allowable_values.include?(value)
127
+ end
128
+ end
129
+
130
+ # Attribute mapping from ruby-style variable name to JSON key.
131
+ def self.attribute_map
132
+ {
133
+ :'account_id' => :'accountId',
134
+ :'ad_account_id' => :'adAccountId',
135
+ :'name' => :'name',
136
+ :'headline' => :'headline',
137
+ :'body' => :'body',
138
+ :'image_url' => :'imageUrl',
139
+ :'video' => :'video',
140
+ :'creatives' => :'creatives',
141
+ :'budget_amount' => :'budgetAmount',
142
+ :'budget_type' => :'budgetType',
143
+ :'currency' => :'currency',
144
+ :'end_date' => :'endDate',
145
+ :'countries' => :'countries',
146
+ :'cities' => :'cities',
147
+ :'regions' => :'regions',
148
+ :'zips' => :'zips',
149
+ :'metros' => :'metros',
150
+ :'custom_locations' => :'customLocations',
151
+ :'age_min' => :'ageMin',
152
+ :'age_max' => :'ageMax',
153
+ :'interests' => :'interests',
154
+ :'audience_id' => :'audienceId',
155
+ :'placements' => :'placements',
156
+ :'advantage_audience' => :'advantageAudience',
157
+ :'objective' => :'objective',
158
+ :'bid_strategy' => :'bidStrategy',
159
+ :'bid_amount' => :'bidAmount',
160
+ :'roas_average_floor' => :'roasAverageFloor',
161
+ :'dsa_beneficiary' => :'dsaBeneficiary',
162
+ :'dsa_payor' => :'dsaPayor',
163
+ :'phone_number' => :'phoneNumber',
164
+ :'link_url' => :'linkUrl'
165
+ }
166
+ end
167
+
168
+ # Returns attribute mapping this model knows about
169
+ def self.acceptable_attribute_map
170
+ attribute_map
171
+ end
172
+
173
+ # Returns all the JSON keys this model knows about
174
+ def self.acceptable_attributes
175
+ acceptable_attribute_map.values
176
+ end
177
+
178
+ # Attribute type mapping.
179
+ def self.openapi_types
180
+ {
181
+ :'account_id' => :'String',
182
+ :'ad_account_id' => :'String',
183
+ :'name' => :'String',
184
+ :'headline' => :'String',
185
+ :'body' => :'String',
186
+ :'image_url' => :'String',
187
+ :'video' => :'CtwaAdRequestBodyVideo',
188
+ :'creatives' => :'Array<CtwaAdRequestBodyCreativesInner>',
189
+ :'budget_amount' => :'Float',
190
+ :'budget_type' => :'String',
191
+ :'currency' => :'String',
192
+ :'end_date' => :'Time',
193
+ :'countries' => :'Array<String>',
194
+ :'cities' => :'Array<CtwaAdRequestBodyCitiesInner>',
195
+ :'regions' => :'Array<CtwaAdRequestBodyRegionsInner>',
196
+ :'zips' => :'Array<CtwaAdRequestBodyZipsInner>',
197
+ :'metros' => :'Array<CtwaAdRequestBodyZipsInner>',
198
+ :'custom_locations' => :'Array<CreateStandaloneAdRequestCustomLocationsInner>',
199
+ :'age_min' => :'Integer',
200
+ :'age_max' => :'Integer',
201
+ :'interests' => :'Array<CreateStandaloneAdRequestBehaviorsInner>',
202
+ :'audience_id' => :'String',
203
+ :'placements' => :'CtwaAdRequestBodyPlacements',
204
+ :'advantage_audience' => :'Integer',
205
+ :'objective' => :'String',
206
+ :'bid_strategy' => :'String',
207
+ :'bid_amount' => :'Float',
208
+ :'roas_average_floor' => :'Float',
209
+ :'dsa_beneficiary' => :'String',
210
+ :'dsa_payor' => :'String',
211
+ :'phone_number' => :'String',
212
+ :'link_url' => :'String'
213
+ }
214
+ end
215
+
216
+ # List of attributes with nullable: true
217
+ def self.openapi_nullable
218
+ Set.new([
219
+ ])
220
+ end
221
+
222
+ # List of class defined in allOf (OpenAPI v3)
223
+ def self.openapi_all_of
224
+ [
225
+ :'CtwaAdRequestBody'
226
+ ]
227
+ end
228
+
229
+ # Initializes the object
230
+ # @param [Hash] attributes Model attributes in the form of hash
231
+ def initialize(attributes = {})
232
+ if (!attributes.is_a?(Hash))
233
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::CreateCallAdRequest` initialize method"
234
+ end
235
+
236
+ # check to see if the attribute exists and convert string to symbol for hash key
237
+ acceptable_attribute_map = self.class.acceptable_attribute_map
238
+ attributes = attributes.each_with_object({}) { |(k, v), h|
239
+ if (!acceptable_attribute_map.key?(k.to_sym))
240
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::CreateCallAdRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
241
+ end
242
+ h[k.to_sym] = v
243
+ }
244
+
245
+ if attributes.key?(:'account_id')
246
+ self.account_id = attributes[:'account_id']
247
+ else
248
+ self.account_id = nil
249
+ end
250
+
251
+ if attributes.key?(:'ad_account_id')
252
+ self.ad_account_id = attributes[:'ad_account_id']
253
+ else
254
+ self.ad_account_id = nil
255
+ end
256
+
257
+ if attributes.key?(:'name')
258
+ self.name = attributes[:'name']
259
+ else
260
+ self.name = nil
261
+ end
262
+
263
+ if attributes.key?(:'headline')
264
+ self.headline = attributes[:'headline']
265
+ end
266
+
267
+ if attributes.key?(:'body')
268
+ self.body = attributes[:'body']
269
+ end
270
+
271
+ if attributes.key?(:'image_url')
272
+ self.image_url = attributes[:'image_url']
273
+ end
274
+
275
+ if attributes.key?(:'video')
276
+ self.video = attributes[:'video']
277
+ end
278
+
279
+ if attributes.key?(:'creatives')
280
+ if (value = attributes[:'creatives']).is_a?(Array)
281
+ self.creatives = value
282
+ end
283
+ end
284
+
285
+ if attributes.key?(:'budget_amount')
286
+ self.budget_amount = attributes[:'budget_amount']
287
+ else
288
+ self.budget_amount = nil
289
+ end
290
+
291
+ if attributes.key?(:'budget_type')
292
+ self.budget_type = attributes[:'budget_type']
293
+ else
294
+ self.budget_type = nil
295
+ end
296
+
297
+ if attributes.key?(:'currency')
298
+ self.currency = attributes[:'currency']
299
+ end
300
+
301
+ if attributes.key?(:'end_date')
302
+ self.end_date = attributes[:'end_date']
303
+ end
304
+
305
+ if attributes.key?(:'countries')
306
+ if (value = attributes[:'countries']).is_a?(Array)
307
+ self.countries = value
308
+ end
309
+ end
310
+
311
+ if attributes.key?(:'cities')
312
+ if (value = attributes[:'cities']).is_a?(Array)
313
+ self.cities = value
314
+ end
315
+ end
316
+
317
+ if attributes.key?(:'regions')
318
+ if (value = attributes[:'regions']).is_a?(Array)
319
+ self.regions = value
320
+ end
321
+ end
322
+
323
+ if attributes.key?(:'zips')
324
+ if (value = attributes[:'zips']).is_a?(Array)
325
+ self.zips = value
326
+ end
327
+ end
328
+
329
+ if attributes.key?(:'metros')
330
+ if (value = attributes[:'metros']).is_a?(Array)
331
+ self.metros = value
332
+ end
333
+ end
334
+
335
+ if attributes.key?(:'custom_locations')
336
+ if (value = attributes[:'custom_locations']).is_a?(Array)
337
+ self.custom_locations = value
338
+ end
339
+ end
340
+
341
+ if attributes.key?(:'age_min')
342
+ self.age_min = attributes[:'age_min']
343
+ end
344
+
345
+ if attributes.key?(:'age_max')
346
+ self.age_max = attributes[:'age_max']
347
+ end
348
+
349
+ if attributes.key?(:'interests')
350
+ if (value = attributes[:'interests']).is_a?(Array)
351
+ self.interests = value
352
+ end
353
+ end
354
+
355
+ if attributes.key?(:'audience_id')
356
+ self.audience_id = attributes[:'audience_id']
357
+ end
358
+
359
+ if attributes.key?(:'placements')
360
+ self.placements = attributes[:'placements']
361
+ end
362
+
363
+ if attributes.key?(:'advantage_audience')
364
+ self.advantage_audience = attributes[:'advantage_audience']
365
+ end
366
+
367
+ if attributes.key?(:'objective')
368
+ self.objective = attributes[:'objective']
369
+ end
370
+
371
+ if attributes.key?(:'bid_strategy')
372
+ self.bid_strategy = attributes[:'bid_strategy']
373
+ end
374
+
375
+ if attributes.key?(:'bid_amount')
376
+ self.bid_amount = attributes[:'bid_amount']
377
+ end
378
+
379
+ if attributes.key?(:'roas_average_floor')
380
+ self.roas_average_floor = attributes[:'roas_average_floor']
381
+ end
382
+
383
+ if attributes.key?(:'dsa_beneficiary')
384
+ self.dsa_beneficiary = attributes[:'dsa_beneficiary']
385
+ end
386
+
387
+ if attributes.key?(:'dsa_payor')
388
+ self.dsa_payor = attributes[:'dsa_payor']
389
+ end
390
+
391
+ if attributes.key?(:'phone_number')
392
+ self.phone_number = attributes[:'phone_number']
393
+ else
394
+ self.phone_number = nil
395
+ end
396
+
397
+ if attributes.key?(:'link_url')
398
+ self.link_url = attributes[:'link_url']
399
+ else
400
+ self.link_url = nil
401
+ end
402
+ end
403
+
404
+ # Show invalid properties with the reasons. Usually used together with valid?
405
+ # @return Array for valid properties with the reasons
406
+ def list_invalid_properties
407
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
408
+ invalid_properties = Array.new
409
+ if @account_id.nil?
410
+ invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
411
+ end
412
+
413
+ if @account_id.to_s.length < 1
414
+ invalid_properties.push('invalid value for "account_id", the character length must be greater than or equal to 1.')
415
+ end
416
+
417
+ if @ad_account_id.nil?
418
+ invalid_properties.push('invalid value for "ad_account_id", ad_account_id cannot be nil.')
419
+ end
420
+
421
+ if @ad_account_id.to_s.length < 1
422
+ invalid_properties.push('invalid value for "ad_account_id", the character length must be greater than or equal to 1.')
423
+ end
424
+
425
+ if @name.nil?
426
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
427
+ end
428
+
429
+ if @name.to_s.length < 1
430
+ invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.')
431
+ end
432
+
433
+ if !@headline.nil? && @headline.to_s.length > 255
434
+ invalid_properties.push('invalid value for "headline", the character length must be smaller than or equal to 255.')
435
+ end
436
+
437
+ if !@headline.nil? && @headline.to_s.length < 1
438
+ invalid_properties.push('invalid value for "headline", the character length must be greater than or equal to 1.')
439
+ end
440
+
441
+ if !@body.nil? && @body.to_s.length < 1
442
+ invalid_properties.push('invalid value for "body", the character length must be greater than or equal to 1.')
443
+ end
444
+
445
+ if !@creatives.nil? && @creatives.length < 1
446
+ invalid_properties.push('invalid value for "creatives", number of items must be greater than or equal to 1.')
447
+ end
448
+
449
+ if @budget_amount.nil?
450
+ invalid_properties.push('invalid value for "budget_amount", budget_amount cannot be nil.')
451
+ end
452
+
453
+ if @budget_type.nil?
454
+ invalid_properties.push('invalid value for "budget_type", budget_type cannot be nil.')
455
+ end
456
+
457
+ if !@currency.nil? && @currency.to_s.length > 3
458
+ invalid_properties.push('invalid value for "currency", the character length must be smaller than or equal to 3.')
459
+ end
460
+
461
+ if !@currency.nil? && @currency.to_s.length < 3
462
+ invalid_properties.push('invalid value for "currency", the character length must be greater than or equal to 3.')
463
+ end
464
+
465
+ if !@age_min.nil? && @age_min > 65
466
+ invalid_properties.push('invalid value for "age_min", must be smaller than or equal to 65.')
467
+ end
468
+
469
+ if !@age_min.nil? && @age_min < 13
470
+ invalid_properties.push('invalid value for "age_min", must be greater than or equal to 13.')
471
+ end
472
+
473
+ if !@age_max.nil? && @age_max > 65
474
+ invalid_properties.push('invalid value for "age_max", must be smaller than or equal to 65.')
475
+ end
476
+
477
+ if !@age_max.nil? && @age_max < 13
478
+ invalid_properties.push('invalid value for "age_max", must be greater than or equal to 13.')
479
+ end
480
+
481
+ if !@dsa_beneficiary.nil? && @dsa_beneficiary.to_s.length > 100
482
+ invalid_properties.push('invalid value for "dsa_beneficiary", the character length must be smaller than or equal to 100.')
483
+ end
484
+
485
+ if !@dsa_payor.nil? && @dsa_payor.to_s.length > 100
486
+ invalid_properties.push('invalid value for "dsa_payor", the character length must be smaller than or equal to 100.')
487
+ end
488
+
489
+ if @phone_number.nil?
490
+ invalid_properties.push('invalid value for "phone_number", phone_number cannot be nil.')
491
+ end
492
+
493
+ if @link_url.nil?
494
+ invalid_properties.push('invalid value for "link_url", link_url cannot be nil.')
495
+ end
496
+
497
+ invalid_properties
498
+ end
499
+
500
+ # Check to see if the all the properties in the model are valid
501
+ # @return true if the model is valid
502
+ def valid?
503
+ warn '[DEPRECATED] the `valid?` method is obsolete'
504
+ return false if @account_id.nil?
505
+ return false if @account_id.to_s.length < 1
506
+ return false if @ad_account_id.nil?
507
+ return false if @ad_account_id.to_s.length < 1
508
+ return false if @name.nil?
509
+ return false if @name.to_s.length < 1
510
+ return false if !@headline.nil? && @headline.to_s.length > 255
511
+ return false if !@headline.nil? && @headline.to_s.length < 1
512
+ return false if !@body.nil? && @body.to_s.length < 1
513
+ return false if !@creatives.nil? && @creatives.length < 1
514
+ return false if @budget_amount.nil?
515
+ return false if @budget_type.nil?
516
+ budget_type_validator = EnumAttributeValidator.new('String', ["daily", "lifetime"])
517
+ return false unless budget_type_validator.valid?(@budget_type)
518
+ return false if !@currency.nil? && @currency.to_s.length > 3
519
+ return false if !@currency.nil? && @currency.to_s.length < 3
520
+ return false if !@age_min.nil? && @age_min > 65
521
+ return false if !@age_min.nil? && @age_min < 13
522
+ return false if !@age_max.nil? && @age_max > 65
523
+ return false if !@age_max.nil? && @age_max < 13
524
+ advantage_audience_validator = EnumAttributeValidator.new('Integer', [0, 1])
525
+ return false unless advantage_audience_validator.valid?(@advantage_audience)
526
+ objective_validator = EnumAttributeValidator.new('String', ["OUTCOME_ENGAGEMENT", "OUTCOME_SALES", "OUTCOME_LEADS"])
527
+ return false unless objective_validator.valid?(@objective)
528
+ bid_strategy_validator = EnumAttributeValidator.new('String', ["LOWEST_COST_WITHOUT_CAP", "LOWEST_COST_WITH_BID_CAP", "COST_CAP", "LOWEST_COST_WITH_MIN_ROAS"])
529
+ return false unless bid_strategy_validator.valid?(@bid_strategy)
530
+ return false if !@dsa_beneficiary.nil? && @dsa_beneficiary.to_s.length > 100
531
+ return false if !@dsa_payor.nil? && @dsa_payor.to_s.length > 100
532
+ return false if @phone_number.nil?
533
+ return false if @link_url.nil?
534
+ true
535
+ end
536
+
537
+ # Custom attribute writer method with validation
538
+ # @param [Object] account_id Value to be assigned
539
+ def account_id=(account_id)
540
+ if account_id.nil?
541
+ fail ArgumentError, 'account_id cannot be nil'
542
+ end
543
+
544
+ if account_id.to_s.length < 1
545
+ fail ArgumentError, 'invalid value for "account_id", the character length must be greater than or equal to 1.'
546
+ end
547
+
548
+ @account_id = account_id
549
+ end
550
+
551
+ # Custom attribute writer method with validation
552
+ # @param [Object] ad_account_id Value to be assigned
553
+ def ad_account_id=(ad_account_id)
554
+ if ad_account_id.nil?
555
+ fail ArgumentError, 'ad_account_id cannot be nil'
556
+ end
557
+
558
+ if ad_account_id.to_s.length < 1
559
+ fail ArgumentError, 'invalid value for "ad_account_id", the character length must be greater than or equal to 1.'
560
+ end
561
+
562
+ @ad_account_id = ad_account_id
563
+ end
564
+
565
+ # Custom attribute writer method with validation
566
+ # @param [Object] name Value to be assigned
567
+ def name=(name)
568
+ if name.nil?
569
+ fail ArgumentError, 'name cannot be nil'
570
+ end
571
+
572
+ if name.to_s.length < 1
573
+ fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.'
574
+ end
575
+
576
+ @name = name
577
+ end
578
+
579
+ # Custom attribute writer method with validation
580
+ # @param [Object] headline Value to be assigned
581
+ def headline=(headline)
582
+ if headline.nil?
583
+ fail ArgumentError, 'headline cannot be nil'
584
+ end
585
+
586
+ if headline.to_s.length > 255
587
+ fail ArgumentError, 'invalid value for "headline", the character length must be smaller than or equal to 255.'
588
+ end
589
+
590
+ if headline.to_s.length < 1
591
+ fail ArgumentError, 'invalid value for "headline", the character length must be greater than or equal to 1.'
592
+ end
593
+
594
+ @headline = headline
595
+ end
596
+
597
+ # Custom attribute writer method with validation
598
+ # @param [Object] body Value to be assigned
599
+ def body=(body)
600
+ if body.nil?
601
+ fail ArgumentError, 'body cannot be nil'
602
+ end
603
+
604
+ if body.to_s.length < 1
605
+ fail ArgumentError, 'invalid value for "body", the character length must be greater than or equal to 1.'
606
+ end
607
+
608
+ @body = body
609
+ end
610
+
611
+ # Custom attribute writer method with validation
612
+ # @param [Object] creatives Value to be assigned
613
+ def creatives=(creatives)
614
+ if creatives.nil?
615
+ fail ArgumentError, 'creatives cannot be nil'
616
+ end
617
+
618
+ if creatives.length < 1
619
+ fail ArgumentError, 'invalid value for "creatives", number of items must be greater than or equal to 1.'
620
+ end
621
+
622
+ @creatives = creatives
623
+ end
624
+
625
+ # Custom attribute writer method with validation
626
+ # @param [Object] budget_amount Value to be assigned
627
+ def budget_amount=(budget_amount)
628
+ if budget_amount.nil?
629
+ fail ArgumentError, 'budget_amount cannot be nil'
630
+ end
631
+
632
+ @budget_amount = budget_amount
633
+ end
634
+
635
+ # Custom attribute writer method checking allowed values (enum).
636
+ # @param [Object] budget_type Object to be assigned
637
+ def budget_type=(budget_type)
638
+ validator = EnumAttributeValidator.new('String', ["daily", "lifetime"])
639
+ unless validator.valid?(budget_type)
640
+ fail ArgumentError, "invalid value for \"budget_type\", must be one of #{validator.allowable_values}."
641
+ end
642
+ @budget_type = budget_type
643
+ end
644
+
645
+ # Custom attribute writer method with validation
646
+ # @param [Object] currency Value to be assigned
647
+ def currency=(currency)
648
+ if currency.nil?
649
+ fail ArgumentError, 'currency cannot be nil'
650
+ end
651
+
652
+ if currency.to_s.length > 3
653
+ fail ArgumentError, 'invalid value for "currency", the character length must be smaller than or equal to 3.'
654
+ end
655
+
656
+ if currency.to_s.length < 3
657
+ fail ArgumentError, 'invalid value for "currency", the character length must be greater than or equal to 3.'
658
+ end
659
+
660
+ @currency = currency
661
+ end
662
+
663
+ # Custom attribute writer method with validation
664
+ # @param [Object] age_min Value to be assigned
665
+ def age_min=(age_min)
666
+ if age_min.nil?
667
+ fail ArgumentError, 'age_min cannot be nil'
668
+ end
669
+
670
+ if age_min > 65
671
+ fail ArgumentError, 'invalid value for "age_min", must be smaller than or equal to 65.'
672
+ end
673
+
674
+ if age_min < 13
675
+ fail ArgumentError, 'invalid value for "age_min", must be greater than or equal to 13.'
676
+ end
677
+
678
+ @age_min = age_min
679
+ end
680
+
681
+ # Custom attribute writer method with validation
682
+ # @param [Object] age_max Value to be assigned
683
+ def age_max=(age_max)
684
+ if age_max.nil?
685
+ fail ArgumentError, 'age_max cannot be nil'
686
+ end
687
+
688
+ if age_max > 65
689
+ fail ArgumentError, 'invalid value for "age_max", must be smaller than or equal to 65.'
690
+ end
691
+
692
+ if age_max < 13
693
+ fail ArgumentError, 'invalid value for "age_max", must be greater than or equal to 13.'
694
+ end
695
+
696
+ @age_max = age_max
697
+ end
698
+
699
+ # Custom attribute writer method checking allowed values (enum).
700
+ # @param [Object] advantage_audience Object to be assigned
701
+ def advantage_audience=(advantage_audience)
702
+ validator = EnumAttributeValidator.new('Integer', [0, 1])
703
+ unless validator.valid?(advantage_audience)
704
+ fail ArgumentError, "invalid value for \"advantage_audience\", must be one of #{validator.allowable_values}."
705
+ end
706
+ @advantage_audience = advantage_audience
707
+ end
708
+
709
+ # Custom attribute writer method checking allowed values (enum).
710
+ # @param [Object] objective Object to be assigned
711
+ def objective=(objective)
712
+ validator = EnumAttributeValidator.new('String', ["OUTCOME_ENGAGEMENT", "OUTCOME_SALES", "OUTCOME_LEADS"])
713
+ unless validator.valid?(objective)
714
+ fail ArgumentError, "invalid value for \"objective\", must be one of #{validator.allowable_values}."
715
+ end
716
+ @objective = objective
717
+ end
718
+
719
+ # Custom attribute writer method checking allowed values (enum).
720
+ # @param [Object] bid_strategy Object to be assigned
721
+ def bid_strategy=(bid_strategy)
722
+ validator = EnumAttributeValidator.new('String', ["LOWEST_COST_WITHOUT_CAP", "LOWEST_COST_WITH_BID_CAP", "COST_CAP", "LOWEST_COST_WITH_MIN_ROAS"])
723
+ unless validator.valid?(bid_strategy)
724
+ fail ArgumentError, "invalid value for \"bid_strategy\", must be one of #{validator.allowable_values}."
725
+ end
726
+ @bid_strategy = bid_strategy
727
+ end
728
+
729
+ # Custom attribute writer method with validation
730
+ # @param [Object] dsa_beneficiary Value to be assigned
731
+ def dsa_beneficiary=(dsa_beneficiary)
732
+ if dsa_beneficiary.nil?
733
+ fail ArgumentError, 'dsa_beneficiary cannot be nil'
734
+ end
735
+
736
+ if dsa_beneficiary.to_s.length > 100
737
+ fail ArgumentError, 'invalid value for "dsa_beneficiary", the character length must be smaller than or equal to 100.'
738
+ end
739
+
740
+ @dsa_beneficiary = dsa_beneficiary
741
+ end
742
+
743
+ # Custom attribute writer method with validation
744
+ # @param [Object] dsa_payor Value to be assigned
745
+ def dsa_payor=(dsa_payor)
746
+ if dsa_payor.nil?
747
+ fail ArgumentError, 'dsa_payor cannot be nil'
748
+ end
749
+
750
+ if dsa_payor.to_s.length > 100
751
+ fail ArgumentError, 'invalid value for "dsa_payor", the character length must be smaller than or equal to 100.'
752
+ end
753
+
754
+ @dsa_payor = dsa_payor
755
+ end
756
+
757
+ # Custom attribute writer method with validation
758
+ # @param [Object] phone_number Value to be assigned
759
+ def phone_number=(phone_number)
760
+ if phone_number.nil?
761
+ fail ArgumentError, 'phone_number cannot be nil'
762
+ end
763
+
764
+ @phone_number = phone_number
765
+ end
766
+
767
+ # Custom attribute writer method with validation
768
+ # @param [Object] link_url Value to be assigned
769
+ def link_url=(link_url)
770
+ if link_url.nil?
771
+ fail ArgumentError, 'link_url cannot be nil'
772
+ end
773
+
774
+ @link_url = link_url
775
+ end
776
+
777
+ # Checks equality by comparing each attribute.
778
+ # @param [Object] Object to be compared
779
+ def ==(o)
780
+ return true if self.equal?(o)
781
+ self.class == o.class &&
782
+ account_id == o.account_id &&
783
+ ad_account_id == o.ad_account_id &&
784
+ name == o.name &&
785
+ headline == o.headline &&
786
+ body == o.body &&
787
+ image_url == o.image_url &&
788
+ video == o.video &&
789
+ creatives == o.creatives &&
790
+ budget_amount == o.budget_amount &&
791
+ budget_type == o.budget_type &&
792
+ currency == o.currency &&
793
+ end_date == o.end_date &&
794
+ countries == o.countries &&
795
+ cities == o.cities &&
796
+ regions == o.regions &&
797
+ zips == o.zips &&
798
+ metros == o.metros &&
799
+ custom_locations == o.custom_locations &&
800
+ age_min == o.age_min &&
801
+ age_max == o.age_max &&
802
+ interests == o.interests &&
803
+ audience_id == o.audience_id &&
804
+ placements == o.placements &&
805
+ advantage_audience == o.advantage_audience &&
806
+ objective == o.objective &&
807
+ bid_strategy == o.bid_strategy &&
808
+ bid_amount == o.bid_amount &&
809
+ roas_average_floor == o.roas_average_floor &&
810
+ dsa_beneficiary == o.dsa_beneficiary &&
811
+ dsa_payor == o.dsa_payor &&
812
+ phone_number == o.phone_number &&
813
+ link_url == o.link_url
814
+ end
815
+
816
+ # @see the `==` method
817
+ # @param [Object] Object to be compared
818
+ def eql?(o)
819
+ self == o
820
+ end
821
+
822
+ # Calculates hash code according to all attributes.
823
+ # @return [Integer] Hash code
824
+ def hash
825
+ [account_id, ad_account_id, name, headline, body, image_url, video, creatives, budget_amount, budget_type, currency, end_date, countries, cities, regions, zips, metros, custom_locations, age_min, age_max, interests, audience_id, placements, advantage_audience, objective, bid_strategy, bid_amount, roas_average_floor, dsa_beneficiary, dsa_payor, phone_number, link_url].hash
826
+ end
827
+
828
+ # Builds the object from hash
829
+ # @param [Hash] attributes Model attributes in the form of hash
830
+ # @return [Object] Returns the model itself
831
+ def self.build_from_hash(attributes)
832
+ return nil unless attributes.is_a?(Hash)
833
+ attributes = attributes.transform_keys(&:to_sym)
834
+ transformed_hash = {}
835
+ openapi_types.each_pair do |key, type|
836
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
837
+ transformed_hash["#{key}"] = nil
838
+ elsif type =~ /\AArray<(.*)>/i
839
+ # check to ensure the input is an array given that the attribute
840
+ # is documented as an array but the input is not
841
+ if attributes[attribute_map[key]].is_a?(Array)
842
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
843
+ end
844
+ elsif !attributes[attribute_map[key]].nil?
845
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
846
+ end
847
+ end
848
+ new(transformed_hash)
849
+ end
850
+
851
+ # Returns the object in the form of hash
852
+ # @return [Hash] Returns the object in the form of hash
853
+ def to_hash
854
+ hash = {}
855
+ self.class.attribute_map.each_pair do |attr, param|
856
+ value = self.send(attr)
857
+ if value.nil?
858
+ is_nullable = self.class.openapi_nullable.include?(attr)
859
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
860
+ end
861
+
862
+ hash[param] = _to_hash(value)
863
+ end
864
+ hash
865
+ end
866
+
867
+ end
868
+
869
+ end