Class: Zernio::CreateMessagingAdRequest

Inherits:
ApiModelBase show all
Defined in:
lib/zernio-sdk/models/create_messaging_ad_request.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ CreateMessagingAdRequest

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 232

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::CreateMessagingAdRequest` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::CreateMessagingAdRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'account_id')
    self. = attributes[:'account_id']
  else
    self. = nil
  end

  if attributes.key?(:'ad_account_id')
    self. = attributes[:'ad_account_id']
  else
    self. = nil
  end

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  else
    self.name = nil
  end

  if attributes.key?(:'headline')
    self.headline = attributes[:'headline']
  end

  if attributes.key?(:'body')
    self.body = attributes[:'body']
  end

  if attributes.key?(:'image_url')
    self.image_url = attributes[:'image_url']
  end

  if attributes.key?(:'video')
    self.video = attributes[:'video']
  end

  if attributes.key?(:'creatives')
    if (value = attributes[:'creatives']).is_a?(Array)
      self.creatives = value
    end
  end

  if attributes.key?(:'ad_set_id')
    self.ad_set_id = attributes[:'ad_set_id']
  end

  if attributes.key?(:'budget_amount')
    self.budget_amount = attributes[:'budget_amount']
  end

  if attributes.key?(:'budget_type')
    self.budget_type = attributes[:'budget_type']
  end

  if attributes.key?(:'currency')
    self.currency = attributes[:'currency']
  end

  if attributes.key?(:'end_date')
    self.end_date = attributes[:'end_date']
  end

  if attributes.key?(:'countries')
    if (value = attributes[:'countries']).is_a?(Array)
      self.countries = value
    end
  end

  if attributes.key?(:'cities')
    if (value = attributes[:'cities']).is_a?(Array)
      self.cities = value
    end
  end

  if attributes.key?(:'regions')
    if (value = attributes[:'regions']).is_a?(Array)
      self.regions = value
    end
  end

  if attributes.key?(:'zips')
    if (value = attributes[:'zips']).is_a?(Array)
      self.zips = value
    end
  end

  if attributes.key?(:'metros')
    if (value = attributes[:'metros']).is_a?(Array)
      self.metros = value
    end
  end

  if attributes.key?(:'custom_locations')
    if (value = attributes[:'custom_locations']).is_a?(Array)
      self.custom_locations = value
    end
  end

  if attributes.key?(:'age_min')
    self.age_min = attributes[:'age_min']
  end

  if attributes.key?(:'age_max')
    self.age_max = attributes[:'age_max']
  end

  if attributes.key?(:'interests')
    if (value = attributes[:'interests']).is_a?(Array)
      self.interests = value
    end
  end

  if attributes.key?(:'audience_id')
    self.audience_id = attributes[:'audience_id']
  end

  if attributes.key?(:'placements')
    self.placements = attributes[:'placements']
  end

  if attributes.key?(:'advantage_audience')
    self.advantage_audience = attributes[:'advantage_audience']
  end

  if attributes.key?(:'objective')
    self.objective = attributes[:'objective']
  end

  if attributes.key?(:'bid_strategy')
    self.bid_strategy = attributes[:'bid_strategy']
  end

  if attributes.key?(:'bid_amount')
    self.bid_amount = attributes[:'bid_amount']
  end

  if attributes.key?(:'roas_average_floor')
    self.roas_average_floor = attributes[:'roas_average_floor']
  end

  if attributes.key?(:'dsa_beneficiary')
    self.dsa_beneficiary = attributes[:'dsa_beneficiary']
  end

  if attributes.key?(:'dsa_payor')
    self.dsa_payor = attributes[:'dsa_payor']
  end

  if attributes.key?(:'destination')
    self.destination = attributes[:'destination']
  else
    self.destination = nil
  end
end

Instance Attribute Details

#account_idObject

Facebook or Instagram SocialAccount ID.



19
20
21
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 19

def 
  @account_id
end

#ad_account_idObject

Meta ad account ID, e.g. act_123456789.



22
23
24
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 22

def 
  @ad_account_id
end

#ad_set_idObject

Attach the creatives to this EXISTING messaging ad set instead of building a campaign, so the ad set keeps its learning phase. It then owns budget, targeting and schedule, so budgetAmount, budgetType, endDate, objective, countries, interests and audienceId are rejected with a 400 alongside it. Its destination_type must match the ad's destination.



42
43
44
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 42

def ad_set_id
  @ad_set_id
end

#advantage_audienceObject

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).



86
87
88
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 86

def advantage_audience
  @advantage_audience
end

#age_maxObject

Returns the value of attribute age_max.



76
77
78
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 76

def age_max
  @age_max
end

#age_minObject

Returns the value of attribute age_min.



74
75
76
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 74

def age_min
  @age_min
end

#audience_idObject

Custom audience ID to target.



81
82
83
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 81

def audience_id
  @audience_id
end

#bid_amountObject

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.



95
96
97
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 95

def bid_amount
  @bid_amount
end

#bid_strategyObject

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.



92
93
94
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 92

def bid_strategy
  @bid_strategy
end

#bodyObject

Primary text shown above the image / video. Single-creative shape only. Mutually exclusive with creatives[].



31
32
33
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 31

def body
  @body
end

#budget_amountObject

Budget amount in the ad account's currency major units (e.g. dollars for USD, not cents). Must be > 0. Required unless adSetId is set, where the ad set owns it.



45
46
47
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 45

def budget_amount
  @budget_amount
end

#budget_typeObject

Required unless adSetId is set.



48
49
50
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 48

def budget_type
  @budget_type
end

#citiesObject

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).



60
61
62
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 60

def cities
  @cities
end

#countriesObject

ISO 3166-1 alpha-2 country codes. Defaults to [\"US\"] only when no other geo (cities, regions, zips, metros, customLocations) is supplied.



57
58
59
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 57

def countries
  @countries
end

#creativesObject

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
40
41
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 39

def creatives
  @creatives
end

#currencyObject

ISO 4217 currency code matching the ad account's currency (e.g. USD). Optional; Meta infers from the ad account when omitted.



51
52
53
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 51

def currency
  @currency
end

#custom_locationsObject

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.



72
73
74
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 72

def custom_locations
  @custom_locations
end

#destinationObject

Where the conversation opens when the ad is tapped.



107
108
109
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 107

def destination
  @destination
end

#dsa_beneficiaryObject

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.



101
102
103
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 101

def dsa_beneficiary
  @dsa_beneficiary
end

#dsa_payorObject

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.



104
105
106
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 104

def dsa_payor
  @dsa_payor
end

#end_dateObject

ISO 8601 datetime. Required when budgetType is lifetime.



54
55
56
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 54

def end_date
  @end_date
end

#headlineObject

Single-creative shape only. Mutually exclusive with creatives[].



28
29
30
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 28

def headline
  @headline
end

#image_urlObject

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
35
36
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 34

def image_url
  @image_url
end

#interestsObject

Returns the value of attribute interests.



78
79
80
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 78

def interests
  @interests
end

#metrosObject

DMA / metro-area geo targeting. key is Meta's metro id (e.g. DMA:807).



69
70
71
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 69

def metros
  @metros
end

#nameObject

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
26
27
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 25

def name
  @name
end

#objectiveObject

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.



89
90
91
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 89

def objective
  @objective
end

#placementsObject

Returns the value of attribute placements.



83
84
85
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 83

def placements
  @placements
end

#regionsObject

Region / state-level geo targeting. key is Meta's region ID (lookupable via GET /v1/ads/targeting/search?type=region).



63
64
65
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 63

def regions
  @regions
end

#roas_average_floorObject

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.



98
99
100
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 98

def roas_average_floor
  @roas_average_floor
end

#videoObject

Returns the value of attribute video.



36
37
38
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 36

def video
  @video
end

#zipsObject

ZIP / postal-code geo targeting. key is the platform's postal id resolved via /v1/ads/targeting/search.



66
67
68
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 66

def zips
  @zips
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



170
171
172
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 170

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



175
176
177
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 175

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 132

def self.attribute_map
  {
    :'account_id' => :'accountId',
    :'ad_account_id' => :'adAccountId',
    :'name' => :'name',
    :'headline' => :'headline',
    :'body' => :'body',
    :'image_url' => :'imageUrl',
    :'video' => :'video',
    :'creatives' => :'creatives',
    :'ad_set_id' => :'adSetId',
    :'budget_amount' => :'budgetAmount',
    :'budget_type' => :'budgetType',
    :'currency' => :'currency',
    :'end_date' => :'endDate',
    :'countries' => :'countries',
    :'cities' => :'cities',
    :'regions' => :'regions',
    :'zips' => :'zips',
    :'metros' => :'metros',
    :'custom_locations' => :'customLocations',
    :'age_min' => :'ageMin',
    :'age_max' => :'ageMax',
    :'interests' => :'interests',
    :'audience_id' => :'audienceId',
    :'placements' => :'placements',
    :'advantage_audience' => :'advantageAudience',
    :'objective' => :'objective',
    :'bid_strategy' => :'bidStrategy',
    :'bid_amount' => :'bidAmount',
    :'roas_average_floor' => :'roasAverageFloor',
    :'dsa_beneficiary' => :'dsaBeneficiary',
    :'dsa_payor' => :'dsaPayor',
    :'destination' => :'destination'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 793

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_all_ofObject

List of class defined in allOf (OpenAPI v3)



224
225
226
227
228
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 224

def self.openapi_all_of
  [
  :'CtwaAdRequestBody'
  ]
end

.openapi_nullableObject

List of attributes with nullable: true



218
219
220
221
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 218

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 180

def self.openapi_types
  {
    :'account_id' => :'String',
    :'ad_account_id' => :'String',
    :'name' => :'String',
    :'headline' => :'String',
    :'body' => :'String',
    :'image_url' => :'String',
    :'video' => :'CtwaAdRequestBodyVideo',
    :'creatives' => :'Array<CtwaAdRequestBodyCreativesInner>',
    :'ad_set_id' => :'String',
    :'budget_amount' => :'Float',
    :'budget_type' => :'String',
    :'currency' => :'String',
    :'end_date' => :'Time',
    :'countries' => :'Array<String>',
    :'cities' => :'Array<CtwaAdRequestBodyCitiesInner>',
    :'regions' => :'Array<CtwaAdRequestBodyRegionsInner>',
    :'zips' => :'Array<CtwaAdRequestBodyZipsInner>',
    :'metros' => :'Array<CtwaAdRequestBodyZipsInner>',
    :'custom_locations' => :'Array<CreateStandaloneAdRequestCustomLocationsInner>',
    :'age_min' => :'Integer',
    :'age_max' => :'Integer',
    :'interests' => :'Array<CreateStandaloneAdRequestBehaviorsInner>',
    :'audience_id' => :'String',
    :'placements' => :'CtwaAdRequestBodyPlacements',
    :'advantage_audience' => :'Integer',
    :'objective' => :'String',
    :'bid_strategy' => :'String',
    :'bid_amount' => :'Float',
    :'roas_average_floor' => :'Float',
    :'dsa_beneficiary' => :'String',
    :'dsa_payor' => :'String',
    :'destination' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 741

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
       == o. &&
       == o. &&
      name == o.name &&
      headline == o.headline &&
      body == o.body &&
      image_url == o.image_url &&
      video == o.video &&
      creatives == o.creatives &&
      ad_set_id == o.ad_set_id &&
      budget_amount == o.budget_amount &&
      budget_type == o.budget_type &&
      currency == o.currency &&
      end_date == o.end_date &&
      countries == o.countries &&
      cities == o.cities &&
      regions == o.regions &&
      zips == o.zips &&
      metros == o.metros &&
      custom_locations == o.custom_locations &&
      age_min == o.age_min &&
      age_max == o.age_max &&
      interests == o.interests &&
      audience_id == o.audience_id &&
      placements == o.placements &&
      advantage_audience == o.advantage_audience &&
      objective == o.objective &&
      bid_strategy == o.bid_strategy &&
      bid_amount == o.bid_amount &&
      roas_average_floor == o.roas_average_floor &&
      dsa_beneficiary == o.dsa_beneficiary &&
      dsa_payor == o.dsa_payor &&
      destination == o.destination
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


780
781
782
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 780

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



786
787
788
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 786

def hash
  [, , name, headline, body, image_url, video, creatives, ad_set_id, 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, destination].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 401

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @account_id.nil?
    invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
  end

  if @account_id.to_s.length < 1
    invalid_properties.push('invalid value for "account_id", the character length must be greater than or equal to 1.')
  end

  if @ad_account_id.nil?
    invalid_properties.push('invalid value for "ad_account_id", ad_account_id cannot be nil.')
  end

  if @ad_account_id.to_s.length < 1
    invalid_properties.push('invalid value for "ad_account_id", the character length must be greater than or equal to 1.')
  end

  if @name.nil?
    invalid_properties.push('invalid value for "name", name cannot be nil.')
  end

  if @name.to_s.length < 1
    invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.')
  end

  if !@headline.nil? && @headline.to_s.length > 255
    invalid_properties.push('invalid value for "headline", the character length must be smaller than or equal to 255.')
  end

  if !@headline.nil? && @headline.to_s.length < 1
    invalid_properties.push('invalid value for "headline", the character length must be greater than or equal to 1.')
  end

  if !@body.nil? && @body.to_s.length < 1
    invalid_properties.push('invalid value for "body", the character length must be greater than or equal to 1.')
  end

  if !@creatives.nil? && @creatives.length < 1
    invalid_properties.push('invalid value for "creatives", number of items must be greater than or equal to 1.')
  end

  if !@currency.nil? && @currency.to_s.length > 3
    invalid_properties.push('invalid value for "currency", the character length must be smaller than or equal to 3.')
  end

  if !@currency.nil? && @currency.to_s.length < 3
    invalid_properties.push('invalid value for "currency", the character length must be greater than or equal to 3.')
  end

  if !@age_min.nil? && @age_min > 65
    invalid_properties.push('invalid value for "age_min", must be smaller than or equal to 65.')
  end

  if !@age_min.nil? && @age_min < 13
    invalid_properties.push('invalid value for "age_min", must be greater than or equal to 13.')
  end

  if !@age_max.nil? && @age_max > 65
    invalid_properties.push('invalid value for "age_max", must be smaller than or equal to 65.')
  end

  if !@age_max.nil? && @age_max < 13
    invalid_properties.push('invalid value for "age_max", must be greater than or equal to 13.')
  end

  if !@dsa_beneficiary.nil? && @dsa_beneficiary.to_s.length > 100
    invalid_properties.push('invalid value for "dsa_beneficiary", the character length must be smaller than or equal to 100.')
  end

  if !@dsa_payor.nil? && @dsa_payor.to_s.length > 100
    invalid_properties.push('invalid value for "dsa_payor", the character length must be smaller than or equal to 100.')
  end

  if @destination.nil?
    invalid_properties.push('invalid value for "destination", destination cannot be nil.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



815
816
817
818
819
820
821
822
823
824
825
826
827
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 815

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
# File 'lib/zernio-sdk/models/create_messaging_ad_request.rb', line 485

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @account_id.nil?
  return false if @account_id.to_s.length < 1
  return false if @ad_account_id.nil?
  return false if @ad_account_id.to_s.length < 1
  return false if @name.nil?
  return false if @name.to_s.length < 1
  return false if !@headline.nil? && @headline.to_s.length > 255
  return false if !@headline.nil? && @headline.to_s.length < 1
  return false if !@body.nil? && @body.to_s.length < 1
  return false if !@creatives.nil? && @creatives.length < 1
  budget_type_validator = EnumAttributeValidator.new('String', ["daily", "lifetime"])
  return false unless budget_type_validator.valid?(@budget_type)
  return false if !@currency.nil? && @currency.to_s.length > 3
  return false if !@currency.nil? && @currency.to_s.length < 3
  return false if !@age_min.nil? && @age_min > 65
  return false if !@age_min.nil? && @age_min < 13
  return false if !@age_max.nil? && @age_max > 65
  return false if !@age_max.nil? && @age_max < 13
  advantage_audience_validator = EnumAttributeValidator.new('Integer', [0, 1])
  return false unless advantage_audience_validator.valid?(@advantage_audience)
  objective_validator = EnumAttributeValidator.new('String', ["OUTCOME_ENGAGEMENT", "OUTCOME_SALES", "OUTCOME_LEADS"])
  return false unless objective_validator.valid?(@objective)
  bid_strategy_validator = EnumAttributeValidator.new('String', ["LOWEST_COST_WITHOUT_CAP", "LOWEST_COST_WITH_BID_CAP", "COST_CAP", "LOWEST_COST_WITH_MIN_ROAS"])
  return false unless bid_strategy_validator.valid?(@bid_strategy)
  return false if !@dsa_beneficiary.nil? && @dsa_beneficiary.to_s.length > 100
  return false if !@dsa_payor.nil? && @dsa_payor.to_s.length > 100
  return false if @destination.nil?
  destination_validator = EnumAttributeValidator.new('String', ["whatsapp", "messenger", "instagram_direct"])
  return false unless destination_validator.valid?(@destination)
  true
end