Class: StickyIoRestfulApiV2025731::Offer
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- StickyIoRestfulApiV2025731::Offer
- Defined in:
- lib/sticky_io_restful_api_v2025731/models/offer.rb
Overview
Offer Model.
Instance Attribute Summary collapse
-
#billing_models ⇒ Array[BillingModel]
TODO: Write general description for this method.
-
#created_at ⇒ CreatedAt
TODO: Write general description for this method.
-
#cycle_products ⇒ String
TODO: Write general description for this method.
-
#cycle_type ⇒ CycleType
TODO: Write general description for this method.
-
#cycle_type_id ⇒ Integer
TODO: Write general description for this method.
-
#expire_cycles ⇒ Integer
TODO: Write general description for this method.
-
#id ⇒ Integer
TODO: Write general description for this method.
-
#is_archived ⇒ Integer
TODO: Write general description for this method.
-
#is_prepaid ⇒ Integer
TODO: Write general description for this method.
-
#is_seasonal ⇒ Integer
TODO: Write general description for this method.
-
#is_trial ⇒ Integer
TODO: Write general description for this method.
-
#name ⇒ String
TODO: Write general description for this method.
-
#pivot ⇒ Pivot
TODO: Write general description for this method.
-
#prepaid_profile ⇒ Object
TODO: Write general description for this method.
-
#products ⇒ Array[Product]
TODO: Write general description for this method.
-
#seasonal_products ⇒ String
TODO: Write general description for this method.
-
#terminating_cycle_type ⇒ TerminatingCycleType
TODO: Write general description for this method.
-
#trial ⇒ Object
TODO: Write general description for this method.
-
#type ⇒ TypeOffer
TODO: Write general description for this method.
-
#updated_at ⇒ UpdatedAtOffer
TODO: Write general description for this method.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(id:, name:, cycle_type_id:, expire_cycles:, is_seasonal:, created_at:, updated_at:, is_archived:, products:, billing_models:, is_prepaid:, type:, cycle_type:, terminating_cycle_type:, prepaid_profile:, trial:, cycle_products:, seasonal_products:, is_trial:, pivot:, additional_properties: nil) ⇒ Offer
constructor
A new instance of Offer.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(id:, name:, cycle_type_id:, expire_cycles:, is_seasonal:, created_at:, updated_at:, is_archived:, products:, billing_models:, is_prepaid:, type:, cycle_type:, terminating_cycle_type:, prepaid_profile:, trial:, cycle_products:, seasonal_products:, is_trial:, pivot:, additional_properties: nil) ⇒ Offer
Returns a new instance of Offer.
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 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 131 def initialize(id:, name:, cycle_type_id:, expire_cycles:, is_seasonal:, created_at:, updated_at:, is_archived:, products:, billing_models:, is_prepaid:, type:, cycle_type:, terminating_cycle_type:, prepaid_profile:, trial:, cycle_products:, seasonal_products:, is_trial:, pivot:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @id = id @name = name @cycle_type_id = cycle_type_id @expire_cycles = expire_cycles @is_seasonal = is_seasonal @created_at = created_at @updated_at = updated_at @is_archived = is_archived @products = products @billing_models = billing_models @is_prepaid = is_prepaid @type = type @cycle_type = cycle_type @terminating_cycle_type = terminating_cycle_type @prepaid_profile = prepaid_profile @trial = trial @cycle_products = cycle_products @seasonal_products = seasonal_products @is_trial = is_trial @pivot = pivot @additional_properties = additional_properties end |
Instance Attribute Details
#billing_models ⇒ Array[BillingModel]
TODO: Write general description for this method
50 51 52 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 50 def billing_models @billing_models end |
#created_at ⇒ CreatedAt
TODO: Write general description for this method
34 35 36 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 34 def created_at @created_at end |
#cycle_products ⇒ String
TODO: Write general description for this method
78 79 80 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 78 def cycle_products @cycle_products end |
#cycle_type ⇒ CycleType
TODO: Write general description for this method
62 63 64 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 62 def cycle_type @cycle_type end |
#cycle_type_id ⇒ Integer
TODO: Write general description for this method
22 23 24 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 22 def cycle_type_id @cycle_type_id end |
#expire_cycles ⇒ Integer
TODO: Write general description for this method
26 27 28 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 26 def expire_cycles @expire_cycles end |
#id ⇒ Integer
TODO: Write general description for this method
14 15 16 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 14 def id @id end |
#is_archived ⇒ Integer
TODO: Write general description for this method
42 43 44 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 42 def is_archived @is_archived end |
#is_prepaid ⇒ Integer
TODO: Write general description for this method
54 55 56 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 54 def is_prepaid @is_prepaid end |
#is_seasonal ⇒ Integer
TODO: Write general description for this method
30 31 32 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 30 def is_seasonal @is_seasonal end |
#is_trial ⇒ Integer
TODO: Write general description for this method
86 87 88 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 86 def is_trial @is_trial end |
#name ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 18 def name @name end |
#pivot ⇒ Pivot
TODO: Write general description for this method
90 91 92 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 90 def pivot @pivot end |
#prepaid_profile ⇒ Object
TODO: Write general description for this method
70 71 72 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 70 def prepaid_profile @prepaid_profile end |
#products ⇒ Array[Product]
TODO: Write general description for this method
46 47 48 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 46 def products @products end |
#seasonal_products ⇒ String
TODO: Write general description for this method
82 83 84 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 82 def seasonal_products @seasonal_products end |
#terminating_cycle_type ⇒ TerminatingCycleType
TODO: Write general description for this method
66 67 68 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 66 def terminating_cycle_type @terminating_cycle_type end |
#trial ⇒ Object
TODO: Write general description for this method
74 75 76 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 74 def trial @trial end |
#type ⇒ TypeOffer
TODO: Write general description for this method
58 59 60 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 58 def type @type end |
#updated_at ⇒ UpdatedAtOffer
TODO: Write general description for this method
38 39 40 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 38 def updated_at @updated_at end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 240 241 242 243 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 164 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : nil name = hash.key?('name') ? hash['name'] : nil cycle_type_id = hash.key?('cycle_type_id') ? hash['cycle_type_id'] : nil expire_cycles = hash.key?('expire_cycles') ? hash['expire_cycles'] : nil is_seasonal = hash.key?('is_seasonal') ? hash['is_seasonal'] : nil created_at = CreatedAt.from_hash(hash['created_at']) if hash['created_at'] updated_at = UpdatedAtOffer.from_hash(hash['updated_at']) if hash['updated_at'] is_archived = hash.key?('is_archived') ? hash['is_archived'] : nil # Parameter is an array, so we need to iterate through it products = nil unless hash['products'].nil? products = [] hash['products'].each do |structure| products << (Product.from_hash(structure) if structure) end end products = nil unless hash.key?('products') # Parameter is an array, so we need to iterate through it billing_models = nil unless hash['billing_models'].nil? billing_models = [] hash['billing_models'].each do |structure| billing_models << (BillingModel.from_hash(structure) if structure) end end billing_models = nil unless hash.key?('billing_models') is_prepaid = hash.key?('is_prepaid') ? hash['is_prepaid'] : nil type = TypeOffer.from_hash(hash['type']) if hash['type'] cycle_type = CycleType.from_hash(hash['cycle_type']) if hash['cycle_type'] terminating_cycle_type = TerminatingCycleType.from_hash(hash['terminating_cycle_type']) if hash['terminating_cycle_type'] prepaid_profile = hash.key?('prepaid_profile') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:OfferPrepaidProfile), hash['prepaid_profile'] ) : nil trial = hash.key?('trial') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:OfferTrial), hash['trial'] ) : nil cycle_products = hash.key?('cycle_products') ? hash['cycle_products'] : nil seasonal_products = hash.key?('seasonal_products') ? hash['seasonal_products'] : nil is_trial = hash.key?('is_trial') ? hash['is_trial'] : nil pivot = Pivot.from_hash(hash['pivot']) if hash['pivot'] # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. Offer.new(id: id, name: name, cycle_type_id: cycle_type_id, expire_cycles: expire_cycles, is_seasonal: is_seasonal, created_at: created_at, updated_at: updated_at, is_archived: is_archived, products: products, billing_models: billing_models, is_prepaid: is_prepaid, type: type, cycle_type: cycle_type, terminating_cycle_type: terminating_cycle_type, prepaid_profile: prepaid_profile, trial: trial, cycle_products: cycle_products, seasonal_products: seasonal_products, is_trial: is_trial, pivot: pivot, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 93 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['name'] = 'name' @_hash['cycle_type_id'] = 'cycle_type_id' @_hash['expire_cycles'] = 'expire_cycles' @_hash['is_seasonal'] = 'is_seasonal' @_hash['created_at'] = 'created_at' @_hash['updated_at'] = 'updated_at' @_hash['is_archived'] = 'is_archived' @_hash['products'] = 'products' @_hash['billing_models'] = 'billing_models' @_hash['is_prepaid'] = 'is_prepaid' @_hash['type'] = 'type' @_hash['cycle_type'] = 'cycle_type' @_hash['terminating_cycle_type'] = 'terminating_cycle_type' @_hash['prepaid_profile'] = 'prepaid_profile' @_hash['trial'] = 'trial' @_hash['cycle_products'] = 'cycle_products' @_hash['seasonal_products'] = 'seasonal_products' @_hash['is_trial'] = 'is_trial' @_hash['pivot'] = 'pivot' @_hash end |
.nullables ⇒ Object
An array for nullable fields
124 125 126 127 128 129 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 124 def self.nullables %w[ cycle_products seasonal_products ] end |
.optionals ⇒ Object
An array for optional fields
119 120 121 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 119 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
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 319 320 321 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 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 247 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.id, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.name, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.cycle_type_id, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.expire_cycles, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.is_seasonal, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.created_at, ->(val) { CreatedAt.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value.updated_at, ->(val) { UpdatedAtOffer.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value.is_archived, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.products, ->(val) { Product.validate(val) }, is_model_hash: true, is_inner_model_hash: true) and APIHelper.valid_type?(value.billing_models, ->(val) { BillingModel.validate(val) }, is_model_hash: true, is_inner_model_hash: true) and APIHelper.valid_type?(value.is_prepaid, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.type, ->(val) { TypeOffer.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value.cycle_type, ->(val) { CycleType.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value.terminating_cycle_type, ->(val) { TerminatingCycleType.validate(val) }, is_model_hash: true) and UnionTypeLookUp.get(:OfferPrepaidProfile) .validate(value.prepaid_profile) and UnionTypeLookUp.get(:OfferTrial) .validate(value.trial) and APIHelper.valid_type?(value.cycle_products, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.seasonal_products, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.is_trial, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.pivot, ->(val) { Pivot.validate(val) }, is_model_hash: true) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['id'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['name'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['cycle_type_id'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['expire_cycles'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['is_seasonal'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['created_at'], ->(val) { CreatedAt.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value['updated_at'], ->(val) { UpdatedAtOffer.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value['is_archived'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['products'], ->(val) { Product.validate(val) }, is_model_hash: true, is_inner_model_hash: true) and APIHelper.valid_type?(value['billing_models'], ->(val) { BillingModel.validate(val) }, is_model_hash: true, is_inner_model_hash: true) and APIHelper.valid_type?(value['is_prepaid'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['type'], ->(val) { TypeOffer.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value['cycle_type'], ->(val) { CycleType.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value['terminating_cycle_type'], ->(val) { TerminatingCycleType.validate(val) }, is_model_hash: true) and UnionTypeLookUp.get(:OfferPrepaidProfile) .validate(value['prepaid_profile']) and UnionTypeLookUp.get(:OfferTrial) .validate(value['trial']) and APIHelper.valid_type?(value['cycle_products'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['seasonal_products'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['is_trial'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['pivot'], ->(val) { Pivot.validate(val) }, is_model_hash: true) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
373 374 375 376 377 378 379 380 381 382 383 384 385 386 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 373 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}, cycle_type_id:"\ " #{@cycle_type_id.inspect}, expire_cycles: #{@expire_cycles.inspect}, is_seasonal:"\ " #{@is_seasonal.inspect}, created_at: #{@created_at.inspect}, updated_at:"\ " #{@updated_at.inspect}, is_archived: #{@is_archived.inspect}, products:"\ " #{@products.inspect}, billing_models: #{@billing_models.inspect}, is_prepaid:"\ " #{@is_prepaid.inspect}, type: #{@type.inspect}, cycle_type: #{@cycle_type.inspect},"\ " terminating_cycle_type: #{@terminating_cycle_type.inspect}, prepaid_profile:"\ " #{@prepaid_profile.inspect}, trial: #{@trial.inspect}, cycle_products:"\ " #{@cycle_products.inspect}, seasonal_products: #{@seasonal_products.inspect}, is_trial:"\ " #{@is_trial.inspect}, pivot: #{@pivot.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
360 361 362 363 364 365 366 367 368 369 370 |
# File 'lib/sticky_io_restful_api_v2025731/models/offer.rb', line 360 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, name: #{@name}, cycle_type_id: #{@cycle_type_id},"\ " expire_cycles: #{@expire_cycles}, is_seasonal: #{@is_seasonal}, created_at:"\ " #{@created_at}, updated_at: #{@updated_at}, is_archived: #{@is_archived}, products:"\ " #{@products}, billing_models: #{@billing_models}, is_prepaid: #{@is_prepaid}, type:"\ " #{@type}, cycle_type: #{@cycle_type}, terminating_cycle_type: #{@terminating_cycle_type},"\ " prepaid_profile: #{@prepaid_profile}, trial: #{@trial}, cycle_products:"\ " #{@cycle_products}, seasonal_products: #{@seasonal_products}, is_trial: #{@is_trial},"\ " pivot: #{@pivot}, additional_properties: #{@additional_properties}>" end |