Class: StickyIoRestfulApiV2025731::DataGetConfigurations

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/sticky_io_restful_api_v2025731/models/data_get_configurations.rb

Overview

DataGetConfigurations Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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:, default_quantity:, price:, is_upsell:, step_number:, created_by:, updated_by:, created_at:, updated_at:, billing_model:, product:, trial_product:, creator:, updator:, additional_properties: nil) ⇒ DataGetConfigurations

Returns a new instance of DataGetConfigurations.



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_configurations.rb', line 106

def initialize(id:, name:, default_quantity:, price:, is_upsell:,
               step_number:, created_by:, updated_by:, created_at:,
               updated_at:, billing_model:, product:, trial_product:,
               creator:, updator:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id = id
  @name = name
  @default_quantity = default_quantity
  @price = price
  @is_upsell = is_upsell
  @step_number = step_number
  @created_by = created_by
  @updated_by = updated_by
  @created_at = created_at
  @updated_at = updated_at
  @billing_model = billing_model
  @product = product
  @trial_product = trial_product
  @creator = creator
  @updator = updator
  @additional_properties = additional_properties
end

Instance Attribute Details

#billing_modelBillingModelData3

TODO: Write general description for this method

Returns:



54
55
56
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_configurations.rb', line 54

def billing_model
  @billing_model
end

#created_atCreatedAt

TODO: Write general description for this method

Returns:



46
47
48
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_configurations.rb', line 46

def created_at
  @created_at
end

#created_byInteger

TODO: Write general description for this method

Returns:

  • (Integer)


38
39
40
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_configurations.rb', line 38

def created_by
  @created_by
end

#creatorCreator

TODO: Write general description for this method

Returns:



66
67
68
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_configurations.rb', line 66

def creator
  @creator
end

#default_quantityInteger

TODO: Write general description for this method

Returns:

  • (Integer)


22
23
24
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_configurations.rb', line 22

def default_quantity
  @default_quantity
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


14
15
16
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_configurations.rb', line 14

def id
  @id
end

#is_upsellInteger

TODO: Write general description for this method

Returns:

  • (Integer)


30
31
32
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_configurations.rb', line 30

def is_upsell
  @is_upsell
end

#nameString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_configurations.rb', line 18

def name
  @name
end

#priceString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_configurations.rb', line 26

def price
  @price
end

#productProductData2

TODO: Write general description for this method

Returns:



58
59
60
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_configurations.rb', line 58

def product
  @product
end

#step_numberInteger

TODO: Write general description for this method

Returns:

  • (Integer)


34
35
36
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_configurations.rb', line 34

def step_number
  @step_number
end

#trial_productObject

TODO: Write general description for this method

Returns:

  • (Object)


62
63
64
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_configurations.rb', line 62

def trial_product
  @trial_product
end

#updated_atUpdatedAtData

TODO: Write general description for this method

Returns:



50
51
52
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_configurations.rb', line 50

def updated_at
  @updated_at
end

#updated_byString

TODO: Write general description for this method

Returns:

  • (String)


42
43
44
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_configurations.rb', line 42

def updated_by
  @updated_by
end

#updatorString

TODO: Write general description for this method

Returns:

  • (String)


70
71
72
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_configurations.rb', line 70

def updator
  @updator
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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/sticky_io_restful_api_v2025731/models/data_get_configurations.rb', line 132

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
  default_quantity =
    hash.key?('default_quantity') ? hash['default_quantity'] : nil
  price = hash.key?('price') ? hash['price'] : nil
  is_upsell = hash.key?('is_upsell') ? hash['is_upsell'] : nil
  step_number = hash.key?('step_number') ? hash['step_number'] : nil
  created_by = hash.key?('created_by') ? hash['created_by'] : nil
  updated_by = hash.key?('updated_by') ? hash['updated_by'] : nil
  created_at = CreatedAt.from_hash(hash['created_at']) if hash['created_at']
  updated_at = UpdatedAtData.from_hash(hash['updated_at']) if hash['updated_at']
  billing_model = BillingModelData3.from_hash(hash['billing_model']) if hash['billing_model']
  product = ProductData2.from_hash(hash['product']) if hash['product']
  trial_product = hash.key?('trial_product') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:DataGetConfigurationsTrialProduct), hash['trial_product']
  ) : nil
  creator = Creator.from_hash(hash['creator']) if hash['creator']
  updator = hash.key?('updator') ? hash['updator'] : nil

  # 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.
  DataGetConfigurations.new(id: id,
                            name: name,
                            default_quantity: default_quantity,
                            price: price,
                            is_upsell: is_upsell,
                            step_number: step_number,
                            created_by: created_by,
                            updated_by: updated_by,
                            created_at: created_at,
                            updated_at: updated_at,
                            billing_model: billing_model,
                            product: product,
                            trial_product: trial_product,
                            creator: creator,
                            updator: updator,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_configurations.rb', line 73

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['name'] = 'name'
  @_hash['default_quantity'] = 'default_quantity'
  @_hash['price'] = 'price'
  @_hash['is_upsell'] = 'is_upsell'
  @_hash['step_number'] = 'step_number'
  @_hash['created_by'] = 'created_by'
  @_hash['updated_by'] = 'updated_by'
  @_hash['created_at'] = 'created_at'
  @_hash['updated_at'] = 'updated_at'
  @_hash['billing_model'] = 'billing_model'
  @_hash['product'] = 'product'
  @_hash['trial_product'] = 'trial_product'
  @_hash['creator'] = 'creator'
  @_hash['updator'] = 'updator'
  @_hash
end

.nullablesObject

An array for nullable fields



99
100
101
102
103
104
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_configurations.rb', line 99

def self.nullables
  %w[
    updated_by
    updator
  ]
end

.optionalsObject

An array for optional fields



94
95
96
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_configurations.rb', line 94

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



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
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_configurations.rb', line 183

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.default_quantity,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.price,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.is_upsell,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.step_number,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.created_by,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.updated_by,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.created_at,
                              ->(val) { CreatedAt.validate(val) },
                              is_model_hash: true) and
        APIHelper.valid_type?(value.updated_at,
                              ->(val) { UpdatedAtData.validate(val) },
                              is_model_hash: true) and
        APIHelper.valid_type?(value.billing_model,
                              ->(val) { BillingModelData3.validate(val) },
                              is_model_hash: true) and
        APIHelper.valid_type?(value.product,
                              ->(val) { ProductData2.validate(val) },
                              is_model_hash: true) and
        UnionTypeLookUp.get(:DataGetConfigurationsTrialProduct)
                       .validate(value.trial_product) and
        APIHelper.valid_type?(value.creator,
                              ->(val) { Creator.validate(val) },
                              is_model_hash: true) and
        APIHelper.valid_type?(value.updator,
                              ->(val) { val.instance_of? String })
    )
  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['default_quantity'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['price'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['is_upsell'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['step_number'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['created_by'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['updated_by'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['created_at'],
                            ->(val) { CreatedAt.validate(val) },
                            is_model_hash: true) and
      APIHelper.valid_type?(value['updated_at'],
                            ->(val) { UpdatedAtData.validate(val) },
                            is_model_hash: true) and
      APIHelper.valid_type?(value['billing_model'],
                            ->(val) { BillingModelData3.validate(val) },
                            is_model_hash: true) and
      APIHelper.valid_type?(value['product'],
                            ->(val) { ProductData2.validate(val) },
                            is_model_hash: true) and
      UnionTypeLookUp.get(:DataGetConfigurationsTrialProduct)
                     .validate(value['trial_product']) and
      APIHelper.valid_type?(value['creator'],
                            ->(val) { Creator.validate(val) },
                            is_model_hash: true) and
      APIHelper.valid_type?(value['updator'],
                            ->(val) { val.instance_of? String })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



277
278
279
280
281
282
283
284
285
286
287
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_configurations.rb', line 277

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}, default_quantity:"\
  " #{@default_quantity.inspect}, price: #{@price.inspect}, is_upsell: #{@is_upsell.inspect},"\
  " step_number: #{@step_number.inspect}, created_by: #{@created_by.inspect}, updated_by:"\
  " #{@updated_by.inspect}, created_at: #{@created_at.inspect}, updated_at:"\
  " #{@updated_at.inspect}, billing_model: #{@billing_model.inspect}, product:"\
  " #{@product.inspect}, trial_product: #{@trial_product.inspect}, creator:"\
  " #{@creator.inspect}, updator: #{@updator.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



266
267
268
269
270
271
272
273
274
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_configurations.rb', line 266

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, name: #{@name}, default_quantity: #{@default_quantity}, price:"\
  " #{@price}, is_upsell: #{@is_upsell}, step_number: #{@step_number}, created_by:"\
  " #{@created_by}, updated_by: #{@updated_by}, created_at: #{@created_at}, updated_at:"\
  " #{@updated_at}, billing_model: #{@billing_model}, product: #{@product}, trial_product:"\
  " #{@trial_product}, creator: #{@creator}, updator: #{@updator}, additional_properties:"\
  " #{@additional_properties}>"
end