Class: Zernio::Post
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Zernio::Post
- Defined in:
- lib/zernio-sdk/models/post.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#_id ⇒ Object
Returns the value of attribute _id.
-
#content ⇒ Object
Returns the value of attribute content.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#hashtags ⇒ Object
Returns the value of attribute hashtags.
-
#media_items ⇒ Object
Returns the value of attribute media_items.
-
#mentions ⇒ Object
Stored for reference only.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#platforms ⇒ Object
Returns the value of attribute platforms.
-
#queue_id ⇒ Object
Queue ID if the post was scheduled via a specific queue.
-
#queued_from_profile ⇒ Object
Profile ID if the post was scheduled via the queue.
-
#recycled_from_post_id ⇒ Object
ID of the original post if this post was created via recycling.
-
#recycling ⇒ Object
Returns the value of attribute recycling.
-
#scheduled_for ⇒ Object
Returns the value of attribute scheduled_for.
-
#status ⇒ Object
Returns the value of attribute status.
-
#tags ⇒ Object
YouTube constraints: each tag max 100 chars, combined max 500 chars, duplicates removed.
-
#timezone ⇒ Object
Returns the value of attribute timezone.
-
#title ⇒ Object
YouTube: title must be ≤ 100 characters.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
-
#visibility ⇒ Object
Returns the value of attribute visibility.
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 = {}) ⇒ Post
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 = {}) ⇒ Post
Initializes the object
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 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
# File 'lib/zernio-sdk/models/post.rb', line 156 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::Post` 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::Post`. 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'] end if attributes.key?(:'user_id') self.user_id = attributes[:'user_id'] end if attributes.key?(:'title') self.title = attributes[:'title'] end if attributes.key?(:'content') self.content = attributes[:'content'] end if attributes.key?(:'media_items') if (value = attributes[:'media_items']).is_a?(Array) self.media_items = value end end if attributes.key?(:'platforms') if (value = attributes[:'platforms']).is_a?(Array) self.platforms = value end end if attributes.key?(:'scheduled_for') self.scheduled_for = attributes[:'scheduled_for'] end if attributes.key?(:'timezone') self.timezone = attributes[:'timezone'] end if attributes.key?(:'status') self.status = attributes[:'status'] end if attributes.key?(:'tags') if (value = attributes[:'tags']).is_a?(Array) self. = value end end if attributes.key?(:'hashtags') if (value = attributes[:'hashtags']).is_a?(Array) self. = value end end if attributes.key?(:'mentions') if (value = attributes[:'mentions']).is_a?(Array) self.mentions = value end end if attributes.key?(:'visibility') self.visibility = attributes[:'visibility'] end if attributes.key?(:'metadata') if (value = attributes[:'metadata']).is_a?(Hash) self. = value end end if attributes.key?(:'recycling') self.recycling = attributes[:'recycling'] end if attributes.key?(:'recycled_from_post_id') self.recycled_from_post_id = attributes[:'recycled_from_post_id'] end if attributes.key?(:'queued_from_profile') self.queued_from_profile = attributes[:'queued_from_profile'] end if attributes.key?(:'queue_id') self.queue_id = attributes[:'queue_id'] end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] end end |
Instance Attribute Details
#_id ⇒ Object
Returns the value of attribute _id.
18 19 20 |
# File 'lib/zernio-sdk/models/post.rb', line 18 def _id @_id end |
#content ⇒ Object
Returns the value of attribute content.
25 26 27 |
# File 'lib/zernio-sdk/models/post.rb', line 25 def content @content end |
#created_at ⇒ Object
Returns the value of attribute created_at.
60 61 62 |
# File 'lib/zernio-sdk/models/post.rb', line 60 def created_at @created_at end |
#hashtags ⇒ Object
Returns the value of attribute hashtags.
40 41 42 |
# File 'lib/zernio-sdk/models/post.rb', line 40 def @hashtags end |
#media_items ⇒ Object
Returns the value of attribute media_items.
27 28 29 |
# File 'lib/zernio-sdk/models/post.rb', line 27 def media_items @media_items end |
#mentions ⇒ Object
Stored for reference only. This field does NOT automatically create @mentions when publishing. For LinkedIn @mentions, use the /v1/accounts/accountId/linkedin-mentions endpoint to resolve profile URLs to URNs, then embed the returned mentionFormat directly in the post content field.
43 44 45 |
# File 'lib/zernio-sdk/models/post.rb', line 43 def mentions @mentions end |
#metadata ⇒ Object
Returns the value of attribute metadata.
47 48 49 |
# File 'lib/zernio-sdk/models/post.rb', line 47 def @metadata end |
#platforms ⇒ Object
Returns the value of attribute platforms.
29 30 31 |
# File 'lib/zernio-sdk/models/post.rb', line 29 def platforms @platforms end |
#queue_id ⇒ Object
Queue ID if the post was scheduled via a specific queue
58 59 60 |
# File 'lib/zernio-sdk/models/post.rb', line 58 def queue_id @queue_id end |
#queued_from_profile ⇒ Object
Profile ID if the post was scheduled via the queue
55 56 57 |
# File 'lib/zernio-sdk/models/post.rb', line 55 def queued_from_profile @queued_from_profile end |
#recycled_from_post_id ⇒ Object
ID of the original post if this post was created via recycling
52 53 54 |
# File 'lib/zernio-sdk/models/post.rb', line 52 def recycled_from_post_id @recycled_from_post_id end |
#recycling ⇒ Object
Returns the value of attribute recycling.
49 50 51 |
# File 'lib/zernio-sdk/models/post.rb', line 49 def recycling @recycling end |
#scheduled_for ⇒ Object
Returns the value of attribute scheduled_for.
31 32 33 |
# File 'lib/zernio-sdk/models/post.rb', line 31 def scheduled_for @scheduled_for end |
#status ⇒ Object
Returns the value of attribute status.
35 36 37 |
# File 'lib/zernio-sdk/models/post.rb', line 35 def status @status end |
#tags ⇒ Object
YouTube constraints: each tag max 100 chars, combined max 500 chars, duplicates removed.
38 39 40 |
# File 'lib/zernio-sdk/models/post.rb', line 38 def @tags end |
#timezone ⇒ Object
Returns the value of attribute timezone.
33 34 35 |
# File 'lib/zernio-sdk/models/post.rb', line 33 def timezone @timezone end |
#title ⇒ Object
YouTube: title must be ≤ 100 characters.
23 24 25 |
# File 'lib/zernio-sdk/models/post.rb', line 23 def title @title end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
62 63 64 |
# File 'lib/zernio-sdk/models/post.rb', line 62 def updated_at @updated_at end |
#user_id ⇒ Object
Returns the value of attribute user_id.
20 21 22 |
# File 'lib/zernio-sdk/models/post.rb', line 20 def user_id @user_id end |
#visibility ⇒ Object
Returns the value of attribute visibility.
45 46 47 |
# File 'lib/zernio-sdk/models/post.rb', line 45 def visibility @visibility end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
113 114 115 |
# File 'lib/zernio-sdk/models/post.rb', line 113 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
118 119 120 |
# File 'lib/zernio-sdk/models/post.rb', line 118 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/zernio-sdk/models/post.rb', line 87 def self.attribute_map { :'_id' => :'_id', :'user_id' => :'userId', :'title' => :'title', :'content' => :'content', :'media_items' => :'mediaItems', :'platforms' => :'platforms', :'scheduled_for' => :'scheduledFor', :'timezone' => :'timezone', :'status' => :'status', :'tags' => :'tags', :'hashtags' => :'hashtags', :'mentions' => :'mentions', :'visibility' => :'visibility', :'metadata' => :'metadata', :'recycling' => :'recycling', :'recycled_from_post_id' => :'recycledFromPostId', :'queued_from_profile' => :'queuedFromProfile', :'queue_id' => :'queueId', :'created_at' => :'createdAt', :'updated_at' => :'updatedAt' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 |
# File 'lib/zernio-sdk/models/post.rb', line 344 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
149 150 151 152 |
# File 'lib/zernio-sdk/models/post.rb', line 149 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/zernio-sdk/models/post.rb', line 123 def self.openapi_types { :'_id' => :'String', :'user_id' => :'PostUserId', :'title' => :'String', :'content' => :'String', :'media_items' => :'Array<MediaItem>', :'platforms' => :'Array<PlatformTarget>', :'scheduled_for' => :'Time', :'timezone' => :'String', :'status' => :'String', :'tags' => :'Array<String>', :'hashtags' => :'Array<String>', :'mentions' => :'Array<String>', :'visibility' => :'String', :'metadata' => :'Hash<String, Object>', :'recycling' => :'RecyclingState', :'recycled_from_post_id' => :'String', :'queued_from_profile' => :'String', :'queue_id' => :'String', :'created_at' => :'Time', :'updated_at' => :'Time' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 |
# File 'lib/zernio-sdk/models/post.rb', line 304 def ==(o) return true if self.equal?(o) self.class == o.class && _id == o._id && user_id == o.user_id && title == o.title && content == o.content && media_items == o.media_items && platforms == o.platforms && scheduled_for == o.scheduled_for && timezone == o.timezone && status == o.status && == o. && == o. && mentions == o.mentions && visibility == o.visibility && == o. && recycling == o.recycling && recycled_from_post_id == o.recycled_from_post_id && queued_from_profile == o.queued_from_profile && queue_id == o.queue_id && created_at == o.created_at && updated_at == o.updated_at end |
#eql?(o) ⇒ Boolean
331 332 333 |
# File 'lib/zernio-sdk/models/post.rb', line 331 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
337 338 339 |
# File 'lib/zernio-sdk/models/post.rb', line 337 def hash [_id, user_id, title, content, media_items, platforms, scheduled_for, timezone, status, , , mentions, visibility, , recycling, recycled_from_post_id, queued_from_profile, queue_id, created_at, updated_at].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
265 266 267 268 269 |
# File 'lib/zernio-sdk/models/post.rb', line 265 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
366 367 368 369 370 371 372 373 374 375 376 377 378 |
# File 'lib/zernio-sdk/models/post.rb', line 366 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
273 274 275 276 277 278 279 280 |
# File 'lib/zernio-sdk/models/post.rb', line 273 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' status_validator = EnumAttributeValidator.new('String', ["draft", "scheduled", "publishing", "published", "failed", "partial"]) return false unless status_validator.valid?(@status) visibility_validator = EnumAttributeValidator.new('String', ["public", "private", "unlisted"]) return false unless visibility_validator.valid?(@visibility) true end |