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



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
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
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
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 158

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?(:'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']
  else
    self.image_url = nil
  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
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

#age_maxObject

Returns the value of attribute age_max.



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

def age_max
  @age_max
end

#age_minObject

Returns the value of attribute age_min.



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

def age_min
  @age_min
end

#audience_idObject

Custom audience ID for targeting



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

def audience_id
  @audience_id
end

#bodyObject

Max: Google=90, Pinterest=500



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

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

#call_to_actionObject

Meta only



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

def call_to_action
  @call_to_action
end

#campaign_typeObject

Google only



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

def campaign_type
  @campaign_type
end

#countriesObject

Returns the value of attribute countries.



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

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



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

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)



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

def image_url
  @image_url
end

#interestsObject

Returns the value of attribute interests.



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

def interests
  @interests
end

#keywordsObject

Google Search only



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

def keywords
  @keywords
end

Returns the value of attribute link_url.



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

def link_url
  @link_url
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



115
116
117
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 115

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



120
121
122
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 120

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 89

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',
    :'body' => :'body',
    :'call_to_action' => :'callToAction',
    :'link_url' => :'linkUrl',
    :'image_url' => :'imageUrl',
    :'countries' => :'countries',
    :'age_min' => :'ageMin',
    :'age_max' => :'ageMax',
    :'interests' => :'interests',
    :'end_date' => :'endDate',
    :'audience_id' => :'audienceId',
    :'campaign_type' => :'campaignType',
    :'keywords' => :'keywords'
  }
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



547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 547

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



151
152
153
154
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 151

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

.openapi_typesObject

Attribute type mapping.



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 125

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',
    :'body' => :'String',
    :'call_to_action' => :'String',
    :'link_url' => :'String',
    :'image_url' => :'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>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 507

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 &&
      body == o.body &&
      call_to_action == o.call_to_action &&
      link_url == o.link_url &&
      image_url == o.image_url &&
      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
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


534
535
536
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 534

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



540
541
542
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 540

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

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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

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

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



569
570
571
572
573
574
575
576
577
578
579
580
581
# File 'lib/late-sdk/models/create_standalone_ad_request.rb', line 569

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



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

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 @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 @image_url.nil?
  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