Class: Zernio::WebhookPayloadAccountAdsInitialSyncCompletedSync

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/zernio-sdk/models/webhook_payload_account_ads_initial_sync_completed_sync.rb

Overview

Summary of the initial ads sync backfill results.

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



111
112
113
114
115
116
117
118
119
120
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
# File 'lib/zernio-sdk/models/webhook_payload_account_ads_initial_sync_completed_sync.rb', line 111

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

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

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

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

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

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

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

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

Instance Attribute Details

#errorObject

Free-form error message from the platform (typically Meta's Marketing API). Truncated to ~2KB. Present when status is failure (and sometimes on success when discovery saw zero ad accounts). For UX branching prefer errorCategory; this field is for human display and debugging.



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

def error
  @error
end

#error_categoryObject

Stable category for UX branching. New values may be added; existing ones are stable. Mapping: - token_invalid: access token is expired or revoked. Reconnect. - permission_denied: token lacks required scope, or the user has no role on the Business Manager that owns the ad account. Reconnect with full permissions, or have an admin grant access. - no_ad_accounts: token is valid but sees zero ad accounts. The user needs to connect a Business Manager that owns ad accounts. - rate_limited: platform throttled us. Sync will retry automatically. - discovery_failed: any other platform-side failure. Inspect error. - unknown: classifier could not categorize the failure.



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

def error_category
  @error_category
end

#error_codeObject

Platform-native error code if parsed (e.g. Meta 190, 10, 200).



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

def error_code
  @error_code
end

#error_subcodeObject

Platform-native error subcode if parsed.



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

def error_subcode
  @error_subcode
end

#failedObject

Number of ads that failed to sync.



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

def failed
  @failed
end

#statusObject

Overall outcome of the initial sync.



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

def status
  @status
end

#syncedObject

Number of ads successfully synced.



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

def synced
  @synced
end

#total_adsObject

Total number of ads discovered for backfill.



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

def total_ads
  @total_ads
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



80
81
82
# File 'lib/zernio-sdk/models/webhook_payload_account_ads_initial_sync_completed_sync.rb', line 80

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



85
86
87
# File 'lib/zernio-sdk/models/webhook_payload_account_ads_initial_sync_completed_sync.rb', line 85

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/zernio-sdk/models/webhook_payload_account_ads_initial_sync_completed_sync.rb', line 66

def self.attribute_map
  {
    :'status' => :'status',
    :'total_ads' => :'totalAds',
    :'synced' => :'synced',
    :'failed' => :'failed',
    :'error' => :'error',
    :'error_code' => :'errorCode',
    :'error_subcode' => :'errorSubcode',
    :'error_category' => :'errorCategory'
  }
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



285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'lib/zernio-sdk/models/webhook_payload_account_ads_initial_sync_completed_sync.rb', line 285

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



104
105
106
107
# File 'lib/zernio-sdk/models/webhook_payload_account_ads_initial_sync_completed_sync.rb', line 104

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

.openapi_typesObject

Attribute type mapping.



90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/zernio-sdk/models/webhook_payload_account_ads_initial_sync_completed_sync.rb', line 90

def self.openapi_types
  {
    :'status' => :'String',
    :'total_ads' => :'Integer',
    :'synced' => :'Integer',
    :'failed' => :'Integer',
    :'error' => :'String',
    :'error_code' => :'String',
    :'error_subcode' => :'String',
    :'error_category' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/zernio-sdk/models/webhook_payload_account_ads_initial_sync_completed_sync.rb', line 257

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      status == o.status &&
      total_ads == o.total_ads &&
      synced == o.synced &&
      failed == o.failed &&
      error == o.error &&
      error_code == o.error_code &&
      error_subcode == o.error_subcode &&
      error_category == o.error_category
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


272
273
274
# File 'lib/zernio-sdk/models/webhook_payload_account_ads_initial_sync_completed_sync.rb', line 272

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



278
279
280
# File 'lib/zernio-sdk/models/webhook_payload_account_ads_initial_sync_completed_sync.rb', line 278

def hash
  [status, total_ads, synced, failed, error, error_code, error_subcode, error_category].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/zernio-sdk/models/webhook_payload_account_ads_initial_sync_completed_sync.rb', line 168

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

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

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

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



307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'lib/zernio-sdk/models/webhook_payload_account_ads_initial_sync_completed_sync.rb', line 307

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



192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/zernio-sdk/models/webhook_payload_account_ads_initial_sync_completed_sync.rb', line 192

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @status.nil?
  status_validator = EnumAttributeValidator.new('String', ["success", "failure"])
  return false unless status_validator.valid?(@status)
  return false if @total_ads.nil?
  return false if @synced.nil?
  return false if @failed.nil?
  error_category_validator = EnumAttributeValidator.new('String', ["token_invalid", "permission_denied", "no_ad_accounts", "rate_limited", "discovery_failed", "unknown"])
  return false unless error_category_validator.valid?(@error_category)
  true
end