Class: StickyIoRestfulApiV2025731::CouponProfileOneOf0

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

Overview

CouponProfileOneOf0 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: SKIP, name: SKIP, description: SKIP, use_count: SKIP, discount_amt: SKIP, discount_pct: SKIP, minimum_purchase: SKIP, is_lifetime: SKIP, is_active: SKIP, created_at: SKIP, updated_at: SKIP, expires_at: SKIP, is_free_shipping: SKIP, promo_code_count: SKIP, limits: SKIP, creator: SKIP, updator: SKIP, additional_properties: nil) ⇒ CouponProfileOneOf0

Returns a new instance of CouponProfileOneOf0.



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/coupon_profile_one_of0.rb', line 134

def initialize(id: SKIP, name: SKIP, description: SKIP, use_count: SKIP,
               discount_amt: SKIP, discount_pct: SKIP,
               minimum_purchase: SKIP, is_lifetime: SKIP, is_active: SKIP,
               created_at: SKIP, updated_at: SKIP, expires_at: SKIP,
               is_free_shipping: SKIP, promo_code_count: SKIP, limits: SKIP,
               creator: SKIP, updator: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id = id unless id == SKIP
  @name = name unless name == SKIP
  @description = description unless description == SKIP
  @use_count = use_count unless use_count == SKIP
  @discount_amt = discount_amt unless discount_amt == SKIP
  @discount_pct = discount_pct unless discount_pct == SKIP
  @minimum_purchase = minimum_purchase unless minimum_purchase == SKIP
  @is_lifetime = is_lifetime unless is_lifetime == SKIP
  @is_active = is_active unless is_active == SKIP
  @created_at = created_at unless created_at == SKIP
  @updated_at = updated_at unless updated_at == SKIP
  @expires_at = expires_at unless expires_at == SKIP
  @is_free_shipping = is_free_shipping unless is_free_shipping == SKIP
  @promo_code_count = promo_code_count unless promo_code_count == SKIP
  @limits = limits unless limits == SKIP
  @creator = creator unless creator == SKIP
  @updator = updator unless updator == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#created_atCreatedAt

TODO: Write general description for this method

Returns:



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

def created_at
  @created_at
end

#creatorCreator

TODO: Write general description for this method

Returns:



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

def creator
  @creator
end

#descriptionString

TODO: Write general description for this method

Returns:

  • (String)


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

def description
  @description
end

#discount_amtString

TODO: Write general description for this method

Returns:

  • (String)


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

def discount_amt
  @discount_amt
end

#discount_pctString

TODO: Write general description for this method

Returns:

  • (String)


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

def discount_pct
  @discount_pct
end

#expires_atString

TODO: Write general description for this method

Returns:

  • (String)


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

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/coupon_profile_one_of0.rb', line 14

def id
  @id
end

#is_activeInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def is_active
  @is_active
end

#is_free_shippingInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def is_free_shipping
  @is_free_shipping
end

#is_lifetimeInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def is_lifetime
  @is_lifetime
end

#limitsLimits

TODO: Write general description for this method

Returns:



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

def limits
  @limits
end

#minimum_purchaseString

TODO: Write general description for this method

Returns:

  • (String)


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

def minimum_purchase
  @minimum_purchase
end

#nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def name
  @name
end

#promo_code_countInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def promo_code_count
  @promo_code_count
end

#updated_atUpdatedAtCouponProfile

TODO: Write general description for this method



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

def updated_at
  @updated_at
end

#updatorUpdatorCouponProfile

TODO: Write general description for this method



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

def updator
  @updator
end

#use_countInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def use_count
  @use_count
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
# File 'lib/sticky_io_restful_api_v2025731/models/coupon_profile_one_of0.rb', line 164

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP
  use_count = hash.key?('use_count') ? hash['use_count'] : SKIP
  discount_amt = hash.key?('discount_amt') ? hash['discount_amt'] : SKIP
  discount_pct = hash.key?('discount_pct') ? hash['discount_pct'] : SKIP
  minimum_purchase =
    hash.key?('minimum_purchase') ? hash['minimum_purchase'] : SKIP
  is_lifetime = hash.key?('is_lifetime') ? hash['is_lifetime'] : SKIP
  is_active = hash.key?('is_active') ? hash['is_active'] : SKIP
  created_at = CreatedAt.from_hash(hash['created_at']) if hash['created_at']
  updated_at = UpdatedAtCouponProfile.from_hash(hash['updated_at']) if hash['updated_at']
  expires_at = hash.key?('expires_at') ? hash['expires_at'] : SKIP
  is_free_shipping =
    hash.key?('is_free_shipping') ? hash['is_free_shipping'] : SKIP
  promo_code_count =
    hash.key?('promo_code_count') ? hash['promo_code_count'] : SKIP
  limits = Limits.from_hash(hash['limits']) if hash['limits']
  creator = Creator.from_hash(hash['creator']) if hash['creator']
  updator = UpdatorCouponProfile.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.
  CouponProfileOneOf0.new(id: 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,
                          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.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/sticky_io_restful_api_v2025731/models/coupon_profile_one_of0.rb', line 81

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = '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['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



127
128
129
130
131
132
# File 'lib/sticky_io_restful_api_v2025731/models/coupon_profile_one_of0.rb', line 127

def self.nullables
  %w[
    expires_at
    limits
  ]
end

.optionalsObject

An array for optional fields



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/sticky_io_restful_api_v2025731/models/coupon_profile_one_of0.rb', line 104

def self.optionals
  %w[
    id
    name
    description
    use_count
    discount_amt
    discount_pct
    minimum_purchase
    is_lifetime
    is_active
    created_at
    updated_at
    expires_at
    is_free_shipping
    promo_code_count
    limits
    creator
    updator
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



219
220
221
222
223
224
225
# File 'lib/sticky_io_restful_api_v2025731/models/coupon_profile_one_of0.rb', line 219

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/sticky_io_restful_api_v2025731/models/coupon_profile_one_of0.rb', line 240

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@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}, 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.



228
229
230
231
232
233
234
235
236
237
# File 'lib/sticky_io_restful_api_v2025731/models/coupon_profile_one_of0.rb', line 228

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@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}, 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