Class: StickyIoRestfulApiV2025731::DataGetCouponProfile

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

Overview

DataGetCouponProfile 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:, description:, use_count:, discount_amt:, discount_pct:, minimum_purchase:, is_lifetime:, created_by:, created_at:, updated_by:, updated_at:, expires_at:, is_free_shipping:, promo_code_count:, limits:, creator:, updator:, promo_codes:, additional_properties: nil) ⇒ DataGetCouponProfile

Returns a new instance of DataGetCouponProfile.



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

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

  @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
  @created_by = created_by
  @created_at = created_at
  @updated_by = updated_by
  @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
  @promo_codes = promo_codes
  @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/data_get_coupon_profile.rb', line 50

def created_at
  @created_at
end

#created_byInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def created_by
  @created_by
end

#creatorCreator

TODO: Write general description for this method

Returns:



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

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/data_get_coupon_profile.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/data_get_coupon_profile.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/data_get_coupon_profile.rb', line 34

def discount_pct
  @discount_pct
end

#expires_atString

TODO: Write general description for this method

Returns:

  • (String)


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

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

def id
  @id
end

#is_free_shippingInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

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/data_get_coupon_profile.rb', line 42

def is_lifetime
  @is_lifetime
end

#limitsString

TODO: Write general description for this method

Returns:

  • (String)


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

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/data_get_coupon_profile.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/data_get_coupon_profile.rb', line 18

def name
  @name
end

#promo_code_countInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def promo_code_count
  @promo_code_count
end

#promo_codesArray[PromoCodeData]

TODO: Write general description for this method

Returns:



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

def promo_codes
  @promo_codes
end

#updated_atUpdatedAtData

TODO: Write general description for this method

Returns:



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

def updated_at
  @updated_at
end

#updated_byInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def updated_by
  @updated_by
end

#updatorUpdatorData

TODO: Write general description for this method

Returns:



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

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/data_get_coupon_profile.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.



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

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
  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
  created_by = hash.key?('created_by') ? hash['created_by'] : nil
  created_at = CreatedAt.from_hash(hash['created_at']) if hash['created_at']
  updated_by = hash.key?('updated_by') ? hash['updated_by'] : nil
  updated_at = UpdatedAtData.from_hash(hash['updated_at']) if hash['updated_at']
  expires_at = hash.key?('expires_at') ? hash['expires_at'] : nil
  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 = hash.key?('limits') ? hash['limits'] : nil
  creator = Creator.from_hash(hash['creator']) if hash['creator']
  updator = UpdatorData.from_hash(hash['updator']) if hash['updator']
  # Parameter is an array, so we need to iterate through it
  promo_codes = nil
  unless hash['promo_codes'].nil?
    promo_codes = []
    hash['promo_codes'].each do |structure|
      promo_codes << (PromoCodeData.from_hash(structure) if structure)
    end
  end

  promo_codes = nil unless hash.key?('promo_codes')

  # 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.
  DataGetCouponProfile.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,
                           created_by: created_by,
                           created_at: created_at,
                           updated_by: updated_by,
                           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,
                           promo_codes: promo_codes,
                           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_get_coupon_profile.rb', line 89

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['created_by'] = 'created_by'
  @_hash['created_at'] = 'created_at'
  @_hash['updated_by'] = 'updated_by'
  @_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['promo_codes'] = 'promo_codes'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  %w[
    expires_at
    limits
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



237
238
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_coupon_profile.rb', line 237

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}, created_by:"\
  " #{@created_by.inspect}, created_at: #{@created_at.inspect}, updated_by:"\
  " #{@updated_by.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}, promo_codes: #{@promo_codes.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



224
225
226
227
228
229
230
231
232
233
234
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_coupon_profile.rb', line 224

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