Class: Zernio::TrackingTag

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

Overview

A platform measurement tag — the thing you create, install on a website, send events to, and target ads against. On Meta this is a Pixel (kind: pixel). The shape is platform-neutral so other platforms (Pinterest Tag, LinkedIn Insight Tag, etc.) can be added without changing the contract; platform-specific fields are simply absent where a platform has no equivalent. Returned by listTrackingTags, createTrackingTag, getTrackingTag, and updateTrackingTag.

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
195
196
197
198
199
200
201
202
# File 'lib/zernio-sdk/models/tracking_tag.rb', line 131

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#codeObject

The base-code <script> snippet to install on the site. Meta only; populated by getTrackingTag, omitted from the list view.



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

def code
  @code
end

#creation_timeObject

Unix seconds the tag was created.



45
46
47
# File 'lib/zernio-sdk/models/tracking_tag.rb', line 45

def creation_time
  @creation_time
end

#idObject

Platform-native tag id. Meta: numeric pixel id, as a string.



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

def id
  @id
end

#installedObject

Convenience flag derived from lastFiredTime — has the tag ever fired.



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

def installed
  @installed
end

#is_unavailableObject

Whether the tag is in a broken/unavailable state (Meta is_unavailable).



39
40
41
# File 'lib/zernio-sdk/models/tracking_tag.rb', line 39

def is_unavailable
  @is_unavailable
end

#kindObject

Platform-native flavor of the tag (Meta: pixel).



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

def kind
  @kind
end

#last_fired_timeObject

Unix seconds of the last event the tag received, or null if it never fired. The practical "is it installed and working" signal.



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

def last_fired_time
  @last_fired_time
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#owner_ad_account_idObject

Ad account id (act_...) that owns the tag, when reported.



51
52
53
# File 'lib/zernio-sdk/models/tracking_tag.rb', line 51

def 
  @owner_ad_account_id
end

#owner_business_idObject

Business Manager id that owns the tag, or null when the tag lives on a personal (non-BM) ad account — such tags can't be shared with other ad accounts.



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

def owner_business_id
  @owner_business_id
end

#platformObject

Returns the value of attribute platform.



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

def platform
  @platform
end

#statusObject

inactive when the platform reports the tag as broken/unavailable.



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

def status
  @status
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



94
95
96
# File 'lib/zernio-sdk/models/tracking_tag.rb', line 94

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



99
100
101
# File 'lib/zernio-sdk/models/tracking_tag.rb', line 99

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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

def self.attribute_map
  {
    :'id' => :'id',
    :'name' => :'name',
    :'platform' => :'platform',
    :'kind' => :'kind',
    :'status' => :'status',
    :'code' => :'code',
    :'last_fired_time' => :'lastFiredTime',
    :'is_unavailable' => :'isUnavailable',
    :'installed' => :'installed',
    :'creation_time' => :'creationTime',
    :'owner_business_id' => :'ownerBusinessId',
    :'owner_ad_account_id' => :'ownerAdAccountId'
  }
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



334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# File 'lib/zernio-sdk/models/tracking_tag.rb', line 334

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



122
123
124
125
126
127
# File 'lib/zernio-sdk/models/tracking_tag.rb', line 122

def self.openapi_nullable
  Set.new([
    :'last_fired_time',
    :'owner_business_id',
  ])
end

.openapi_typesObject

Attribute type mapping.



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/zernio-sdk/models/tracking_tag.rb', line 104

def self.openapi_types
  {
    :'id' => :'String',
    :'name' => :'String',
    :'platform' => :'String',
    :'kind' => :'String',
    :'status' => :'String',
    :'code' => :'String',
    :'last_fired_time' => :'Integer',
    :'is_unavailable' => :'Boolean',
    :'installed' => :'Boolean',
    :'creation_time' => :'Integer',
    :'owner_business_id' => :'String',
    :'owner_ad_account_id' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      name == o.name &&
      platform == o.platform &&
      kind == o.kind &&
      status == o.status &&
      code == o.code &&
      last_fired_time == o.last_fired_time &&
      is_unavailable == o.is_unavailable &&
      installed == o.installed &&
      creation_time == o.creation_time &&
      owner_business_id == o.owner_business_id &&
       == o.
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


321
322
323
# File 'lib/zernio-sdk/models/tracking_tag.rb', line 321

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



327
328
329
# File 'lib/zernio-sdk/models/tracking_tag.rb', line 327

def hash
  [id, name, platform, kind, status, code, last_fired_time, is_unavailable, installed, creation_time, owner_business_id, ].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @id.nil?
    invalid_properties.push('invalid value for "id", id cannot be nil.')
  end

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

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

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

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

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



356
357
358
359
360
361
362
363
364
365
366
367
368
# File 'lib/zernio-sdk/models/tracking_tag.rb', line 356

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



234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/zernio-sdk/models/tracking_tag.rb', line 234

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @id.nil?
  return false if @name.nil?
  return false if @platform.nil?
  platform_validator = EnumAttributeValidator.new('String', ["metaads"])
  return false unless platform_validator.valid?(@platform)
  return false if @kind.nil?
  kind_validator = EnumAttributeValidator.new('String', ["pixel", "tag", "insight_tag"])
  return false unless kind_validator.valid?(@kind)
  return false if @status.nil?
  status_validator = EnumAttributeValidator.new('String', ["active", "inactive"])
  return false unless status_validator.valid?(@status)
  true
end