Class: Zernio::PlatformTarget
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Zernio::PlatformTarget
- Defined in:
- lib/zernio-sdk/models/platform_target.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#account_id ⇒ Object
Returns the value of attribute account_id.
-
#custom_content ⇒ Object
Platform-specific text override.
-
#custom_media ⇒ Object
Returns the value of attribute custom_media.
-
#error_category ⇒ Object
Error category for programmatic handling: auth_expired (token expired/revoked), user_content (wrong format/too long), user_abuse (rate limits/spam), account_issue (config problems), platform_rejected (policy violation), platform_error (5xx/maintenance), platform_rate_limit (platform throttling, retried automatically), quota_exhausted (shared daily API quota empty, resumes at the platform's reset), system_error (Zernio infra), unknown.
-
#error_message ⇒ Object
Human-readable error message when status is failed.
-
#error_source ⇒ Object
Who caused the error: user (fix content/reconnect), platform (outage/API change), system (Zernio issue, rare).
-
#is_trial_reel ⇒ Object
Present and true only when this Instagram reel was launched as a Trial through Zernio (created with platformSpecificData.trialParams).
-
#platform ⇒ Object
Supported values: twitter, threads, instagram, youtube, facebook, linkedin, pinterest, reddit, tiktok, bluesky, googlebusiness, telegram.
-
#platform_post_id ⇒ Object
The native post ID on the platform (populated after successful publish).
-
#platform_post_url ⇒ Object
Public URL of the published post.
-
#platform_specific_data ⇒ Object
The platform-specific options stored on this target, echoed back as they were sent.
-
#published_at ⇒ Object
Timestamp when the post was published to this platform.
-
#removed_from_platform_at ⇒ Object
Set when a post that was successfully published later disappears from the platform (deleted on-platform or taken down by the platform).
-
#scheduled_for ⇒ Object
Optional per-platform scheduled time override (uses post.scheduledFor when omitted).
-
#status ⇒ Object
Platform-specific status: pending, publishing, published, failed.
-
#trial_graduation_strategy ⇒ Object
Graduation strategy the trial reel was launched with.
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 = {}) ⇒ PlatformTarget
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 = {}) ⇒ PlatformTarget
Initializes the object
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 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 150 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::PlatformTarget` 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::PlatformTarget`. 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?(:'platform') self.platform = attributes[:'platform'] end if attributes.key?(:'account_id') self.account_id = attributes[:'account_id'] end if attributes.key?(:'custom_content') self.custom_content = attributes[:'custom_content'] end if attributes.key?(:'custom_media') if (value = attributes[:'custom_media']).is_a?(Array) self.custom_media = value end end if attributes.key?(:'scheduled_for') self.scheduled_for = attributes[:'scheduled_for'] end if attributes.key?(:'platform_specific_data') if (value = attributes[:'platform_specific_data']).is_a?(Hash) self.platform_specific_data = value end end if attributes.key?(:'status') self.status = attributes[:'status'] end if attributes.key?(:'platform_post_id') self.platform_post_id = attributes[:'platform_post_id'] end if attributes.key?(:'platform_post_url') self.platform_post_url = attributes[:'platform_post_url'] end if attributes.key?(:'published_at') self.published_at = attributes[:'published_at'] end if attributes.key?(:'removed_from_platform_at') self.removed_from_platform_at = attributes[:'removed_from_platform_at'] end if attributes.key?(:'is_trial_reel') self.is_trial_reel = attributes[:'is_trial_reel'] end if attributes.key?(:'trial_graduation_strategy') self.trial_graduation_strategy = attributes[:'trial_graduation_strategy'] end if attributes.key?(:'error_message') self. = attributes[:'error_message'] end if attributes.key?(:'error_category') self.error_category = attributes[:'error_category'] end if attributes.key?(:'error_source') self.error_source = attributes[:'error_source'] end end |
Instance Attribute Details
#account_id ⇒ Object
Returns the value of attribute account_id.
21 22 23 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 21 def account_id @account_id end |
#custom_content ⇒ Object
Platform-specific text override. When set, this content is used instead of the top-level post content for this platform. Useful for tailoring captions per platform (e.g. keeping tweets under 280 characters).
24 25 26 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 24 def custom_content @custom_content end |
#custom_media ⇒ Object
Returns the value of attribute custom_media.
26 27 28 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 26 def custom_media @custom_media end |
#error_category ⇒ Object
Error category for programmatic handling: auth_expired (token expired/revoked), user_content (wrong format/too long), user_abuse (rate limits/spam), account_issue (config problems), platform_rejected (policy violation), platform_error (5xx/maintenance), platform_rate_limit (platform throttling, retried automatically), quota_exhausted (shared daily API quota empty, resumes at the platform's reset), system_error (Zernio infra), unknown
59 60 61 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 59 def error_category @error_category end |
#error_message ⇒ Object
Human-readable error message when status is failed. Contains platform-specific error details explaining why the publish failed.
56 57 58 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 56 def @error_message end |
#error_source ⇒ Object
Who caused the error: user (fix content/reconnect), platform (outage/API change), system (Zernio issue, rare)
62 63 64 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 62 def error_source @error_source end |
#is_trial_reel ⇒ Object
Present and true only when this Instagram reel was launched as a Trial through Zernio (created with platformSpecificData.trialParams). Use it to segment trial reels in analytics. Note: Instagram's Graph API exposes no readable trial field, so this reflects creation-time intent only. It indicates the reel STARTED as a trial, not whether or when it graduated.
50 51 52 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 50 def is_trial_reel @is_trial_reel end |
#platform ⇒ Object
Supported values: twitter, threads, instagram, youtube, facebook, linkedin, pinterest, reddit, tiktok, bluesky, googlebusiness, telegram
19 20 21 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 19 def platform @platform end |
#platform_post_id ⇒ Object
The native post ID on the platform (populated after successful publish)
38 39 40 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 38 def platform_post_id @platform_post_id end |
#platform_post_url ⇒ Object
Public URL of the published post. Included in the response for immediate posts; for scheduled posts, fetch via GET /v1/posts/postId after publish time. Empty when the platform confirmed the publish without returning an id a permalink can be built from (TikTok returns a publish id for some uploads); the TikTok reconcile cron backfills it later.
41 42 43 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 41 def platform_post_url @platform_post_url end |
#platform_specific_data ⇒ Object
The platform-specific options stored on this target, echoed back as they were sent. Typed per platform on the way in (see the *PlatformData schemas on the request body); free-form on the way out, because a response is not guaranteed to match exactly one of those variants and generated clients that pick a variant by structure reject the entire response when it doesn't. Zernio's internal publishing state (snapshots, container ids, publish stage) is never returned here, and the key is omitted rather than sent as an empty object.
32 33 34 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 32 def platform_specific_data @platform_specific_data end |
#published_at ⇒ Object
Timestamp when the post was published to this platform
44 45 46 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 44 def published_at @published_at end |
#removed_from_platform_at ⇒ Object
Set when a post that was successfully published later disappears from the platform (deleted on-platform or taken down by the platform). status stays "published" (it reflects the publish outcome); poll this field to detect post-publish removals. Absent while the post is live, and cleared if the post reappears. Detection runs with the analytics sync, so expect up to a few hours of lag.
47 48 49 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 47 def removed_from_platform_at @removed_from_platform_at end |
#scheduled_for ⇒ Object
Optional per-platform scheduled time override (uses post.scheduledFor when omitted)
29 30 31 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 29 def scheduled_for @scheduled_for end |
#status ⇒ Object
Platform-specific status: pending, publishing, published, failed
35 36 37 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 35 def status @status end |
#trial_graduation_strategy ⇒ Object
Graduation strategy the trial reel was launched with. Present only when isTrialReel is true.
53 54 55 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 53 def trial_graduation_strategy @trial_graduation_strategy end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
109 110 111 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 109 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
114 115 116 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 114 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 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 87 def self.attribute_map { :'platform' => :'platform', :'account_id' => :'accountId', :'custom_content' => :'customContent', :'custom_media' => :'customMedia', :'scheduled_for' => :'scheduledFor', :'platform_specific_data' => :'platformSpecificData', :'status' => :'status', :'platform_post_id' => :'platformPostId', :'platform_post_url' => :'platformPostUrl', :'published_at' => :'publishedAt', :'removed_from_platform_at' => :'removedFromPlatformAt', :'is_trial_reel' => :'isTrialReel', :'trial_graduation_strategy' => :'trialGraduationStrategy', :'error_message' => :'errorMessage', :'error_category' => :'errorCategory', :'error_source' => :'errorSource' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 322 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
141 142 143 144 145 146 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 141 def self.openapi_nullable Set.new([ :'platform_post_url', :'removed_from_platform_at', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 119 def self.openapi_types { :'platform' => :'String', :'account_id' => :'PlatformTargetAccountId', :'custom_content' => :'String', :'custom_media' => :'Array<MediaItem>', :'scheduled_for' => :'Time', :'platform_specific_data' => :'Hash<String, Object>', :'status' => :'String', :'platform_post_id' => :'String', :'platform_post_url' => :'String', :'published_at' => :'Time', :'removed_from_platform_at' => :'Time', :'is_trial_reel' => :'Boolean', :'trial_graduation_strategy' => :'String', :'error_message' => :'String', :'error_category' => :'String', :'error_source' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 286 def ==(o) return true if self.equal?(o) self.class == o.class && platform == o.platform && account_id == o.account_id && custom_content == o.custom_content && custom_media == o.custom_media && scheduled_for == o.scheduled_for && platform_specific_data == o.platform_specific_data && status == o.status && platform_post_id == o.platform_post_id && platform_post_url == o.platform_post_url && published_at == o.published_at && removed_from_platform_at == o.removed_from_platform_at && is_trial_reel == o.is_trial_reel && trial_graduation_strategy == o.trial_graduation_strategy && == o. && error_category == o.error_category && error_source == o.error_source end |
#eql?(o) ⇒ Boolean
309 310 311 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 309 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
315 316 317 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 315 def hash [platform, account_id, custom_content, custom_media, scheduled_for, platform_specific_data, status, platform_post_id, platform_post_url, published_at, removed_from_platform_at, is_trial_reel, trial_graduation_strategy, , error_category, error_source].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
235 236 237 238 239 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 235 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
344 345 346 347 348 349 350 351 352 353 354 355 356 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 344 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
243 244 245 246 247 248 249 250 251 252 |
# File 'lib/zernio-sdk/models/platform_target.rb', line 243 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' trial_graduation_strategy_validator = EnumAttributeValidator.new('String', ["MANUAL", "SS_PERFORMANCE"]) return false unless trial_graduation_strategy_validator.valid?(@trial_graduation_strategy) error_category_validator = EnumAttributeValidator.new('String', ["auth_expired", "user_content", "user_abuse", "account_issue", "platform_rejected", "platform_error", "platform_rate_limit", "quota_exhausted", "system_error", "unknown"]) return false unless error_category_validator.valid?(@error_category) error_source_validator = EnumAttributeValidator.new('String', ["user", "platform", "system"]) return false unless error_source_validator.valid?(@error_source) true end |