Class: Zernio::LinkedInAdsPlatformData

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

Overview

LinkedIn-specific options for POST /v1/ads/boost and POST /v1/ads/create: campaign bidding and delivery controls, plus the LinkedIn-only creative formats on /v1/ads/create. Unknown keys are rejected.

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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/linked_in_ads_platform_data.rb', line 142

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#audience_expansion_enabledObject

Enable LinkedIn audience expansion. Defaults to false.



32
33
34
# File 'lib/zernio-sdk/models/linked_in_ads_platform_data.rb', line 32

def audience_expansion_enabled
  @audience_expansion_enabled
end

Returns the value of attribute carousel.



40
41
42
# File 'lib/zernio-sdk/models/linked_in_ads_platform_data.rb', line 40

def carousel
  @carousel
end

#connected_television_onlyObject

Restrict delivery to Connected TV inventory.



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

def connected_television_only
  @connected_television_only
end

#conversationObject

Returns the value of attribute conversation.



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

def conversation
  @conversation
end

#cost_typeObject

Campaign cost model (billing event). Defaults to CPM. Required when unitCost is set so the manual bid applies to an explicit cost model.



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

def cost_type
  @cost_type
end

#creative_selectionObject

How LinkedIn rotates creatives within the campaign. Defaults to OPTIMIZED.



29
30
31
# File 'lib/zernio-sdk/models/linked_in_ads_platform_data.rb', line 29

def creative_selection
  @creative_selection
end

#documentObject

Returns the value of attribute document.



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

def document
  @document
end

#eventObject

Returns the value of attribute event.



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

def event
  @event
end

#followerObject

Returns the value of attribute follower.



46
47
48
# File 'lib/zernio-sdk/models/linked_in_ads_platform_data.rb', line 46

def follower
  @follower
end

#jobsObject

Returns the value of attribute jobs.



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

def jobs
  @jobs
end

#offsite_delivery_enabledObject

Deliver on the LinkedIn Audience Network. Defaults to false.



35
36
37
# File 'lib/zernio-sdk/models/linked_in_ads_platform_data.rb', line 35

def offsite_delivery_enabled
  @offsite_delivery_enabled
end

#optimization_target_typeObject

Campaign optimizationTargetType (e.g. MAX_CLICK, TARGET_COST_PER_CLICK, MAX_IMPRESSION). Forwarded verbatim — LinkedIn validates compatibility with the objective and costType. Omit for the objective-derived default.



26
27
28
# File 'lib/zernio-sdk/models/linked_in_ads_platform_data.rb', line 26

def optimization_target_type
  @optimization_target_type
end

#spotlightObject

Returns the value of attribute spotlight.



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

def spotlight
  @spotlight
end

#text_adObject

Returns the value of attribute text_ad.



50
51
52
# File 'lib/zernio-sdk/models/linked_in_ads_platform_data.rb', line 50

def text_ad
  @text_ad
end

#thought_leaderObject

Returns the value of attribute thought_leader.



56
57
58
# File 'lib/zernio-sdk/models/linked_in_ads_platform_data.rb', line 56

def thought_leader
  @thought_leader
end

#unit_costObject

Manual bid in WHOLE account-currency units (e.g. 2.5 = $2.50). Requires costType. Omit for LinkedIn's automated (max delivery) bidding. LinkedIn enforces its own per-audience min/max bid bounds.



23
24
25
# File 'lib/zernio-sdk/models/linked_in_ads_platform_data.rb', line 23

def unit_cost
  @unit_cost
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



103
104
105
# File 'lib/zernio-sdk/models/linked_in_ads_platform_data.rb', line 103

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



108
109
110
# File 'lib/zernio-sdk/models/linked_in_ads_platform_data.rb', line 108

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/zernio-sdk/models/linked_in_ads_platform_data.rb', line 81

