Class: Zernio::GoogleDemandGenInput

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

Overview

Creative, channel and audience settings for a Google Demand Gen campaign (campaignType demand_gen). Creates one ad group with one ad: a multi-asset image ad, a video responsive ad when youtubeVideoIds is sent, or a carousel ad when carouselCards is sent.

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 = {}) ⇒ GoogleDemandGenInput

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/zernio-sdk/models/google_demand_gen_input.rb', line 132

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#ad_group_name ⇒ Object

Defaults to the ad name.



20
21
22
# File 'lib/zernio-sdk/models/google_demand_gen_input.rb', line 20

def ad_group_name
  @ad_group_name
end

#audience ⇒ Object

Returns the value of attribute audience.



49
50
51
# File 'lib/zernio-sdk/models/google_demand_gen_input.rb', line 49

def audience
  @audience
end

#audience_id ⇒ Object

Attach an existing Google Audience by numeric id instead of audience.



52
53
54
# File 'lib/zernio-sdk/models/google_demand_gen_input.rb', line 52

def audience_id
  @audience_id
end

#business_name ⇒ Object

Returns the value of attribute business_name.



24
25
26
# File 'lib/zernio-sdk/models/google_demand_gen_input.rb', line 24

def business_name
  @business_name
end

#call_to_action ⇒ Object

Image and carousel ads only. Call to action text such as 'Learn more'; Google picks one when omitted.



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

def call_to_action
  @call_to_action
end

Makes the ad a carousel ad. Each card needs its own image (no two cards may share one); use the same image shape on every card. Card images are uploaded to the account's asset library before the campaign is created, validateOnly included (Google checks cards against existing images; identical images are reused, not duplicated).



44
45
46
# File 'lib/zernio-sdk/models/google_demand_gen_input.rb', line 44

def carousel_cards
  @carousel_cards
end

#channels ⇒ Object

Channel controls on the ad group. Only the listed channels serve; omit to serve on all of them.



47
48
49
# File 'lib/zernio-sdk/models/google_demand_gen_input.rb', line 47

def channels
  @channels
end

#descriptions ⇒ Object

A carousel ad takes exactly one.



33
34
35
# File 'lib/zernio-sdk/models/google_demand_gen_input.rb', line 33

def descriptions
  @descriptions
end

#final_url ⇒ Object

Returns the value of attribute final_url.



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

def final_url
  @final_url
end

#headlines ⇒ Object

Distinct texts. A carousel ad takes exactly one.



27
28
29
# File 'lib/zernio-sdk/models/google_demand_gen_input.rb', line 27

def headlines
  @headlines
end

#images ⇒ Object

Returns the value of attribute images.



38
39
40
# File 'lib/zernio-sdk/models/google_demand_gen_input.rb', line 38

def images
  @images
end

#long_headlines ⇒ Object

Video ads only, and required there.



30
31
32
# File 'lib/zernio-sdk/models/google_demand_gen_input.rb', line 30

def long_headlines
  @long_headlines
end

#youtube_video_ids ⇒ Object

Makes the ad a video responsive ad.



41
42
43
# File 'lib/zernio-sdk/models/google_demand_gen_input.rb', line 41

def youtube_video_ids
  @youtube_video_ids
end

Class Method Details

.acceptable_attribute_map ⇒ Object

Returns attribute mapping this model knows about



96
97
98
# File 'lib/zernio-sdk/models/google_demand_gen_input.rb', line 96

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributes ⇒ Object

Returns all the JSON keys this model knows about



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

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_map ⇒ Object

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



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/zernio-sdk/models/google_demand_gen_input.rb', line 77

def self.attribute_map
  {
    :'ad_group_name' => :'adGroupName',
    :'final_url' => :'finalUrl',
    :'business_name' => :'businessName',
    :'headlines' => :'headlines',
    :'long_headlines' => :'longHeadlines',
    :'descriptions' => :'descriptions',
    :'call_to_action' => :'callToAction',
    :'images' => :'images',
    :'youtube_video_ids' => :'youtubeVideoIds',
    :'carousel_cards' => :'carouselCards',
    :'channels' => :'channels',
    :'audience' => :'audience',
    :'audience_id' => :'audienceId'
  }
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



518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
# File 'lib/zernio-sdk/models/google_demand_gen_input.rb', line 518

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_nullable ⇒ Object

List of attributes with nullable: true



125
126
127
128
# File 'lib/zernio-sdk/models/google_demand_gen_input.rb', line 125

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

.openapi_types ⇒ Object

