Class: StickyIoRestfulApiV2025731::DataCreateSeasonalOffer

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

Overview

DataCreateSeasonalOffer 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:, 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:, additional_properties: nil) ⇒ DataCreateSeasonalOffer

Returns a new instance of DataCreateSeasonalOffer.



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

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:,
               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
  @additional_properties = additional_properties
end

Instance Attribute Details

#billing_modelsArray[BillingModelData5]

TODO: Write general description for this method

Returns:



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

def billing_models
  @billing_models
end

#created_atCreatedAt

TODO: Write general description for this method

Returns:



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

def created_at
  @created_at
end

#cycle_productsString

TODO: Write general description for this method

Returns:

  • (String)


78
79
80
# File 'lib/sticky_io_restful_api_v2025731/models/data_create_seasonal_offer.rb', line 78

def cycle_products
  @cycle_products
end

#cycle_typeCycleType

TODO: Write general description for this method

Returns:



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

def cycle_type
  @cycle_type
end

#cycle_type_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def cycle_type_id
  @cycle_type_id
end

#expire_cyclesInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def expire_cycles
  @expire_cycles
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def id
  @id
end

#is_archivedInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def is_archived
  @is_archived
end

#is_prepaidInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def is_prepaid
  @is_prepaid
end

#is_seasonalInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def is_seasonal
  @is_seasonal
end

#is_trialInteger

TODO: Write general description for this method

Returns:

  • (Integer)


86
87
88
# File 'lib/sticky_io_restful_api_v2025731/models/data_create_seasonal_offer.rb', line 86

def is_trial
  @is_trial
end

#nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def name
  @name
end

#prepaid_profileString

TODO: Write general description for this method

Returns:

  • (String)


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

def prepaid_profile
  @prepaid_profile
end

#productsArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def products
  @products
end

#seasonal_productsArray[SeasonalProduct]

TODO: Write general description for this method

Returns:



82
83
84
# File 'lib/sticky_io_restful_api_v2025731/models/data_create_seasonal_offer.rb', line 82

def seasonal_products
  @seasonal_products
end

#terminating_cycle_typeTerminatingCycleType

TODO: Write general description for this method



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

def terminating_cycle_type
  @terminating_cycle_type
end

#trialArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


74
75
76
# File 'lib/sticky_io_restful_api_v2025731/models/data_create_seasonal_offer.rb', line 74

def trial
  @trial
end

#typeTypeData

TODO: Write general description for this method

Returns:



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

def type
  @type
end

#updated_atUpdatedAtData

TODO: Write general description for this method

Returns:



38
39
40
# File 'lib/sticky_io_restful_api_v2025731/models/data_create_seasonal_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.



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

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 = UpdatedAtData.from_hash(hash['updated_at']) if hash['updated_at']
  is_archived = hash.key?('is_archived') ? hash['is_archived'] : nil
  products = hash.key?('products') ? hash['products'] : nil
  # 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 << (BillingModelData5.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 = TypeData.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') ? hash['prepaid_profile'] : nil
  trial = hash.key?('trial') ? hash['trial'] : nil
  cycle_products =
    hash.key?('cycle_products') ? hash['cycle_products'] : nil
  # Parameter is an array, so we need to iterate through it
  seasonal_products = nil
  unless hash['seasonal_products'].nil?
    seasonal_products = []
    hash['seasonal_products'].each do |structure|
      seasonal_products << (SeasonalProduct.from_hash(structure) if structure)
    end
  end

  seasonal_products = nil unless hash.key?('seasonal_products')
  is_trial = hash.key?('is_trial') ? hash['is_trial'] : 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.
  DataCreateSeasonalOffer.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,
                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/sticky_io_restful_api_v2025731/models/data_create_seasonal_offer.rb', line 89

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
end

.nullablesObject

An array for nullable fields



119
120
121
122
123
124
# File 'lib/sticky_io_restful_api_v2025731/models/data_create_seasonal_offer.rb', line 119

def self.nullables
  %w[
    prepaid_profile
    cycle_products
  ]
end

.optionalsObject

An array for optional fields



114
115
116
# File 'lib/sticky_io_restful_api_v2025731/models/data_create_seasonal_offer.rb', line 114

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/sticky_io_restful_api_v2025731/models/data_create_seasonal_offer.rb', line 247

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}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



234
235
236
237
238
239
240
241
242
243
244
# File 'lib/sticky_io_restful_api_v2025731/models/data_create_seasonal_offer.rb', line 234

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},"\
  " additional_properties: #{@additional_properties}>"
end