def self.attribute_map
  {
    :'cost_type' => :'costType',
    :'unit_cost' => :'unitCost',
    :'optimization_target_type' => :'optimizationTargetType',
    :'creative_selection' => :'creativeSelection',
    :'audience_expansion_enabled' => :'audienceExpansionEnabled',
    :'offsite_delivery_enabled' => :'offsiteDeliveryEnabled',
    :'connected_television_only' => :'connectedTelevisionOnly',
    :'carousel' => :'carousel',
    :'document' => :'document',
    :'spotlight' => :'spotlight',
    :'follower' => :'follower',
    :'jobs' => :'jobs',
    :'text_ad' => :'textAd',
    :'conversation' => :'conversation',
    :'event' => :'event',
    :'thought_leader' => :'thoughtLeader'
  }
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



298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
# File 'lib/zernio-sdk/models/linked_in_ads_platform_data.rb', line 298

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



135
136
137
138
# File 'lib/zernio-sdk/models/linked_in_ads_platform_data.rb', line 135

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

.openapi_typesObject

Attribute type mapping.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/zernio-sdk/models/linked_in_ads_platform_data.rb', line 113

def self.openapi_types
  {
    :'cost_type' => :'String',
    :'unit_cost' => :'Float',
    :'optimization_target_type' => :'String',
    :'creative_selection' => :'String',
    :'audience_expansion_enabled' => :'Boolean',
    :'offsite_delivery_enabled' => :'Boolean',
    :'connected_television_only' => :'Boolean',
    :'carousel' => :'LinkedInAdsPlatformDataCarousel',
    :'document' => :'LinkedInAdsPlatformDataDocument',
    :'spotlight' => :'LinkedInAdsPlatformDataSpotlight',
    :'follower' => :'LinkedInAdsPlatformDataFollower',
    :'jobs' => :'LinkedInAdsPlatformDataJobs',
    :'text_ad' => :'LinkedInAdsPlatformDataTextAd',
    :'conversation' => :'LinkedInAdsPlatformDataConversation',
    :'event' => :'LinkedInAdsPlatformDataEvent',
    :'thought_leader' => :'LinkedInAdsPlatformDataThoughtLeader'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# File 'lib/zernio-sdk/models/linked_in_ads_platform_data.rb', line 262

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      cost_type == o.cost_type &&
      unit_cost == o.unit_cost &&
      optimization_target_type == o.optimization_target_type &&
      creative_selection == o.creative_selection &&
      audience_expansion_enabled == o.audience_expansion_enabled &&
      offsite_delivery_enabled == o.offsite_delivery_enabled &&
      connected_television_only == o.connected_television_only &&
      carousel == o.carousel &&
      document == o.document &&
      spotlight == o.spotlight &&
      follower == o.follower &&
      jobs == o.jobs &&
      text_ad == o.text_ad &&
      conversation == o.conversation &&
      event == o.event &&
      thought_leader == o.thought_leader
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


285
286
287
# File 'lib/zernio-sdk/models/linked_in_ads_platform_data.rb', line 285

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



291
292
293
# File 'lib/zernio-sdk/models/linked_in_ads_platform_data.rb', line 291

def hash
  [cost_type, unit_cost, optimization_target_type, creative_selection, audience_expansion_enabled, offsite_delivery_enabled, connected_television_only, carousel, document, spotlight, follower, jobs, text_ad, conversation, event, thought_leader].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/zernio-sdk/models/linked_in_ads_platform_data.rb', line 320

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



231
232
233
234
235
236
237
238
# File 'lib/zernio-sdk/models/linked_in_ads_platform_data.rb', line 231

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  cost_type_validator = EnumAttributeValidator.new('String', ["CPM", "CPC", "CPV"])
  return false unless cost_type_validator.valid?(@cost_type)
  creative_selection_validator = EnumAttributeValidator.new('String', ["OPTIMIZED", "ROUND_ROBIN"])
  return false unless creative_selection_validator.valid?(@creative_selection)
  true
end