Class: StickyIoRestfulApiV2025731::DataCreateProductCouponProfile

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

Overview

DataCreateProductCouponProfile 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:, type_id:, name:, description:, use_count:, discount_amt:, discount_pct:, minimum_purchase:, is_lifetime:, product_id:, variant_id:, min_qty:, max_qty:, is_bogo:, discount_amount:, discount_percent:, minimum_quantity:, maximum_quantity:, is_active:, created_at:, updated_at:, expires_at:, is_free_shipping:, promo_code_count:, limits:, creator:, updator:, additional_properties: nil) ⇒ DataCreateProductCouponProfile

Returns a new instance of DataCreateProductCouponProfile.



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

def initialize(id:, type_id:, name:, description:, use_count:,
               discount_amt:, discount_pct:, minimum_purchase:,
               is_lifetime:, product_id:, variant_id:, min_qty:, max_qty:,
               is_bogo:, discount_amount:, discount_percent:,
               minimum_quantity:, maximum_quantity:, is_active:,
               created_at:, updated_at:, expires_at:, is_free_shipping:,
               promo_code_count:, limits:, creator:, updator:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id = id
  @type_id = type_id
  @name = name
  @description = description
  @use_count = use_count
  @discount_amt = discount_amt
  @discount_pct = discount_pct
  @minimum_purchase = minimum_purchase
  @is_lifetime = is_lifetime
  @product_id = product_id
  @variant_id = variant_id
  @min_qty = min_qty
  @max_qty = max_qty
  @is_bogo = is_bogo
  @discount_amount = discount_amount
  @discount_percent = discount_percent
  @minimum_quantity = minimum_quantity
  @maximum_quantity = maximum_quantity
  @is_active = is_active
  @created_at = created_at
  @updated_at = updated_at
  @expires_at = expires_at
  @is_free_shipping = is_free_shipping
  @promo_code_count = promo_code_count
  @limits = limits
  @creator = creator
  @updator = updator
  @additional_properties = additional_properties
end

Instance Attribute Details

#created_atCreatedAt

TODO: Write general description for this method

Returns:



90
91
92
# File 'lib/sticky_io_restful_api_v2025731/models/data_create_product_coupon_profile.rb', line 90

def created_at
  @created_at
end

#creatorCreatorData1

TODO: Write general description for this method

Returns:



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

def creator
  @creator
end

#descriptionString

TODO: Write general description for this method

Returns:

  • (String)


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

def description
  @description
end

#discount_amountString

TODO: Write general description for this method

Returns:

  • (String)


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

def discount_amount
  @discount_amount
end

#discount_amtString

TODO: Write general description for this method

Returns:

  • (String)


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

def discount_amt
  @discount_amt
end

#discount_pctString

TODO: Write general description for this method

Returns:

  • (String)


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

def discount_pct
  @discount_pct
end

#discount_percentString

TODO: Write general description for this method

Returns:

  • (String)


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

def discount_percent
  @discount_percent
end

#expires_atExpiresAt

TODO: Write general description for this method

Returns:



98
99
100
# File 'lib/sticky_io_restful_api_v2025731/models/data_create_product_coupon_profile.rb', line 98

def expires_at
  @expires_at
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def id
  @id
end

#is_activeInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def is_active
  @is_active
end

#is_bogoInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def is_bogo
  @is_bogo
end

#is_free_shippingInteger

TODO: Write general description for this method

Returns:

  • (Integer)


102
103
104
# File 'lib/sticky_io_restful_api_v2025731/models/data_create_product_coupon_profile.rb', line 102

def is_free_shipping
  @is_free_shipping
end

#is_lifetimeInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def is_lifetime
  @is_lifetime
end

#limitsLimitsData

TODO: Write general description for this method

Returns:



110
111
112
# File 'lib/sticky_io_restful_api_v2025731/models/data_create_product_coupon_profile.rb', line 110

def limits
  @limits
end

#max_qtyInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def max_qty
  @max_qty
end

#maximum_quantityInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def maximum_quantity
  @maximum_quantity
end

#min_qtyInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def min_qty
  @min_qty
end

#minimum_purchaseString

TODO: Write general description for this method

Returns:

  • (String)


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

def minimum_purchase
  @minimum_purchase
end

#minimum_quantityInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def minimum_quantity
  @minimum_quantity
end

#nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def name
  @name
end

#product_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def product_id
  @product_id
end

#promo_code_countInteger

TODO: Write general description for this method

Returns:

  • (Integer)


106
107
108
# File 'lib/sticky_io_restful_api_v2025731/models/data_create_product_coupon_profile.rb', line 106

def promo_code_count
  @promo_code_count
end

#type_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def type_id
  @type_id
end

#updated_atUpdatedAtData

TODO: Write general description for this method

Returns:



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

def updated_at
  @updated_at
end

#updatorUpdatorData2

TODO: Write general description for this method

Returns:



118
119
120
# File 'lib/sticky_io_restful_api_v2025731/models/data_create_product_coupon_profile.rb', line 118

def updator
  @updator
end

#use_countInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def use_count
  @use_count
end

#variant_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def variant_id
  @variant_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : nil
  type_id = hash.key?('type_id') ? hash['type_id'] : nil
  name = hash.key?('name') ? hash['name'] : nil
  description = hash.key?('description') ? hash['description'] : nil
  use_count = hash.key?('use_count') ? hash['use_count'] : nil
  discount_amt = hash.key?('discount_amt') ? hash['discount_amt'] : nil
  discount_pct = hash.key?('discount_pct') ? hash['discount_pct'] : nil
  minimum_purchase =
    hash.key?('minimum_purchase') ? hash['minimum_purchase'] : nil
  is_lifetime = hash.key?('is_lifetime') ? hash['is_lifetime'] : nil
  product_id = hash.key?('product_id') ? hash['product_id'] : nil
  variant_id = hash.key?('variant_id') ? hash['variant_id'] : nil
  min_qty = hash.key?('min_qty') ? hash['min_qty'] : nil
  max_qty = hash.key?('max_qty') ? hash['max_qty'] : nil
  is_bogo = hash.key?('is_bogo') ? hash['is_bogo'] : nil
  discount_amount =
    hash.key?('discount_amount') ? hash['discount_amount'] : nil
  discount_percent =
    hash.key?('discount_percent') ? hash['discount_percent'] : nil
  minimum_quantity =
    hash.key?('minimum_quantity') ? hash['minimum_quantity'] : nil
  maximum_quantity =
    hash.key?('maximum_quantity') ? hash['maximum_quantity'] : nil
  is_active = hash.key?('is_active') ? hash['is_active'] : 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']
  expires_at = ExpiresAt.from_hash(hash['expires_at']) if hash['expires_at']
  is_free_shipping =
    hash.key?('is_free_shipping') ? hash['is_free_shipping'] : nil
  promo_code_count =
    hash.key?('promo_code_count') ? hash['promo_code_count'] : nil
  limits = LimitsData.from_hash(hash['limits']) if hash['limits']
  creator = CreatorData1.from_hash(hash['creator']) if hash['creator']
  updator = UpdatorData2.from_hash(hash['updator']) if hash['updator']

  # 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.
  DataCreateProductCouponProfile.new(id: id,
                                     type_id: type_id,
                                     name: name,
                                     description: description,
                                     use_count: use_count,
                                     discount_amt: discount_amt,
                                     discount_pct: discount_pct,
                                     minimum_purchase: minimum_purchase,
                                     is_lifetime: is_lifetime,
                                     product_id: product_id,
                                     variant_id: variant_id,
                                     min_qty: min_qty,
                                     max_qty: max_qty,
                                     is_bogo: is_bogo,
                                     discount_amount: discount_amount,
                                     discount_percent: discount_percent,
                                     minimum_quantity: minimum_quantity,
                                     maximum_quantity: maximum_quantity,
                                     is_active: is_active,
                                     created_at: created_at,
                                     updated_at: updated_at,
                                     expires_at: expires_at,
                                     is_free_shipping: is_free_shipping,
                                     promo_code_count: promo_code_count,
                                     limits: limits,
                                     creator: creator,
                                     updator: updator,
                                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['type_id'] = 'type_id'
  @_hash['name'] = 'name'
  @_hash['description'] = 'description'
  @_hash['use_count'] = 'use_count'
  @_hash['discount_amt'] = 'discount_amt'
  @_hash['discount_pct'] = 'discount_pct'
  @_hash['minimum_purchase'] = 'minimum_purchase'
  @_hash['is_lifetime'] = 'is_lifetime'
  @_hash['product_id'] = 'product_id'
  @_hash['variant_id'] = 'variant_id'
  @_hash['min_qty'] = 'min_qty'
  @_hash['max_qty'] = 'max_qty'
  @_hash['is_bogo'] = 'is_bogo'
  @_hash['discount_amount'] = 'discount_amount'
  @_hash['discount_percent'] = 'discount_percent'
  @_hash['minimum_quantity'] = 'minimum_quantity'
  @_hash['maximum_quantity'] = 'maximum_quantity'
  @_hash['is_active'] = 'is_active'
  @_hash['created_at'] = 'created_at'
  @_hash['updated_at'] = 'updated_at'
  @_hash['expires_at'] = 'expires_at'
  @_hash['is_free_shipping'] = 'is_free_shipping'
  @_hash['promo_code_count'] = 'promo_code_count'
  @_hash['limits'] = 'limits'
  @_hash['creator'] = 'creator'
  @_hash['updator'] = 'updator'
  @_hash
end

.nullablesObject

An array for nullable fields



159
160
161
# File 'lib/sticky_io_restful_api_v2025731/models/data_create_product_coupon_profile.rb', line 159

def self.nullables
  []
end

.optionalsObject

An array for optional fields



154
155
156
# File 'lib/sticky_io_restful_api_v2025731/models/data_create_product_coupon_profile.rb', line 154

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/sticky_io_restful_api_v2025731/models/data_create_product_coupon_profile.rb', line 298

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, type_id: #{@type_id.inspect}, name: #{@name.inspect},"\
  " description: #{@description.inspect}, use_count: #{@use_count.inspect}, discount_amt:"\
  " #{@discount_amt.inspect}, discount_pct: #{@discount_pct.inspect}, minimum_purchase:"\
  " #{@minimum_purchase.inspect}, is_lifetime: #{@is_lifetime.inspect}, product_id:"\
  " #{@product_id.inspect}, variant_id: #{@variant_id.inspect}, min_qty: #{@min_qty.inspect},"\
  " max_qty: #{@max_qty.inspect}, is_bogo: #{@is_bogo.inspect}, discount_amount:"\
  " #{@discount_amount.inspect}, discount_percent: #{@discount_percent.inspect},"\
  " minimum_quantity: #{@minimum_quantity.inspect}, maximum_quantity:"\
  " #{@maximum_quantity.inspect}, is_active: #{@is_active.inspect}, created_at:"\
  " #{@created_at.inspect}, updated_at: #{@updated_at.inspect}, expires_at:"\
  " #{@expires_at.inspect}, is_free_shipping: #{@is_free_shipping.inspect}, promo_code_count:"\
  " #{@promo_code_count.inspect}, limits: #{@limits.inspect}, creator: #{@creator.inspect},"\
  " updator: #{@updator.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/sticky_io_restful_api_v2025731/models/data_create_product_coupon_profile.rb', line 283

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, type_id: #{@type_id}, name: #{@name}, description:"\
  " #{@description}, use_count: #{@use_count}, discount_amt: #{@discount_amt}, discount_pct:"\
  " #{@discount_pct}, minimum_purchase: #{@minimum_purchase}, is_lifetime: #{@is_lifetime},"\
  " product_id: #{@product_id}, variant_id: #{@variant_id}, min_qty: #{@min_qty}, max_qty:"\
  " #{@max_qty}, is_bogo: #{@is_bogo}, discount_amount: #{@discount_amount}, discount_percent:"\
  " #{@discount_percent}, minimum_quantity: #{@minimum_quantity}, maximum_quantity:"\
  " #{@maximum_quantity}, is_active: #{@is_active}, created_at: #{@created_at}, updated_at:"\
  " #{@updated_at}, expires_at: #{@expires_at}, is_free_shipping: #{@is_free_shipping},"\
  " promo_code_count: #{@promo_code_count}, limits: #{@limits}, creator: #{@creator}, updator:"\
  " #{@updator}, additional_properties: #{@additional_properties}>"
end