Class: Zernio::LinkedInPlatformDataAudience

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

Overview

Organization pages only. Audience targeting for the post (Ads Manager's "Targeted audience"), sent as LinkedIn's distribution.targetEntities: OR inside a facet, AND across facets. LinkedIn rejects the post when the targeted audience is under 300 members, and Zernio rejects it on a personal profile. URN facets accept a full urn:li:: or the bare numeric id; find ids with GET /v1/ads/targeting/search?platform=linkedin (types country, region, industry, jobFunction, seniority, companySize).

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



121
122
123
124
125
126
127
128
129
130
131
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
# File 'lib/zernio-sdk/models/linked_in_platform_data_audience.rb', line 121

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#countriesObject

ISO 3166-1 alpha-2 codes with a built-in LinkedIn geo URN (same list as geoRestriction.countries, merged with it). Other countries and sub-country regions go in geoLocations.



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

def countries
  @countries
end

#degreesObject

urn:li:degree: or id (LinkedIn standardized degrees).



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

def degrees
  @degrees
end

#fields_of_studyObject

urn:li:fieldOfStudy: or id (LinkedIn standardized fields of study).



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

def fields_of_study
  @fields_of_study
end

#geo_locationsObject

LinkedIn geo URNs or ids (urn:li:geo:103644278 or 103644278): countries, states, regions, cities.



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

def geo_locations
  @geo_locations
end

#industriesObject

urn:li:industry: or id.



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

def industries
  @industries
end

#interface_localesObject

Members' LinkedIn interface locale, e.g. { language: es, country: ES }.



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

def interface_locales
  @interface_locales
end

#job_functionsObject

urn:li:function: or id.



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

def job_functions
  @job_functions
end

#organizationsObject

Schools, as urn:li:organization: or id (LinkedIn's Organization Lookup).



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

def organizations
  @organizations
end

#senioritiesObject

urn:li:seniority: or id.



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

def seniorities
  @seniorities
end

#staff_count_rangesObject

Company size of the member's current employer.



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

def staff_count_ranges
  @staff_count_ranges
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



88
89
90
# File 'lib/zernio-sdk/models/linked_in_platform_data_audience.rb', line 88

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



93
94
95
# File 'lib/zernio-sdk/models/linked_in_platform_data_audience.rb', line 93

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/zernio-sdk/models/linked_in_platform_data_audience.rb', line 72

def self.attribute_map
  {
    :'countries' => :'countries',
    :'geo_locations' => :'geoLocations',
    :'interface_locales' => :'interfaceLocales',
    :'industries' => :'industries',
    :'job_functions' => :'jobFunctions',
    :'seniorities' => :'seniorities',
    :'staff_count_ranges' => :'staffCountRanges',
    :'degrees' => :'degrees',
    :'fields_of_study' => :'fieldsOfStudy',
    :'organizations' => :'organizations'
  }
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



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

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



114
115
116
117
# File 'lib/zernio-sdk/models/linked_in_platform_data_audience.rb', line 114

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

.openapi_typesObject

Attribute type mapping.



98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/zernio-sdk/models/linked_in_platform_data_audience.rb', line 98

def self.openapi_types
  {
    :'countries' => :'Array<String>',
    :'geo_locations' => :'Array<String>',
    :'interface_locales' => :'Array<LinkedInPlatformDataAudienceInterfaceLocalesInner>',
    :'industries' => :'Array<String>',
    :'job_functions' => :'Array<String>',
    :'seniorities' => :'Array<String>',
    :'staff_count_ranges' => :'Array<String>',
    :'degrees' => :'Array<String>',
    :'fields_of_study' => :'Array<String>',
    :'organizations' => :'Array<String>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/zernio-sdk/models/linked_in_platform_data_audience.rb', line 232

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      countries == o.countries &&
      geo_locations == o.geo_locations &&
      interface_locales == o.interface_locales &&
      industries == o.industries &&
      job_functions == o.job_functions &&
      seniorities == o.seniorities &&
      staff_count_ranges == o.staff_count_ranges &&
      degrees == o.degrees &&
      fields_of_study == o.fields_of_study &&
      organizations == o.organizations
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


249
250
251
# File 'lib/zernio-sdk/models/linked_in_platform_data_audience.rb', line 249

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



255
256
257
# File 'lib/zernio-sdk/models/linked_in_platform_data_audience.rb', line 255

def hash
  [countries, geo_locations, interface_locales, industries, job_functions, seniorities, staff_count_ranges, degrees, fields_of_study, organizations].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



198
199
200
201
202
203
204
205
206
# File 'lib/zernio-sdk/models/linked_in_platform_data_audience.rb', line 198

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@countries.nil? && @countries.length > 25
    invalid_properties.push('invalid value for "countries", number of items must be less than or equal to 25.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



284
285
286
287
288
289
290
291
292
293
294
295
296
# File 'lib/zernio-sdk/models/linked_in_platform_data_audience.rb', line 284

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



210
211
212
213
214
# File 'lib/zernio-sdk/models/linked_in_platform_data_audience.rb', line 210

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@countries.nil? && @countries.length > 25
  true
end