Class: Zernio::TwitterPlatformData
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Zernio::TwitterPlatformData
- Defined in:
- lib/zernio-sdk/models/twitter_platform_data.rb
Overview
X (Twitter) geo-restriction applies at the media level. Media in geo-restricted tweets will be hidden for users outside the specified countries; the tweet text itself remains visible globally. Requires media to be attached (ignored for text-only tweets).
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#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
118 119 120 121 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 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 118 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?(:'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
#geo_restriction ⇒ Object
Returns the value of attribute geo_restriction.
36 37 38 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 36 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.
34 35 36 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 34 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.
42 43 44 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 42 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.
39 40 41 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 39 def paid_partnership @paid_partnership end |
#poll ⇒ Object
Returns the value of attribute poll.
31 32 33 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 31 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.
23 24 25 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 23 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.
26 27 28 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 26 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.
20 21 22 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 20 def reply_to_tweet_id @reply_to_tweet_id end |
#sensitive_media ⇒ Object
Returns the value of attribute sensitive_media.
44 45 46 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 44 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.
29 30 31 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 29 def thread_items @thread_items end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
85 86 87 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 85 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
90 91 92 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 90 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 69 def self.attribute_map { :'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
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 240 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
111 112 113 114 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 111 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 95 def self.openapi_types { :'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.
210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 210 def ==(o) return true if self.equal?(o) self.class == o.class && 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
227 228 229 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 227 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
233 234 235 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 233 def hash [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?
183 184 185 186 187 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 183 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
262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 262 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
191 192 193 194 195 196 |
# File 'lib/zernio-sdk/models/twitter_platform_data.rb', line 191 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 |