Class: Zernio::TwitterPlatformData
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Zernio::TwitterPlatformData
- Defined in:
- lib/zernio-sdk/models/twitter_platform_data.rb
Overview
X-specific post options. The article field creates a long-form X Article and is mutually exclusive with tweet media and tweet-only options. Geo-restriction applies at the media level: media is hidden outside the specified countries while tweet text remains visible.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#article ⇒ Object
Returns the value of attribute article.
-
#geo_restriction ⇒ Object
Returns the value of attribute geo_restriction.
-
#long_video ⇒ Object
Enable long video uploads (over 140 seconds) using amplify_video media category.
-
#made_with_ai ⇒ Object
When true, the post is labeled by X as containing AI-generated media.
-
#paid_partnership ⇒ Object
When true, the post is labeled by X as a paid partnership / paid promotion.
-
#poll ⇒ Object
Returns the value of attribute poll.
-
#quote_tweet_id ⇒ Object
ID (or full status URL) of an existing tweet to quote-repost.
-
#reply_settings ⇒ Object
Controls who can reply to the tweet.
-
#reply_to_tweet_id ⇒ Object
ID of an existing tweet to reply to.
-
#sensitive_media ⇒ Object
Returns the value of attribute sensitive_media.
-
#thread_items ⇒ Object
Complete sequence of tweets in a thread.
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 = {}) ⇒ TwitterPlatformData
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 = {}) ⇒ TwitterPlatformData
Initializes the object
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 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 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 122 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::TwitterPlatformData` 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::TwitterPlatformData`. 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?(:'article') self.article = attributes[:'article'] end if attributes.key?(:'reply_to_tweet_id') self.reply_to_tweet_id = attributes[:'reply_to_tweet_id'] end if attributes.key?(:'quote_tweet_id') self.quote_tweet_id = attributes[:'quote_tweet_id'] end if attributes.key?(:'reply_settings') self.reply_settings = attributes[:'reply_settings'] end if attributes.key?(:'thread_items') if (value = attributes[:'thread_items']).is_a?(Array) self.thread_items = value end end if attributes.key?(:'poll') self.poll = attributes[:'poll'] end if attributes.key?(:'long_video') self.long_video = attributes[:'long_video'] else self.long_video = false end if attributes.key?(:'geo_restriction') self.geo_restriction = attributes[:'geo_restriction'] end if attributes.key?(:'paid_partnership') self.paid_partnership = attributes[:'paid_partnership'] else self.paid_partnership = false end if attributes.key?(:'made_with_ai') self.made_with_ai = attributes[:'made_with_ai'] else self.made_with_ai = false end if attributes.key?(:'sensitive_media') self.sensitive_media = attributes[:'sensitive_media'] end end |
Instance Attribute Details
#article ⇒ Object
Returns the value of attribute article.
19 20 21 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 19 def article @article end |
#geo_restriction ⇒ Object
Returns the value of attribute geo_restriction.
38 39 40 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 38 def geo_restriction @geo_restriction end |
#long_video ⇒ Object
Enable long video uploads (over 140 seconds) using amplify_video media category. Requires the connected X account to have an active X Premium subscription. When true, videos are uploaded with the amplify_video category which supports longer durations (up to 10 minutes via API). When false or omitted, the standard tweet_video category is used (140 second limit). Note that not all Premium accounts have API long-video access, as X may require separate allowlisting.
36 37 38 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 36 def long_video @long_video end |
#made_with_ai ⇒ Object
When true, the post is labeled by X as containing AI-generated media. Per X, this label is for AI-generated media, not AI-written text. For threads, applies to the root tweet only.
44 45 46 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 44 def made_with_ai @made_with_ai end |
#paid_partnership ⇒ Object
When true, the post is labeled by X as a paid partnership / paid promotion. For threads, applies to the root tweet only. Field availability may depend on your X API access tier.
41 42 43 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 41 def paid_partnership @paid_partnership end |
#poll ⇒ Object
Returns the value of attribute poll.
33 34 35 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 33 def poll @poll end |
#quote_tweet_id ⇒ Object
ID (or full status URL) of an existing tweet to quote-repost. The published tweet becomes a quote tweet of the target. Mutually exclusive with media and poll. X only permits quoting your own posts or posts you are mentioned in / part of the conversation thread of; quoting an arbitrary other account's post is rejected by X. Billed at the standard create rate ($0.015), unlike pasting a tweet URL into the text which is billed at the URL rate ($0.20). For threads, applies to the first tweet only.
25 26 27 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 25 def quote_tweet_id @quote_tweet_id end |
#reply_settings ⇒ Object
Controls who can reply to the tweet. "following" allows only people you follow, "mentionedUsers" allows only mentioned users, "subscribers" allows only subscribers, "verified" allows only verified users. Omit for default (everyone can reply). For threads, applies to the first tweet only. Cannot be combined with replyToTweetId.
28 29 30 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 28 def reply_settings @reply_settings end |
#reply_to_tweet_id ⇒ Object
ID of an existing tweet to reply to. The published tweet will appear as a reply in that tweet's thread. For threads, only the first tweet replies to the target; subsequent tweets chain normally. X only permits replying to your own posts or posts you are mentioned in; replying to an arbitrary other account's post is rejected by X.
22 23 24 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 22 def reply_to_tweet_id @reply_to_tweet_id end |
#sensitive_media ⇒ Object
Returns the value of attribute sensitive_media.
46 47 48 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 46 def sensitive_media @sensitive_media end |
#thread_items ⇒ Object
Complete sequence of tweets in a thread. The first item becomes the root tweet, subsequent items are chained as replies. When threadItems is provided, the top-level content field is used only for display and search purposes, it is NOT published. You must include your first tweet as threadItems.
31 32 33 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 31 def thread_items @thread_items end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
88 89 90 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 88 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
93 94 95 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 93 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 71 def self.attribute_map { :'article' => :'article', :'reply_to_tweet_id' => :'replyToTweetId', :'quote_tweet_id' => :'quoteTweetId', :'reply_settings' => :'replySettings', :'thread_items' => :'threadItems', :'poll' => :'poll', :'long_video' => :'longVideo', :'geo_restriction' => :'geoRestriction', :'paid_partnership' => :'paidPartnership', :'made_with_ai' => :'madeWithAi', :'sensitive_media' => :'sensitiveMedia' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 249 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
115 116 117 118 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 115 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 98 def self.openapi_types { :'article' => :'XArticle', :'reply_to_tweet_id' => :'String', :'quote_tweet_id' => :'String', :'reply_settings' => :'String', :'thread_items' => :'Array<TwitterPlatformDataThreadItemsInner>', :'poll' => :'TwitterPlatformDataPoll', :'long_video' => :'Boolean', :'geo_restriction' => :'GeoRestriction', :'paid_partnership' => :'Boolean', :'made_with_ai' => :'Boolean', :'sensitive_media' => :'TwitterPlatformDataSensitiveMedia' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 218 def ==(o) return true if self.equal?(o) self.class == o.class && article == o.article && reply_to_tweet_id == o.reply_to_tweet_id && quote_tweet_id == o.quote_tweet_id && reply_settings == o.reply_settings && thread_items == o.thread_items && poll == o.poll && long_video == o.long_video && geo_restriction == o.geo_restriction && paid_partnership == o.paid_partnership && made_with_ai == o.made_with_ai && sensitive_media == o.sensitive_media end |
#eql?(o) ⇒ Boolean
236 237 238 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 236 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
242 243 244 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 242 def hash [article, reply_to_tweet_id, quote_tweet_id, reply_settings, thread_items, poll, long_video, geo_restriction, paid_partnership, made_with_ai, sensitive_media].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
191 192 193 194 195 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 191 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
271 272 273 274 275 276 277 278 279 280 281 282 283 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 271 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
199 200 201 202 203 204 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 199 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' reply_settings_validator = EnumAttributeValidator.new('String', ["following", "mentionedUsers", "subscribers", "verified"]) return false unless reply_settings_validator.valid?(@reply_settings) true end |