Class: Zernio::ExternalPostWebhookPost

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

Overview

Native (external) post data shared by all post.external.* payloads.

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 146

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#account_idObject

Zernio social account ID the post belongs to.



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

def 
  @account_id
end

#contentObject

Post text. May be empty.



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

def content
  @content
end

#deleted_atObject

Detection time of deletion. Present on post.external.deleted; null/absent otherwise.



59
60
61
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 59

def deleted_at
  @deleted_at
end

#idObject

Platform-native post ID (NOT a Zernio post ID).



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

def id
  @id
end

#is_ai_generatedObject

Instagram only: whether Instagram labeled the media as AI-generated. Absent when the platform did not report it.



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

def is_ai_generated
  @is_ai_generated
end

#is_shared_to_feedObject

Instagram reels only: whether the reel is also shared to the main feed. Absent when the platform did not report it.



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

def is_shared_to_feed
  @is_shared_to_feed
end

#media_audio_typeObject

Instagram only: audio type of the media (MUSIC or ORIGINAL_SOUND). Absent when the platform did not report it.



53
54
55
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 53

def media_audio_type
  @media_audio_type
end

#media_itemsObject

Returns the value of attribute media_items.



37
38
39
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 37

def media_items
  @media_items
end

#media_product_typeObject

Instagram only: the platform media product type (e.g. FEED, REELS, STORY, AD). Absent when the platform did not report it.



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

def media_product_type
  @media_product_type
end

#media_typeObject

One of image, video, gif, document, text, carousel.



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

def media_type
  @media_type
end

#platformObject

Platform the post lives on (e.g. "googlebusiness").



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

def platform
  @platform
end

#published_atObject

Returns the value of attribute published_at.



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

def published_at
  @published_at
end

#sourceObject

Always "external" — distinguishes these from Zernio-originated post.* events.



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

def source
  @source
end

#thumbnail_urlObject

Returns the value of attribute thumbnail_url.



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

def thumbnail_url
  @thumbnail_url
end

#urlObject

Direct URL to the post on the platform, when available.



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

def url
  @url
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



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

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



110
111
112
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 110

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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

def self.attribute_map
  {
    :'id' => :'id',
    :'platform' => :'platform',
    :'account_id' => :'accountId',
    :'url' => :'url',
    :'content' => :'content',
    :'media_type' => :'mediaType',
    :'media_items' => :'mediaItems',
    :'thumbnail_url' => :'thumbnailUrl',
    :'published_at' => :'publishedAt',
    :'media_product_type' => :'mediaProductType',
    :'is_ai_generated' => :'isAiGenerated',
    :'is_shared_to_feed' => :'isSharedToFeed',
    :'media_audio_type' => :'mediaAudioType',
    :'source' => :'source',
    :'deleted_at' => :'deletedAt'
  }
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



417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 417

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



136
137
138
139
140
141
142
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 136

def self.openapi_nullable
  Set.new([
    :'url',
    :'thumbnail_url',
    :'deleted_at'
  ])
end

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'id' => :'String',
    :'platform' => :'String',
    :'account_id' => :'String',
    :'url' => :'String',
    :'content' => :'String',
    :'media_type' => :'String',
    :'media_items' => :'Array<ExternalPostMediaItem>',
    :'thumbnail_url' => :'String',
    :'published_at' => :'Time',
    :'media_product_type' => :'String',
    :'is_ai_generated' => :'Boolean',
    :'is_shared_to_feed' => :'Boolean',
    :'media_audio_type' => :'String',
    :'source' => :'String',
    :'deleted_at' => :'Time'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 382

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      platform == o.platform &&
       == o. &&
      url == o.url &&
      content == o.content &&
      media_type == o.media_type &&
      media_items == o.media_items &&
      thumbnail_url == o.thumbnail_url &&
      published_at == o.published_at &&
      media_product_type == o.media_product_type &&
      is_ai_generated == o.is_ai_generated &&
      is_shared_to_feed == o.is_shared_to_feed &&
      media_audio_type == o.media_audio_type &&
      source == o.source &&
      deleted_at == o.deleted_at
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


404
405
406
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 404

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



410
411
412
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 410

def hash
  [id, platform, , url, content, media_type, media_items, thumbnail_url, published_at, media_product_type, is_ai_generated, is_shared_to_feed, media_audio_type, source, deleted_at].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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

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

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

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

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

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

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

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



439
440
441
442
443
444
445
446
447
448
449
450
451
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 439

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



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

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @id.nil?
  return false if @platform.nil?
  return false if @account_id.nil?
  return false if @content.nil?
  return false if @media_type.nil?
  return false if @media_items.nil?
  return false if @published_at.nil?
  return false if @source.nil?
  source_validator = EnumAttributeValidator.new('String', ["external"])
  return false unless source_validator.valid?(@source)
  true
end