Attribute type mapping.



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/zernio-sdk/models/google_demand_gen_input.rb', line 106

def self.openapi_types
  {
    :'ad_group_name' => :'String',
    :'final_url' => :'String',
    :'business_name' => :'String',
    :'headlines' => :'Array<String>',
    :'long_headlines' => :'Array<String>',
    :'descriptions' => :'Array<String>',
    :'call_to_action' => :'String',
    :'images' => :'GoogleDemandGenInputImages',
    :'youtube_video_ids' => :'Array<String>',
    :'carousel_cards' => :'Array<GoogleDemandGenInputCarouselCardsInner>',
    :'channels' => :'Array<String>',
    :'audience' => :'GoogleDemandGenAudience',
    :'audience_id' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object) —

    to be compared



485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
# File 'lib/zernio-sdk/models/google_demand_gen_input.rb', line 485

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      ad_group_name == o.ad_group_name &&
      final_url == o.final_url &&
      business_name == o.business_name &&
      headlines == o.headlines &&
      long_headlines == o.long_headlines &&
      descriptions == o.descriptions &&
      call_to_action == o.call_to_action &&
      images == o.images &&
      youtube_video_ids == o.youtube_video_ids &&
      carousel_cards == o.carousel_cards &&
      channels == o.channels &&
      audience == o.audience &&
      audience_id == o.audience_id
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object) —

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


505
506
507
# File 'lib/zernio-sdk/models/google_demand_gen_input.rb', line 505

def eql?(o)
  self == o
end

#hash ⇒ Integer

Calculates hash code according to all attributes.

Returns:

  • (Integer) —

    Hash code



511
512
513
# File 'lib/zernio-sdk/models/google_demand_gen_input.rb', line 511

def hash
  [ad_group_name, final_url, business_name, headlines, long_headlines, descriptions, call_to_action, images, youtube_video_ids, carousel_cards, channels, audience, audience_id].hash
end

#list_invalid_properties ⇒ Object

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/zernio-sdk/models/google_demand_gen_input.rb', line 223

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@ad_group_name.nil? && @ad_group_name.to_s.length > 255
    invalid_properties.push('invalid value for "ad_group_name", the character length must be smaller than or equal to 255.')
  end

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

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

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

  if @headlines.length > 5
    invalid_properties.push('invalid value for "headlines", number of items must be less than or equal to 5.')
  end

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

  if !@long_headlines.nil? && @long_headlines.length > 5
    invalid_properties.push('invalid value for "long_headlines", number of items must be less than or equal to 5.')
  end

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

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

  if @descriptions.length > 5
    invalid_properties.push('invalid value for "descriptions", number of items must be less than or equal to 5.')
  end

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

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

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

  if !@youtube_video_ids.nil? && @youtube_video_ids.length > 5
    invalid_properties.push('invalid value for "youtube_video_ids", number of items must be less than or equal to 5.')
  end

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

  if !@carousel_cards.nil? && @carousel_cards.length > 10
    invalid_properties.push('invalid value for "carousel_cards", number of items must be less than or equal to 10.')
  end

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

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

  invalid_properties
end

#to_hash ⇒ Hash

Returns the object in the form of hash

Returns:

  • (Hash) —

    Returns the object in the form of hash



540
541
542
543
544
545
546
547
548
549
550
551
552
# File 'lib/zernio-sdk/models/google_demand_gen_input.rb', line 540

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



307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/zernio-sdk/models/google_demand_gen_input.rb', line 307

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@ad_group_name.nil? && @ad_group_name.to_s.length > 255
  return false if @final_url.nil?
  return false if @business_name.nil?
  return false if @business_name.to_s.length > 25
  return false if @headlines.nil?
  return false if @headlines.length > 5
  return false if @headlines.length < 1
  return false if !@long_headlines.nil? && @long_headlines.length > 5
  return false if !@long_headlines.nil? && @long_headlines.length < 1
  return false if @descriptions.nil?
  return false if @descriptions.length > 5
  return false if @descriptions.length < 1
  return false if !@call_to_action.nil? && @call_to_action.to_s.length > 25
  return false if @images.nil?
  return false if !@youtube_video_ids.nil? && @youtube_video_ids.length > 5
  return false if !@youtube_video_ids.nil? && @youtube_video_ids.length < 1
  return false if !@carousel_cards.nil? && @carousel_cards.length > 10
  return false if !@carousel_cards.nil? && @carousel_cards.length < 2
  return false if !@channels.nil? && @channels.length < 1
  true
end