Class: Zernio::CreatePostRequest
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Zernio::CreatePostRequest
- Defined in:
- lib/zernio-sdk/models/create_post_request.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Post caption/text.
-
#crossposting_enabled ⇒ Object
Stored on the post and echoed back on reads.
-
#facebook_settings ⇒ Object
Root-level Facebook settings applied to the Facebook platforms sent in the same request.
-
#hashtags ⇒ Object
Stored for reference only.
-
#is_draft ⇒ Object
When true, saves the post as a draft.
-
#media_items ⇒ Object
Media attached to every platform in the request (a platform entry can override it with
customMedia). -
#mentions ⇒ Object
Stored for reference only.
-
#metadata ⇒ Object
Free-form key/value pairs of your own, stored on the post and returned on reads and in webhook payloads.
-
#platforms ⇒ Object
Target platforms and accounts for this post.
-
#publish_now ⇒ Object
Publish to every platform synchronously in this request instead of scheduling; the response then carries each platform result and
platformPostUrl, with HTTP 207 when some platforms failed. -
#queue_id ⇒ Object
Specific queue ID to use when scheduling via queue.
-
#queued_from_profile ⇒ Object
Profile ID to schedule via queue.
-
#recycling ⇒ Object
Returns the value of attribute recycling.
-
#scheduled_for ⇒ Object
When to publish.
-
#tags ⇒ Object
Tags/keywords.
-
#tiktok_settings ⇒ Object
Root-level TikTok settings applied to the TikTok platforms sent in the same request.
-
#timezone ⇒ Object
IANA timezone (
Europe/Madrid,America/New_York) used to interpret ascheduledFor(root or per-platform) that carries noZor offset. -
#title ⇒ Object
Stored on the post for reference/display only.
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 = {}) ⇒ CreatePostRequest
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 = {}) ⇒ CreatePostRequest
Initializes the object
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 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 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 137 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::CreatePostRequest` 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::CreatePostRequest`. 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?(:'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?(:'publish_now') self.publish_now = attributes[:'publish_now'] else self.publish_now = false end if attributes.key?(:'is_draft') self.is_draft = attributes[:'is_draft'] else self.is_draft = false end if attributes.key?(:'timezone') self.timezone = attributes[:'timezone'] else self.timezone = 'UTC' 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?(:'crossposting_enabled') self.crossposting_enabled = attributes[:'crossposting_enabled'] else self.crossposting_enabled = true end if attributes.key?(:'metadata') if (value = attributes[:'metadata']).is_a?(Hash) self. = value end end if attributes.key?(:'tiktok_settings') self.tiktok_settings = attributes[:'tiktok_settings'] end if attributes.key?(:'facebook_settings') self.facebook_settings = attributes[:'facebook_settings'] end if attributes.key?(:'recycling') self.recycling = attributes[:'recycling'] 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 end |
Instance Attribute Details
#content ⇒ Object
Post caption/text. Optional when media is attached, all platforms have customContent, every platform entry is an X Article (platformSpecificData.article), or every platform entry is a LinkedIn text-free reshare (platformSpecificData.reshareUrl with no text). Required for other text-only posts.
22 23 24 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 22 def content @content end |
#crossposting_enabled ⇒ Object
Stored on the post and echoed back on reads. Publishing does not branch on it: every entry in platforms is published regardless, so treat it as a label for your own tooling.
52 53 54 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 52 def crossposting_enabled @crossposting_enabled end |
#facebook_settings ⇒ Object
Root-level Facebook settings applied to the Facebook platforms sent in the same request. Merged into each platform's platformSpecificData.facebookSettings, with platform-specific settings taking precedence.
61 62 63 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 61 def facebook_settings @facebook_settings end |
#hashtags ⇒ Object
Stored for reference only. Hashtags are NOT automatically appended to the caption when publishing. Include hashtags directly in the content field (platforms like Instagram only support hashtags as caption text). For YouTube keywords, use the tags field instead.
46 47 48 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 46 def end |
#is_draft ⇒ Object
When true, saves the post as a draft. When none of scheduledFor, publishNow, or queuedFromProfile are provided, the post defaults to draft automatically.
37 38 39 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 37 def is_draft @is_draft end |
#media_items ⇒ Object
Media attached to every platform in the request (a platform entry can override it with customMedia). Each entry needs a publicly reachable HTTPS url; type (image, video, gif, document) is inferred from the URL extension when omitted and a type that contradicts the extension is rejected with 400. Upload files with POST /v1/media/presign first; per-platform size, duration and format limits are listed on each platform schema.
25 26 27 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 25 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.
49 50 51 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 49 def mentions @mentions end |
#metadata ⇒ Object
Free-form key/value pairs of your own, stored on the post and returned on reads and in webhook payloads. Zernio also writes the bookkeeping keys usageCounted, usageRefunded and hidden into this object; do not set them, and they are stripped from webhook payloads.
55 56 57 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 55 def end |
#platforms ⇒ Object
Target platforms and accounts for this post. Required for non-draft posts (returns 400 if empty). Drafts can omit platforms.
28 29 30 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 28 def platforms @platforms end |
#publish_now ⇒ Object
Publish to every platform synchronously in this request instead of scheduling; the response then carries each platform result and platformPostUrl, with HTTP 207 when some platforms failed. Takes precedence over scheduledFor; ignored when isDraft is true.
34 35 36 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 34 def publish_now @publish_now end |
#queue_id ⇒ Object
Specific queue ID to use when scheduling via queue. Only used when queuedFromProfile is also provided. If omitted, uses the profile's default queue.
69 70 71 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 69 def queue_id @queue_id end |
#queued_from_profile ⇒ Object
Profile ID to schedule via queue. When provided without scheduledFor, the post is auto-assigned to the next available slot. Do not call /v1/queue/next-slot and use that time in scheduledFor, as that bypasses queue locking.
66 67 68 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 66 def queued_from_profile @queued_from_profile end |
#recycling ⇒ Object
Returns the value of attribute recycling.
63 64 65 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 63 def recycling @recycling end |
#scheduled_for ⇒ Object
When to publish. Required unless publishNow is true, queuedFromProfile is set, or the post is a draft. An ISO 8601 value with a Z or offset (2026-01-15T10:00:00Z, 2026-01-15T11:00:00+01:00) is taken as-is; a value without one (2026-01-15T10:00:00 or 2026-01-15 10:00) is read as local time in timezone. A value already in the past is published synchronously in the same request. Ignored when publishNow is true.
31 32 33 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 31 def scheduled_for @scheduled_for end |
#tags ⇒ Object
Tags/keywords. YouTube constraints: each tag max 100 chars, combined max 500 chars, duplicates auto-removed.
43 44 45 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 43 def end |
#tiktok_settings ⇒ Object
Root-level TikTok settings applied to the TikTok platforms sent in the same request. Merged into each platform's platformSpecificData, with platform-specific settings taking precedence.
58 59 60 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 58 def tiktok_settings @tiktok_settings end |
#timezone ⇒ Object
IANA timezone (Europe/Madrid, America/New_York) used to interpret a scheduledFor (root or per-platform) that carries no Z or offset. Has no effect on values that already carry one. An unknown name returns 400 when scheduledFor is set.
40 41 42 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 40 def timezone @timezone end |
#title ⇒ Object
Stored on the post for reference/display only. This field is NOT used as the video title when publishing. To set a YouTube video title, use platformSpecificData.title on the youtube platform target (falls back to the first line of content when omitted).
19 20 21 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 19 def title @title end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
96 97 98 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 96 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
101 102 103 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 101 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 87 88 89 90 91 92 93 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 72 def self.attribute_map { :'title' => :'title', :'content' => :'content', :'media_items' => :'mediaItems', :'platforms' => :'platforms', :'scheduled_for' => :'scheduledFor', :'publish_now' => :'publishNow', :'is_draft' => :'isDraft', :'timezone' => :'timezone', :'tags' => :'tags', :'hashtags' => :'hashtags', :'mentions' => :'mentions', :'crossposting_enabled' => :'crosspostingEnabled', :'metadata' => :'metadata', :'tiktok_settings' => :'tiktokSettings', :'facebook_settings' => :'facebookSettings', :'recycling' => :'recycling', :'queued_from_profile' => :'queuedFromProfile', :'queue_id' => :'queueId' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 299 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
130 131 132 133 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 130 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 106 def self.openapi_types { :'title' => :'String', :'content' => :'String', :'media_items' => :'Array<MediaItem>', :'platforms' => :'Array<CreatePostRequestPlatformsInner>', :'scheduled_for' => :'Time', :'publish_now' => :'Boolean', :'is_draft' => :'Boolean', :'timezone' => :'String', :'tags' => :'Array<String>', :'hashtags' => :'Array<String>', :'mentions' => :'Array<String>', :'crossposting_enabled' => :'Boolean', :'metadata' => :'Hash<String, Object>', :'tiktok_settings' => :'TikTokPlatformData', :'facebook_settings' => :'FacebookSettings', :'recycling' => :'RecyclingConfig', :'queued_from_profile' => :'String', :'queue_id' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 261 def ==(o) return true if self.equal?(o) self.class == o.class && title == o.title && content == o.content && media_items == o.media_items && platforms == o.platforms && scheduled_for == o.scheduled_for && publish_now == o.publish_now && is_draft == o.is_draft && timezone == o.timezone && == o. && == o. && mentions == o.mentions && crossposting_enabled == o.crossposting_enabled && == o. && tiktok_settings == o.tiktok_settings && facebook_settings == o.facebook_settings && recycling == o.recycling && queued_from_profile == o.queued_from_profile && queue_id == o.queue_id end |
#eql?(o) ⇒ Boolean
286 287 288 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 286 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
292 293 294 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 292 def hash [title, content, media_items, platforms, scheduled_for, publish_now, is_draft, timezone, , , mentions, crossposting_enabled, , tiktok_settings, facebook_settings, recycling, queued_from_profile, queue_id].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
246 247 248 249 250 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 246 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
321 322 323 324 325 326 327 328 329 330 331 332 333 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 321 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
254 255 256 257 |
# File 'lib/zernio-sdk/models/create_post_request.rb', line 254 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' true end |