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



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

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')
    self.platform_specific_data = attributes[:'platform_specific_data']
  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?(:'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
end

Instance Attribute Details

#account_idObject

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_contentObject

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_mediaObject

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_categoryObject

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), system_error (Zernio infra), unknown



55
56
57
# File 'lib/zernio-sdk/models/platform_target.rb', line 55

def error_category
  @error_category
end

#error_messageObject

Human-readable error message when status is failed. Contains platform-specific error details explaining why the publish failed.



52
53
54
# File 'lib/zernio-sdk/models/platform_target.rb', line 52

def error_message
  @error_message
end

#error_sourceObject

Who caused the error: user (fix content/reconnect), platform (outage/API change), system (Zernio issue, rare)



58
59
60
# File 'lib/zernio-sdk/models/platform_target.rb', line 58

def error_source
  @error_source
end

#is_trial_reelObject

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.



46
47
48
# File 'lib/zernio-sdk/models/platform_target.rb', line 46

def is_trial_reel
  @is_trial_reel
end

#platformObject

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_idObject

The native post ID on the platform (populated after successful publish)



37
38
39
# File 'lib/zernio-sdk/models/platform_target.rb', line 37

def platform_post_id
  @platform_post_id
end

#platform_post_urlObject

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.



40
41
42
# File 'lib/zernio-sdk/models/platform_target.rb', line 40

def platform_post_url
  @platform_post_url
end

#platform_specific_dataObject

Returns the value of attribute platform_specific_data.



31
32
33
# File 'lib/zernio-sdk/models/platform_target.rb', line 31

def platform_specific_data
  @platform_specific_data
end

#published_atObject

Timestamp when the post was published to this platform



43
44
45
# File 'lib/zernio-sdk/models/platform_target.rb', line 43

def published_at
  @published_at
end

#scheduled_forObject

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

#statusObject

Platform-specific status: pending, publishing, published, failed



34
35
36
# File 'lib/zernio-sdk/models/platform_target.rb', line 34

def status
  @status
end

#trial_graduation_strategyObject

Graduation strategy the trial reel was launched with. Present only when isTrialReel is true.



49
50
51
# File 'lib/zernio-sdk/models/platform_target.rb', line 49

def trial_graduation_strategy
  @trial_graduation_strategy
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



104
105
106
# File 'lib/zernio-sdk/models/platform_target.rb', line 104

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



109
110
111
# File 'lib/zernio-sdk/models/platform_target.rb', line 109

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/zernio-sdk/models/platform_target.rb', line 83

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',
    :'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

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
# File 'lib/zernio-sdk/models/platform_target.rb', line 307

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_nullableObject

List of attributes with nullable: true



135
136
137
138
# File 'lib/zernio-sdk/models/platform_target.rb', line 135

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/zernio-sdk/models/platform_target.rb', line 114

def self.openapi_types
  {
    :'platform' => :'String',
    :'account_id' => :'PlatformTargetAccountId',
    :'custom_content' => :'String',
    :'custom_media' => :'Array<MediaItem>',
    :'scheduled_for' => :'Time',
    :'platform_specific_data' => :'PlatformTargetPlatformSpecificData',
    :'status' => :'String',
    :'platform_post_id' => :'String',
    :'platform_post_url' => :'String',
    :'published_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.

Parameters:

  • Object (Object)

    to be compared



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/zernio-sdk/models/platform_target.rb', line 272

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 &&
      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
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


294
295
296
# File 'lib/zernio-sdk/models/platform_target.rb', line 294

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



300
301
302
# File 'lib/zernio-sdk/models/platform_target.rb', line 300

def hash
  [platform, , custom_content, custom_media, scheduled_for, platform_specific_data, status, platform_post_id, platform_post_url, published_at, is_trial_reel, trial_graduation_strategy, error_message, error_category, error_source].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



221
222
223
224
225
# File 'lib/zernio-sdk/models/platform_target.rb', line 221

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



329
330
331
332
333
334
335
336
337
338
339
340
341
# File 'lib/zernio-sdk/models/platform_target.rb', line 329

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



229
230
231
232
233
234
235
236
237
238
# File 'lib/zernio-sdk/models/platform_target.rb', line 229

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", "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