Class: SparteraApiSdk::Posts
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- SparteraApiSdk::Posts
- Defined in:
- lib/spartera_api_sdk/models/posts.rb
Overview
An AI-generated article or post created by the Spartera Post Generator
Instance Attribute Summary collapse
-
#category ⇒ Object
Article category (e.g., ‘Sports’, ‘Business’).
-
#company_id ⇒ Object
Company this post belongs to.
-
#content_html ⇒ Object
Generated article HTML content.
-
#data_cost_credits ⇒ Object
Cost in credits for data insights.
-
#date_created ⇒ Object
Optional.
-
#failed_insights_count ⇒ Object
Number of insights that failed.
-
#generation_creativity ⇒ Object
Creativity level (0-100), maps to AI temperature.
-
#generation_include_citations ⇒ Object
Whether to include data source citations.
-
#generation_subheading_count ⇒ Object
Number of subheadings (2-5).
-
#generation_target_word_count ⇒ Object
Target word count (null = auto).
-
#generation_temperature ⇒ Object
Actual temperature used for generation (0.0-2.0).
-
#generation_time_ms ⇒ Object
Time taken to generate article in milliseconds.
-
#generation_tone ⇒ Object
Writing tone: professional, casual, technical, conversational.
-
#insights_used ⇒ Object
Array of insights used: [asset_name, value, runtime, success].
-
#is_published ⇒ Object
Whether this post has been published.
-
#last_edited_at ⇒ Object
When this post was last edited.
-
#last_updated ⇒ Object
Optional.
-
#post_id ⇒ Object
Unique identifier.
-
#published_at ⇒ Object
When this post was published.
-
#service_cost_credits ⇒ Object
Cost in credits for AI generation service.
-
#successful_insights_count ⇒ Object
Number of insights that succeeded.
-
#teaser ⇒ Object
Article teaser/subtitle.
-
#title ⇒ Object
Article title.
-
#total_cost_credits ⇒ Object
Total cost in credits (data + service).
-
#user_id ⇒ Object
User who created this post.
-
#view_count ⇒ Object
Number of times this post has been viewed.
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 = {}) ⇒ Posts
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 = {}) ⇒ Posts
Initializes the object
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 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 179 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `SparteraApiSdk::Posts` 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 `SparteraApiSdk::Posts`. 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?(:'date_created') self.date_created = attributes[:'date_created'] end if attributes.key?(:'last_updated') self.last_updated = attributes[:'last_updated'] end if attributes.key?(:'post_id') self.post_id = attributes[:'post_id'] end if attributes.key?(:'user_id') self.user_id = attributes[:'user_id'] else self.user_id = nil end if attributes.key?(:'company_id') self.company_id = attributes[:'company_id'] else self.company_id = nil end if attributes.key?(:'title') self.title = attributes[:'title'] else self.title = nil end if attributes.key?(:'category') self.category = attributes[:'category'] end if attributes.key?(:'teaser') self. = attributes[:'teaser'] end if attributes.key?(:'content_html') self.content_html = attributes[:'content_html'] else self.content_html = nil end if attributes.key?(:'insights_used') self.insights_used = attributes[:'insights_used'] end if attributes.key?(:'generation_creativity') self.generation_creativity = attributes[:'generation_creativity'] end if attributes.key?(:'generation_target_word_count') self.generation_target_word_count = attributes[:'generation_target_word_count'] end if attributes.key?(:'generation_tone') self.generation_tone = attributes[:'generation_tone'] end if attributes.key?(:'generation_include_citations') self.generation_include_citations = attributes[:'generation_include_citations'] end if attributes.key?(:'generation_subheading_count') self.generation_subheading_count = attributes[:'generation_subheading_count'] end if attributes.key?(:'generation_temperature') self.generation_temperature = attributes[:'generation_temperature'] end if attributes.key?(:'data_cost_credits') self.data_cost_credits = attributes[:'data_cost_credits'] else self.data_cost_credits = nil end if attributes.key?(:'service_cost_credits') self.service_cost_credits = attributes[:'service_cost_credits'] else self.service_cost_credits = nil end if attributes.key?(:'total_cost_credits') self.total_cost_credits = attributes[:'total_cost_credits'] else self.total_cost_credits = nil end if attributes.key?(:'successful_insights_count') self.successful_insights_count = attributes[:'successful_insights_count'] else self.successful_insights_count = nil end if attributes.key?(:'failed_insights_count') self.failed_insights_count = attributes[:'failed_insights_count'] else self.failed_insights_count = nil end if attributes.key?(:'generation_time_ms') self.generation_time_ms = attributes[:'generation_time_ms'] end if attributes.key?(:'is_published') self.is_published = attributes[:'is_published'] else self.is_published = nil end if attributes.key?(:'published_at') self.published_at = attributes[:'published_at'] end if attributes.key?(:'view_count') self.view_count = attributes[:'view_count'] else self.view_count = nil end if attributes.key?(:'last_edited_at') self.last_edited_at = attributes[:'last_edited_at'] end end |
Instance Attribute Details
#category ⇒ Object
Article category (e.g., ‘Sports’, ‘Business’)
38 39 40 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 38 def category @category end |
#company_id ⇒ Object
Company this post belongs to
32 33 34 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 32 def company_id @company_id end |
#content_html ⇒ Object
Generated article HTML content
44 45 46 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 44 def content_html @content_html end |
#data_cost_credits ⇒ Object
Cost in credits for data insights
68 69 70 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 68 def data_cost_credits @data_cost_credits end |
#date_created ⇒ Object
Optional.
20 21 22 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 20 def date_created @date_created end |
#failed_insights_count ⇒ Object
Number of insights that failed
80 81 82 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 80 def failed_insights_count @failed_insights_count end |
#generation_creativity ⇒ Object
Creativity level (0-100), maps to AI temperature
50 51 52 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 50 def generation_creativity @generation_creativity end |
#generation_include_citations ⇒ Object
Whether to include data source citations
59 60 61 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 59 def generation_include_citations @generation_include_citations end |
#generation_subheading_count ⇒ Object
Number of subheadings (2-5)
62 63 64 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 62 def generation_subheading_count @generation_subheading_count end |
#generation_target_word_count ⇒ Object
Target word count (null = auto)
53 54 55 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 53 def generation_target_word_count @generation_target_word_count end |
#generation_temperature ⇒ Object
Actual temperature used for generation (0.0-2.0)
65 66 67 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 65 def generation_temperature @generation_temperature end |
#generation_time_ms ⇒ Object
Time taken to generate article in milliseconds
83 84 85 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 83 def generation_time_ms @generation_time_ms end |
#generation_tone ⇒ Object
Writing tone: professional, casual, technical, conversational
56 57 58 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 56 def generation_tone @generation_tone end |
#insights_used ⇒ Object
Array of insights used: [asset_name, value, runtime, success]
47 48 49 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 47 def insights_used @insights_used end |
#is_published ⇒ Object
Whether this post has been published
86 87 88 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 86 def is_published @is_published end |
#last_edited_at ⇒ Object
When this post was last edited
95 96 97 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 95 def last_edited_at @last_edited_at end |
#last_updated ⇒ Object
Optional.
23 24 25 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 23 def last_updated @last_updated end |
#post_id ⇒ Object
Unique identifier.
26 27 28 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 26 def post_id @post_id end |
#published_at ⇒ Object
When this post was published
89 90 91 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 89 def published_at @published_at end |
#service_cost_credits ⇒ Object
Cost in credits for AI generation service
71 72 73 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 71 def service_cost_credits @service_cost_credits end |
#successful_insights_count ⇒ Object
Number of insights that succeeded
77 78 79 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 77 def successful_insights_count @successful_insights_count end |
#teaser ⇒ Object
Article teaser/subtitle
41 42 43 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 41 def @teaser end |
#title ⇒ Object
Article title
35 36 37 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 35 def title @title end |
#total_cost_credits ⇒ Object
Total cost in credits (data + service)
74 75 76 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 74 def total_cost_credits @total_cost_credits end |
#user_id ⇒ Object
User who created this post
29 30 31 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 29 def user_id @user_id end |
#view_count ⇒ Object
Number of times this post has been viewed
92 93 94 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 92 def view_count @view_count end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
130 131 132 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 130 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
135 136 137 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 135 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 98 def self.attribute_map { :'date_created' => :'date_created', :'last_updated' => :'last_updated', :'post_id' => :'post_id', :'user_id' => :'user_id', :'company_id' => :'company_id', :'title' => :'title', :'category' => :'category', :'teaser' => :'teaser', :'content_html' => :'content_html', :'insights_used' => :'insights_used', :'generation_creativity' => :'generation_creativity', :'generation_target_word_count' => :'generation_target_word_count', :'generation_tone' => :'generation_tone', :'generation_include_citations' => :'generation_include_citations', :'generation_subheading_count' => :'generation_subheading_count', :'generation_temperature' => :'generation_temperature', :'data_cost_credits' => :'data_cost_credits', :'service_cost_credits' => :'service_cost_credits', :'total_cost_credits' => :'total_cost_credits', :'successful_insights_count' => :'successful_insights_count', :'failed_insights_count' => :'failed_insights_count', :'generation_time_ms' => :'generation_time_ms', :'is_published' => :'is_published', :'published_at' => :'published_at', :'view_count' => :'view_count', :'last_edited_at' => :'last_edited_at' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 548 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
172 173 174 175 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 172 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
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 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 140 def self.openapi_types { :'date_created' => :'Time', :'last_updated' => :'Time', :'post_id' => :'String', :'user_id' => :'String', :'company_id' => :'String', :'title' => :'String', :'category' => :'String', :'teaser' => :'String', :'content_html' => :'String', :'insights_used' => :'Object', :'generation_creativity' => :'Integer', :'generation_target_word_count' => :'Integer', :'generation_tone' => :'String', :'generation_include_citations' => :'Boolean', :'generation_subheading_count' => :'Integer', :'generation_temperature' => :'Float', :'data_cost_credits' => :'Integer', :'service_cost_credits' => :'Integer', :'total_cost_credits' => :'Integer', :'successful_insights_count' => :'Integer', :'failed_insights_count' => :'Integer', :'generation_time_ms' => :'Integer', :'is_published' => :'Boolean', :'published_at' => :'Time', :'view_count' => :'Integer', :'last_edited_at' => :'Time' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 502 def ==(o) return true if self.equal?(o) self.class == o.class && date_created == o.date_created && last_updated == o.last_updated && post_id == o.post_id && user_id == o.user_id && company_id == o.company_id && title == o.title && category == o.category && == o. && content_html == o.content_html && insights_used == o.insights_used && generation_creativity == o.generation_creativity && generation_target_word_count == o.generation_target_word_count && generation_tone == o.generation_tone && generation_include_citations == o.generation_include_citations && generation_subheading_count == o.generation_subheading_count && generation_temperature == o.generation_temperature && data_cost_credits == o.data_cost_credits && service_cost_credits == o.service_cost_credits && total_cost_credits == o.total_cost_credits && successful_insights_count == o.successful_insights_count && failed_insights_count == o.failed_insights_count && generation_time_ms == o.generation_time_ms && is_published == o.is_published && published_at == o.published_at && view_count == o.view_count && last_edited_at == o.last_edited_at end |
#eql?(o) ⇒ Boolean
535 536 537 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 535 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
541 542 543 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 541 def hash [date_created, last_updated, post_id, user_id, company_id, title, category, , content_html, insights_used, generation_creativity, generation_target_word_count, generation_tone, generation_include_citations, generation_subheading_count, generation_temperature, data_cost_credits, service_cost_credits, total_cost_credits, successful_insights_count, failed_insights_count, generation_time_ms, is_published, published_at, view_count, last_edited_at].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 322 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @user_id.nil? invalid_properties.push('invalid value for "user_id", user_id cannot be nil.') end if @company_id.nil? invalid_properties.push('invalid value for "company_id", company_id cannot be nil.') end if @title.nil? invalid_properties.push('invalid value for "title", title cannot be nil.') end if @content_html.nil? invalid_properties.push('invalid value for "content_html", content_html cannot be nil.') end if @data_cost_credits.nil? invalid_properties.push('invalid value for "data_cost_credits", data_cost_credits cannot be nil.') end if @service_cost_credits.nil? invalid_properties.push('invalid value for "service_cost_credits", service_cost_credits cannot be nil.') end if @total_cost_credits.nil? invalid_properties.push('invalid value for "total_cost_credits", total_cost_credits cannot be nil.') end if @successful_insights_count.nil? invalid_properties.push('invalid value for "successful_insights_count", successful_insights_count cannot be nil.') end if @failed_insights_count.nil? invalid_properties.push('invalid value for "failed_insights_count", failed_insights_count cannot be nil.') end if @is_published.nil? invalid_properties.push('invalid value for "is_published", is_published cannot be nil.') end if @view_count.nil? invalid_properties.push('invalid value for "view_count", view_count cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
570 571 572 573 574 575 576 577 578 579 580 581 582 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 570 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
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 |
# File 'lib/spartera_api_sdk/models/posts.rb', line 374 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @user_id.nil? return false if @company_id.nil? return false if @title.nil? return false if @content_html.nil? return false if @data_cost_credits.nil? return false if @service_cost_credits.nil? return false if @total_cost_credits.nil? return false if @successful_insights_count.nil? return false if @failed_insights_count.nil? return false if @is_published.nil? return false if @view_count.nil? true end |