Class: Late::CreateStandaloneAdRequest

Inherits:
ApiModelBase show all
Defined in:
lib/late-sdk/models/create_standalone_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 = {}) ⇒ CreateStandaloneAdRequest

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
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
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 183

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Late::CreateStandaloneAdRequest` 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 `Late::CreateStandaloneAdRequest`. 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?(:'goal')
    self.goal = attributes[:'goal']
  else
    self.goal = nil
  end

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

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

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

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

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

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

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

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

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

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

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

  if attributes.key?(:'countries')
    if (value = attributes[:'countries']).is_a?(Array)
      self.countries = 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?(:'end_date')
    self.end_date = attributes[:'end_date']
  end

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

  if attributes.key?(:'campaign_type')
    self.campaign_type = attributes[:'campaign_type']
  else
    self.campaign_type = 'display'
  end

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

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

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

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



18
19
20
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 18

def 
  @account_id
end

#ad_account_idObject

Returns the value of attribute ad_account_id.



20
21
22
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 20

def 
  @ad_account_id
end

#additional_descriptionsObject

Google Search RSA only. Extra descriptions.



79
80
81
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 79

def additional_descriptions
  @additional_descriptions
end

#additional_headlinesObject

Google Search RSA only. Extra headlines.



76
77
78
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 76

def additional_headlines
  @additional_headlines
end

#age_maxObject

Returns the value of attribute age_max.



59
60
61
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 59

def age_max
  @age_max
end

#age_minObject

Returns the value of attribute age_min.



57
58
59
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 57

def age_min
  @age_min
end

#audience_idObject

Custom audience ID for targeting



67
68
69
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 67

def audience_id
  @audience_id
end

#board_idObject

Pinterest only. Board ID (auto-creates if not provided).



53
54
55
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 53

def board_id
  @board_id
end

#bodyObject

Max: Google=90, Pinterest=500



39
40
41
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 39

def body
  @body
end

#budget_amountObject

Returns the value of attribute budget_amount.



26
27
28
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 26

def budget_amount
  @budget_amount
end

#budget_typeObject

Returns the value of attribute budget_type.



28
29
30
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 28

def budget_type
  @budget_type
end

#business_nameObject

Google Display only



50
51
52
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 50

def business_name
  @business_name
end

#call_to_actionObject

Meta only



42
43
44
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 42

def call_to_action
  @call_to_action
end

#campaign_typeObject

Google only



70
71
72
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 70

def campaign_type
  @campaign_type
end

#countriesObject

Returns the value of attribute countries.



55
56
57
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 55

def countries
  @countries
end

#currencyObject

Returns the value of attribute currency.



30
31
32
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 30

def currency
  @currency
end

#end_dateObject

Required for lifetime budgets



64
65
66
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 64

def end_date
  @end_date
end

#goalObject

Returns the value of attribute goal.



24
25
26
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 24

def goal
  @goal
end

#headlineObject

Required for most platforms. Max: Meta=255, Google=30, Pinterest=100



33
34
35
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 33

def headline
  @headline
end

#image_urlObject

Image URL (or video URL for TikTok). Not required for Google Search campaigns.



47
48
49
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 47

def image_url
  @image_url
end

#interestsObject

Returns the value of attribute interests.



61
62
63
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 61

def interests
  @interests
end

#keywordsObject

Google Search only



73
74
75
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 73

def keywords
  @keywords
end

Returns the value of attribute link_url.



44
45
46
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 44

def link_url
  @link_url
end

#long_headlineObject

Google Display only



36
37
38
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 36

def long_headline
  @long_headline
end

#nameObject

Returns the value of attribute name.



22
23
24
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 22

def name
  @name
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



135
136
137
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 135

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



140
141
142
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 140

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 104

def self.attribute_map
  {
    :'account_id' => :'accountId',
    :'ad_account_id' => :'adAccountId',
    :'name' => :'name',
    :'goal' => :'goal',
    :'budget_amount' => :'budgetAmount',
    :'budget_type' => :'budgetType',
    :'currency' => :'currency',
    :'headline' => :'headline',
    :'long_headline' => :'longHeadline',
    :'body' => :'body',
    :'call_to_action' => :'callToAction',
    :'link_url' => :'linkUrl',
    :'image_url' => :'imageUrl',
    :'business_name' => :'businessName',
    :'board_id' => :'boardId',
    :'countries' => :'countries',
    :'age_min' => :'ageMin',
    :'age_max' => :'ageMax',
    :'interests' => :'interests',
    :'end_date' => :'endDate',
    :'audience_id' => :'audienceId',
    :'campaign_type' => :'campaignType',
    :'keywords' => :'keywords',
    :'additional_headlines' => :'additionalHeadlines',
    :'additional_descriptions' => :'additionalDescriptions'
  }
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



622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 622

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_nullableObject

List of attributes with nullable: true



176
177
178
179
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 176

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

.openapi_typesObject

Attribute type mapping.



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 145

def self.openapi_types
  {
    :'account_id' => :'String',
    :'ad_account_id' => :'String',
    :'name' => :'String',
    :'goal' => :'String',
    :'budget_amount' => :'Float',
    :'budget_type' => :'String',
    :'currency' => :'String',
    :'headline' => :'String',
    :'long_headline' => :'String',
    :'body' => :'String',
    :'call_to_action' => :'String',
    :'link_url' => :'String',
    :'image_url' => :'String',
    :'business_name' => :'String',
    :'board_id' => :'String',
    :'countries' => :'Array<String>',
    :'age_min' => :'Integer',
    :'age_max' => :'Integer',
    :'interests' => :'Array<String>',
    :'end_date' => :'Time',
    :'audience_id' => :'String',
    :'campaign_type' => :'String',
    :'keywords' => :'Array<String>',
    :'additional_headlines' => :'Array<String>',
    :'additional_descriptions' => :'Array<String>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 577

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
       == o. &&
       == o. &&
      name == o.name &&
      goal == o.goal &&
      budget_amount == o.budget_amount &&
      budget_type == o.budget_type &&
      currency == o.currency &&
      headline == o.headline &&
      long_headline == o.long_headline &&
      body == o.body &&
      call_to_action == o.call_to_action &&
      link_url == o.link_url &&
      image_url == o.image_url &&
      business_name == o.business_name &&
      board_id == o.board_id &&
      countries == o.countries &&
      age_min == o.age_min &&
      age_max == o.age_max &&
      interests == o.interests &&
      end_date == o.end_date &&
      audience_id == o.audience_id &&
      campaign_type == o.campaign_type &&
      keywords == o.keywords &&
      additional_headlines == o.additional_headlines &&
      additional_descriptions == o.additional_descriptions
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


609
610
611
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 609

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



615
616
617
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 615

def hash
  [, , name, goal, budget_amount, budget_type, currency, headline, long_headline, body, call_to_action, link_url, image_url, business_name, board_id, countries, age_min, age_max, interests, end_date, audience_id, campaign_type, keywords, additional_headlines, additional_descriptions].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 326

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 @ad_account_id.nil?
    invalid_properties.push('invalid value for "ad_account_id", ad_account_id cannot be nil.')
  end

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

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

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

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

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

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

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

  if !@business_name.nil? && @business_name.to_s.length > 25
    invalid_properties.push('invalid value for "business_name", the character length must be smaller than or equal to 25.')
  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

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



644
645
646
647
648
649
650
651
652
653
654
655
656
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 644

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



390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 390

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @account_id.nil?
  return false if @ad_account_id.nil?
  return false if @name.nil?
  return false if @name.to_s.length > 255
  return false if @goal.nil?
  goal_validator = EnumAttributeValidator.new('String', ["engagement", "traffic", "awareness", "video_views"])
  return false unless goal_validator.valid?(@goal)
  return false if @budget_amount.nil?
  return false if @budget_type.nil?
  budget_type_validator = EnumAttributeValidator.new('String', ["daily", "lifetime"])
  return false unless budget_type_validator.valid?(@budget_type)
  return false if !@long_headline.nil? && @long_headline.to_s.length > 90
  return false if @body.nil?
  call_to_action_validator = EnumAttributeValidator.new('String', ["LEARN_MORE", "SHOP_NOW", "SIGN_UP", "BOOK_TRAVEL", "CONTACT_US", "DOWNLOAD", "GET_OFFER", "GET_QUOTE", "SUBSCRIBE", "WATCH_MORE"])
  return false unless call_to_action_validator.valid?(@call_to_action)
  return false if !@business_name.nil? && @business_name.to_s.length > 25
  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
  campaign_type_validator = EnumAttributeValidator.new('String', ["display", "search"])
  return false unless campaign_type_validator.valid?(@campaign_type)
  true
end