Class: Zernio::ExternalPostWebhookPost
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Zernio::ExternalPostWebhookPost
- 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
-
#account_id ⇒ Object
Zernio social account ID the post belongs to.
-
#content ⇒ Object
Post text.
-
#deleted_at ⇒ Object
Detection time of deletion.
-
#id ⇒ Object
Platform-native post ID (NOT a Zernio post ID).
-
#media_items ⇒ Object
Returns the value of attribute media_items.
-
#media_type ⇒ Object
One of image, video, gif, document, text, carousel.
-
#platform ⇒ Object
Platform the post lives on (e.g. "googlebusiness").
-
#published_at ⇒ Object
Returns the value of attribute published_at.
-
#source ⇒ Object
Always "external" — distinguishes these from Zernio-originated post.* events.
-
#thumbnail_url ⇒ Object
Returns the value of attribute thumbnail_url.
-
#url ⇒ Object
Direct URL to the post on the platform, when available.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ ExternalPostWebhookPost
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ ExternalPostWebhookPost
Initializes the object
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 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 126 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.account_id = attributes[:'account_id'] else self.account_id = 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?(:'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_id ⇒ Object
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 @account_id end |
#content ⇒ Object
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_at ⇒ Object
Detection time of deletion. Present on post.external.deleted; null/absent otherwise.
47 48 49 |
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 47 def deleted_at @deleted_at end |
#id ⇒ Object
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 |
#media_items ⇒ Object
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_type ⇒ Object
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 |
#platform ⇒ Object
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_at ⇒ Object
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 |
#source ⇒ Object
Always "external" — distinguishes these from Zernio-originated post.* events.
44 45 46 |
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 44 def source @source end |
#thumbnail_url ⇒ Object
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 |
#url ⇒ Object
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_map ⇒ Object
Returns attribute mapping this model knows about
89 90 91 |
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 89 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
94 95 96 |
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 94 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 72 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', :'source' => :'source', :'deleted_at' => :'deletedAt' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 |
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 377 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_nullable ⇒ Object
List of attributes with nullable: true
116 117 118 119 120 121 122 |
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 116 def self.openapi_nullable Set.new([ :'url', :'thumbnail_url', :'deleted_at' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 99 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', :'source' => :'String', :'deleted_at' => :'Time' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 |
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 346 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && platform == o.platform && account_id == o.account_id && 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 && source == o.source && deleted_at == o.deleted_at end |
#eql?(o) ⇒ Boolean
364 365 366 |
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 364 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
370 371 372 |
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 370 def hash [id, platform, account_id, url, content, media_type, media_items, thumbnail_url, published_at, source, deleted_at].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 242 243 244 245 |
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 209 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_hash ⇒ Hash
Returns the object in the form of hash
399 400 401 402 403 404 405 406 407 408 409 410 411 |
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 399 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
249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
# File 'lib/zernio-sdk/models/external_post_webhook_post.rb', line 249 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 |