Class: Zernio::PlatformTarget

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

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

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. = 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.error_message = 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

  if attributes.key?(:'platform_error')
    self.platform_error = attributes[:'platform_error']
  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
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 (a shared quota pool the integration draws on is empty, including our own capacity gate in front of one; not caused by your content or account, and safe to retry once the pool frees up), 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
  @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_error ⇒ Object

Returns the value of attribute platform_error.



64
65
66
# File 'lib/zernio-sdk/models/platform_target.rb', line 64

def platform_error
  @platform_error
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. If TikTok never returns one, /v1/analytics reports that entry as syncStatus unavailable.



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. YouTube uploads a scheduled public video up to 15 minutes early as private with YouTube's own release time, so its entry is published with this set to scheduledFor, the moment the video goes public.



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, processing, uploading, published, failed, cancelled (removed from the platform via DELETE /v1/posts/postId/unpublish)



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



112
113
114
# File 'lib/zernio-sdk/models/platform_target.rb', line 112

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributes ⇒ Object

Returns all the JSON keys this model knows about



117
118
119
# File 'lib/zernio-sdk/models/platform_target.rb', line 117

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_map ⇒ Object

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



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/zernio-sdk/models/platform_target.rb', line 89

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',
    :'platform_error' => :'platformError'
  }
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



331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
# File 'lib/zernio-sdk/models/platform_target.rb', line 331

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



145
146
147
148
149
150
# File 'lib/zernio-sdk/models/platform_target.rb', line 145

def self.openapi_nullable
  Set.new([
    :'platform_post_url',
    :'removed_from_platform_at',
  ])
end

.openapi_types ⇒ Object

Attribute type mapping.



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/zernio-sdk/models/platform_target.rb', line 122

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',
    :'platform_error' => :'PostPlatformError'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object) —

    to be compared



294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/zernio-sdk/models/platform_target.rb', line 294

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      platform == o.platform &&
       == o. &&
      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 &&
      error_message == o.error_message &&
      error_category == o.error_category &&
      error_source == o.error_source &&
      platform_error == o.platform_error
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object) —

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


318
319
320
# File 'lib/zernio-sdk/models/platform_target.rb', line 318

def eql?(o)
  self == o
end

#hash ⇒ Integer

Calculates hash code according to all attributes.

Returns:

  • (Integer) —

    Hash code



324
325
326
# File 'lib/zernio-sdk/models/platform_target.rb', line 324

def hash
  [platform, , 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_message, error_category, error_source, platform_error].hash
end

#list_invalid_properties ⇒ Object

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

Returns:

  • Array for valid properties with the reasons



243
244
245
246
247
# File 'lib/zernio-sdk/models/platform_target.rb', line 243

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

Returns:

  • (Hash) —

    Returns the object in the form of hash



353
354
355
356
357
358
359
360
361
362
363
364
365
# File 'lib/zernio-sdk/models/platform_target.rb', line 353

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



251
252
253
254
255
256
257
258
259
260
# File 'lib/zernio-sdk/models/platform_target.rb', line 251

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