voucherify 7.0.0 → 8.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/Dockerfile +1 -1
  3. data/EXAMPLES.md +3 -3
  4. data/Gemfile.lock +1 -1
  5. data/README.md +10 -5
  6. data/docs/CampaignsCreateRequestBody.md +1 -1
  7. data/docs/CampaignsImportVoucherItem.md +1 -1
  8. data/docs/CampaignsUpdateRequestBody.md +1 -1
  9. data/docs/ClientValidationsValidateResponseBodyRedeemablesItem.md +1 -1
  10. data/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultDetails.md +1 -1
  11. data/docs/Discount.md +1 -1
  12. data/docs/DiscountProduct.md +10 -0
  13. data/docs/EarningRuleLoyalty.md +1 -1
  14. data/docs/ExportParameters.md +1 -1
  15. data/docs/ExportsCreateRequestBodyParameters.md +1 -1
  16. data/docs/ExportsCreateResponseBodyParameters.md +1 -1
  17. data/docs/ExportsGetResponseBodyParameters.md +1 -1
  18. data/docs/LoyaltiesEarningRulesCreateRequestBodyItem.md +1 -1
  19. data/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyalty.md +2 -2
  20. data/docs/LoyaltiesEarningRulesCreateResponseBodyLoyalty.md +1 -1
  21. data/docs/LoyaltiesEarningRulesDisableResponseBodyLoyalty.md +1 -1
  22. data/docs/LoyaltiesEarningRulesEnableResponseBodyLoyalty.md +1 -1
  23. data/docs/LoyaltiesEarningRulesGetResponseBodyLoyalty.md +1 -1
  24. data/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyalty.md +1 -1
  25. data/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyalty.md +1 -1
  26. data/docs/ProductCollectionsProductsListResponseBodyDataItem.md +1 -1
  27. data/docs/PublicationsCreateRequestBody.md +1 -1
  28. data/docs/PublicationsCreateResponseBody.md +1 -1
  29. data/docs/RedemptionEntry.md +1 -1
  30. data/docs/RedemptionEntryCustomer.md +1 -1
  31. data/docs/RedemptionEntryOrder.md +2 -2
  32. data/docs/RedemptionEntryPromotionTier.md +1 -1
  33. data/docs/RedemptionEntryVoucher.md +1 -1
  34. data/docs/RedemptionsGetResponseBody.md +1 -1
  35. data/docs/RedemptionsGetResponseBodyCustomer.md +1 -1
  36. data/docs/RedemptionsGetResponseBodyOrder.md +2 -2
  37. data/docs/RedemptionsGetResponseBodyPromotionTier.md +1 -1
  38. data/docs/RedemptionsGetResponseBodyVoucher.md +1 -1
  39. data/docs/RedemptionsListResponseBodyRedemptionsItem.md +1 -1
  40. data/docs/RedemptionsListResponseBodyRedemptionsItemCustomer.md +1 -1
  41. data/docs/RedemptionsListResponseBodyRedemptionsItemOrder.md +2 -2
  42. data/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTier.md +1 -1
  43. data/docs/RedemptionsListResponseBodyRedemptionsItemVoucher.md +1 -1
  44. data/docs/RewardsCreateRequestBody.md +1 -1
  45. data/docs/RewardsUpdateRequestBody.md +1 -1
  46. data/docs/ValidationsValidateResponseBodyRedeemablesItem.md +1 -1
  47. data/docs/ValidationsValidateResponseBodyRedeemablesItemResultDetails.md +1 -1
  48. data/docs/VouchersApi.md +2 -2
  49. data/docs/VouchersCreateRequestBody.md +27 -0
  50. data/docs/VouchersCreateRequestBodyRedemption.md +8 -0
  51. data/docs/VouchersCreateWithSpecificCodeRequestBody.md +1 -1
  52. data/docs/VouchersImportCreateItemRequestBody.md +1 -1
  53. data/docs/VouchersUpdateRequestBody.md +1 -1
  54. data/lib/VoucherifySdk/api/vouchers_api.rb +3 -3
  55. data/lib/VoucherifySdk/models/campaigns_create_request_body.rb +1 -0
  56. data/lib/VoucherifySdk/models/campaigns_import_voucher_item.rb +1 -0
  57. data/lib/VoucherifySdk/models/campaigns_update_request_body.rb +1 -0
  58. data/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item.rb +2 -0
  59. data/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result_details.rb +13 -13
  60. data/lib/VoucherifySdk/models/discount.rb +2 -1
  61. data/lib/VoucherifySdk/models/{export_parameters_filters.rb → discount_product.rb} +26 -51
  62. data/lib/VoucherifySdk/models/earning_rule_loyalty.rb +17 -17
  63. data/lib/VoucherifySdk/models/export_parameters.rb +3 -2
  64. data/lib/VoucherifySdk/models/exports_create_request_body_parameters.rb +3 -2
  65. data/lib/VoucherifySdk/models/exports_create_response_body_parameters.rb +3 -2
  66. data/lib/VoucherifySdk/models/exports_get_response_body_parameters.rb +3 -2
  67. data/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item.rb +2 -0
  68. data/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty.rb +22 -22
  69. data/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty.rb +17 -17
  70. data/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty.rb +17 -17
  71. data/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty.rb +17 -17
  72. data/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty.rb +17 -17
  73. data/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty.rb +17 -17
  74. data/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty.rb +17 -17
  75. data/lib/VoucherifySdk/models/product_collections_products_list_response_body_data_item.rb +1 -0
  76. data/lib/VoucherifySdk/models/publications_create_request_body.rb +1 -0
  77. data/lib/VoucherifySdk/models/publications_create_response_body.rb +1 -0
  78. data/lib/VoucherifySdk/models/redemption_entry.rb +1 -0
  79. data/lib/VoucherifySdk/models/redemption_entry_customer.rb +1 -0
  80. data/lib/VoucherifySdk/models/redemption_entry_order.rb +5 -2
  81. data/lib/VoucherifySdk/models/redemption_entry_promotion_tier.rb +1 -0
  82. data/lib/VoucherifySdk/models/redemption_entry_voucher.rb +1 -0
  83. data/lib/VoucherifySdk/models/redemptions_get_response_body.rb +1 -0
  84. data/lib/VoucherifySdk/models/redemptions_get_response_body_customer.rb +1 -0
  85. data/lib/VoucherifySdk/models/redemptions_get_response_body_order.rb +5 -2
  86. data/lib/VoucherifySdk/models/redemptions_get_response_body_promotion_tier.rb +1 -0
  87. data/lib/VoucherifySdk/models/redemptions_get_response_body_voucher.rb +1 -0
  88. data/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item.rb +2 -0
  89. data/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_customer.rb +2 -0
  90. data/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_order.rb +7 -2
  91. data/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier.rb +2 -0
  92. data/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_voucher.rb +2 -0
  93. data/lib/VoucherifySdk/models/rewards_create_request_body.rb +1 -0
  94. data/lib/VoucherifySdk/models/rewards_update_request_body.rb +1 -0
  95. data/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item.rb +2 -0
  96. data/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item_result_details.rb +13 -13
  97. data/lib/VoucherifySdk/models/vouchers_create_request_body.rb +431 -0
  98. data/lib/VoucherifySdk/models/{exports_get_response_body_parameters_filters.rb → vouchers_create_request_body_redemption.rb} +10 -57
  99. data/lib/VoucherifySdk/models/vouchers_create_with_specific_code_request_body.rb +1 -0
  100. data/lib/VoucherifySdk/models/vouchers_import_create_item_request_body.rb +1 -0
  101. data/lib/VoucherifySdk/models/vouchers_update_request_body.rb +1 -0
  102. data/lib/VoucherifySdk/version.rb +1 -1
  103. data/lib/VoucherifySdk.rb +3 -4
  104. metadata +8 -10
  105. data/docs/ExportParametersFilters.md +0 -11
  106. data/docs/ExportsCreateRequestBodyParametersFilters.md +0 -11
  107. data/docs/ExportsCreateResponseBodyParametersFilters.md +0 -11
  108. data/docs/ExportsGetResponseBodyParametersFilters.md +0 -11
  109. data/lib/VoucherifySdk/models/exports_create_request_body_parameters_filters.rb +0 -256
  110. data/lib/VoucherifySdk/models/exports_create_response_body_parameters_filters.rb +0 -256
@@ -0,0 +1,431 @@
1
+ =begin
2
+ #Voucherify API
3
+
4
+ #Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details.
5
+
6
+ The version of the OpenAPI document: v2018-08-01
7
+ Contact: support@voucherify.io
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.0.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module VoucherifySdk
17
+ class VouchersCreateRequestBody
18
+ # Code that identifies a voucher. The pattern can use all the letters of the English alphabet, Arabic numerals, and special characters. Pass this attribute in the request body to create a distinct code. Otherwise, either use the `code_config` object to set the rules that the Voucherify API will use to create a random code, or don't pass any code and Voucherify will generate a random code.
19
+ attr_accessor :code
20
+
21
+ # Identifies the voucher's parent campaign using a unique campaign name.
22
+ attr_accessor :campaign
23
+
24
+ # Identifies the voucher's parent campaign using a unique campaign ID assigned by the Voucherify API.
25
+ attr_accessor :campaign_id
26
+
27
+ # The name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint.
28
+ attr_accessor :category
29
+
30
+ # Unique identifier assigned by Voucherify to the name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint.
31
+ attr_accessor :category_id
32
+
33
+ # Start date defines when the code starts to be active. Activation timestamp is presented in the ISO 8601 format. Voucher is *inactive before* this date.
34
+ attr_accessor :start_date
35
+
36
+ # Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date.
37
+ attr_accessor :expiration_date
38
+
39
+ attr_accessor :validity_timeframe
40
+
41
+ # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday
42
+ attr_accessor :validity_day_of_week
43
+
44
+ attr_accessor :validity_hours
45
+
46
+ # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher
47
+ attr_accessor :active
48
+
49
+ # An optional field to keep any extra textual information about the code such as a code description and details.
50
+ attr_accessor :additional_info
51
+
52
+ # The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.
53
+ attr_accessor :metadata
54
+
55
+ # Array containing the ID of the validation rule associated with the voucher.
56
+ attr_accessor :validation_rules
57
+
58
+ attr_accessor :redemption
59
+
60
+ attr_accessor :type
61
+
62
+ attr_accessor :loyalty_card
63
+
64
+ attr_accessor :code_config
65
+
66
+ attr_accessor :gift
67
+
68
+ attr_accessor :discount
69
+
70
+ class EnumAttributeValidator
71
+ attr_reader :datatype
72
+ attr_reader :allowable_values
73
+
74
+ def initialize(datatype, allowable_values)
75
+ @allowable_values = allowable_values.map do |value|
76
+ case datatype.to_s
77
+ when /Integer/i
78
+ value.to_i
79
+ when /Float/i
80
+ value.to_f
81
+ else
82
+ value
83
+ end
84
+ end
85
+ end
86
+
87
+ def valid?(value)
88
+ !value || allowable_values.include?(value)
89
+ end
90
+ end
91
+
92
+ # Attribute mapping from ruby-style variable name to JSON key.
93
+ def self.attribute_map
94
+ {
95
+ :'code' => :'code',
96
+ :'campaign' => :'campaign',
97
+ :'campaign_id' => :'campaign_id',
98
+ :'category' => :'category',
99
+ :'category_id' => :'category_id',
100
+ :'start_date' => :'start_date',
101
+ :'expiration_date' => :'expiration_date',
102
+ :'validity_timeframe' => :'validity_timeframe',
103
+ :'validity_day_of_week' => :'validity_day_of_week',
104
+ :'validity_hours' => :'validity_hours',
105
+ :'active' => :'active',
106
+ :'additional_info' => :'additional_info',
107
+ :'metadata' => :'metadata',
108
+ :'validation_rules' => :'validation_rules',
109
+ :'redemption' => :'redemption',
110
+ :'type' => :'type',
111
+ :'loyalty_card' => :'loyalty_card',
112
+ :'code_config' => :'code_config',
113
+ :'gift' => :'gift',
114
+ :'discount' => :'discount'
115
+ }
116
+ end
117
+
118
+ # Returns all the JSON keys this model knows about
119
+ def self.acceptable_attributes
120
+ attribute_map.values
121
+ end
122
+
123
+ # Attribute type mapping.
124
+ def self.openapi_types
125
+ {
126
+ :'code' => :'String',
127
+ :'campaign' => :'String',
128
+ :'campaign_id' => :'String',
129
+ :'category' => :'String',
130
+ :'category_id' => :'String',
131
+ :'start_date' => :'Time',
132
+ :'expiration_date' => :'Time',
133
+ :'validity_timeframe' => :'ValidityTimeframe',
134
+ :'validity_day_of_week' => :'Array<Integer>',
135
+ :'validity_hours' => :'ValidityHours',
136
+ :'active' => :'Boolean',
137
+ :'additional_info' => :'String',
138
+ :'metadata' => :'Object',
139
+ :'validation_rules' => :'Array<String>',
140
+ :'redemption' => :'VouchersCreateRequestBodyRedemption',
141
+ :'type' => :'String',
142
+ :'loyalty_card' => :'SimpleLoyaltyCard',
143
+ :'code_config' => :'CodeConfig',
144
+ :'gift' => :'Gift',
145
+ :'discount' => :'Discount'
146
+ }
147
+ end
148
+
149
+ # List of attributes with nullable: true
150
+ def self.openapi_nullable
151
+ Set.new([
152
+ :'code',
153
+ :'campaign',
154
+ :'campaign_id',
155
+ :'category',
156
+ :'category_id',
157
+ :'start_date',
158
+ :'expiration_date',
159
+ :'active',
160
+ :'additional_info',
161
+ :'metadata',
162
+ :'validation_rules',
163
+ :'redemption',
164
+ :'type',
165
+ ])
166
+ end
167
+
168
+ # Initializes the object
169
+ # @param [Hash] attributes Model attributes in the form of hash
170
+ def initialize(attributes = {})
171
+ # check to see if the attribute exists and convert string to symbol for hash key
172
+ attributes = attributes.each_with_object({}) { |(k, v), h|
173
+ h[k.to_sym] = v
174
+ }
175
+
176
+ if attributes.key?(:'code')
177
+ self.code = attributes[:'code']
178
+ end
179
+
180
+ if attributes.key?(:'campaign')
181
+ self.campaign = attributes[:'campaign']
182
+ end
183
+
184
+ if attributes.key?(:'campaign_id')
185
+ self.campaign_id = attributes[:'campaign_id']
186
+ end
187
+
188
+ if attributes.key?(:'category')
189
+ self.category = attributes[:'category']
190
+ end
191
+
192
+ if attributes.key?(:'category_id')
193
+ self.category_id = attributes[:'category_id']
194
+ end
195
+
196
+ if attributes.key?(:'start_date')
197
+ self.start_date = attributes[:'start_date']
198
+ end
199
+
200
+ if attributes.key?(:'expiration_date')
201
+ self.expiration_date = attributes[:'expiration_date']
202
+ end
203
+
204
+ if attributes.key?(:'validity_timeframe')
205
+ self.validity_timeframe = attributes[:'validity_timeframe']
206
+ end
207
+
208
+ if attributes.key?(:'validity_day_of_week')
209
+ if (value = attributes[:'validity_day_of_week']).is_a?(Array)
210
+ self.validity_day_of_week = value
211
+ end
212
+ end
213
+
214
+ if attributes.key?(:'validity_hours')
215
+ self.validity_hours = attributes[:'validity_hours']
216
+ end
217
+
218
+ if attributes.key?(:'active')
219
+ self.active = attributes[:'active']
220
+ end
221
+
222
+ if attributes.key?(:'additional_info')
223
+ self.additional_info = attributes[:'additional_info']
224
+ end
225
+
226
+ if attributes.key?(:'metadata')
227
+ self.metadata = attributes[:'metadata']
228
+ end
229
+
230
+ if attributes.key?(:'validation_rules')
231
+ if (value = attributes[:'validation_rules']).is_a?(Array)
232
+ self.validation_rules = value
233
+ end
234
+ end
235
+
236
+ if attributes.key?(:'redemption')
237
+ self.redemption = attributes[:'redemption']
238
+ end
239
+
240
+ if attributes.key?(:'type')
241
+ self.type = attributes[:'type']
242
+ end
243
+
244
+ if attributes.key?(:'loyalty_card')
245
+ self.loyalty_card = attributes[:'loyalty_card']
246
+ end
247
+
248
+ if attributes.key?(:'code_config')
249
+ self.code_config = attributes[:'code_config']
250
+ end
251
+
252
+ if attributes.key?(:'gift')
253
+ self.gift = attributes[:'gift']
254
+ end
255
+
256
+ if attributes.key?(:'discount')
257
+ self.discount = attributes[:'discount']
258
+ end
259
+ end
260
+
261
+ # Show invalid properties with the reasons. Usually used together with valid?
262
+ # @return Array for valid properties with the reasons
263
+ def list_invalid_properties
264
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
265
+ invalid_properties = Array.new
266
+ invalid_properties
267
+ end
268
+
269
+ # Check to see if the all the properties in the model are valid
270
+ # @return true if the model is valid
271
+ def valid?
272
+ warn '[DEPRECATED] the `valid?` method is obsolete'
273
+ type_validator = EnumAttributeValidator.new('String', ["LOYALTY_CARD", "GIFT_VOUCHER", "DISCOUNT_VOUCHER"])
274
+ return false unless type_validator.valid?(@type)
275
+ true
276
+ end
277
+
278
+ # Checks equality by comparing each attribute.
279
+ # @param [Object] Object to be compared
280
+ def ==(o)
281
+ return true if self.equal?(o)
282
+ self.class == o.class &&
283
+ code == o.code &&
284
+ campaign == o.campaign &&
285
+ campaign_id == o.campaign_id &&
286
+ category == o.category &&
287
+ category_id == o.category_id &&
288
+ start_date == o.start_date &&
289
+ expiration_date == o.expiration_date &&
290
+ validity_timeframe == o.validity_timeframe &&
291
+ validity_day_of_week == o.validity_day_of_week &&
292
+ validity_hours == o.validity_hours &&
293
+ active == o.active &&
294
+ additional_info == o.additional_info &&
295
+ metadata == o.metadata &&
296
+ validation_rules == o.validation_rules &&
297
+ redemption == o.redemption &&
298
+ type == o.type &&
299
+ loyalty_card == o.loyalty_card &&
300
+ code_config == o.code_config &&
301
+ gift == o.gift &&
302
+ discount == o.discount
303
+ end
304
+
305
+ # @see the `==` method
306
+ # @param [Object] Object to be compared
307
+ def eql?(o)
308
+ self == o
309
+ end
310
+
311
+ # Calculates hash code according to all attributes.
312
+ # @return [Integer] Hash code
313
+ def hash
314
+ [code, campaign, campaign_id, category, category_id, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, additional_info, metadata, validation_rules, redemption, type, loyalty_card, code_config, gift, discount].hash
315
+ end
316
+
317
+ # Builds the object from hash
318
+ # @param [Hash] attributes Model attributes in the form of hash
319
+ # @return [Object] Returns the model itself
320
+ def self.build_from_hash(attributes)
321
+ return nil unless attributes.is_a?(Hash)
322
+ attributes = attributes.transform_keys(&:to_sym)
323
+ transformed_hash = {}
324
+ openapi_types.each_pair do |key, type|
325
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
326
+ transformed_hash["#{key}"] = nil
327
+ elsif type =~ /\AArray<(.*)>/i
328
+ # check to ensure the input is an array given that the attribute
329
+ # is documented as an array but the input is not
330
+ if attributes[attribute_map[key]].is_a?(Array)
331
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
332
+ end
333
+ elsif !attributes[attribute_map[key]].nil?
334
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
335
+ end
336
+ end
337
+ new(transformed_hash)
338
+ end
339
+
340
+ # Deserializes the data based on type
341
+ # @param string type Data type
342
+ # @param string value Value to be deserialized
343
+ # @return [Object] Deserialized data
344
+ def self._deserialize(type, value)
345
+ case type.to_sym
346
+ when :Time
347
+ Time.parse(value)
348
+ when :Date
349
+ Date.parse(value)
350
+ when :String
351
+ value.to_s
352
+ when :Integer
353
+ value.to_i
354
+ when :Float
355
+ value.to_f
356
+ when :Boolean
357
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
358
+ true
359
+ else
360
+ false
361
+ end
362
+ when :Object
363
+ # generic object (usually a Hash), return directly
364
+ value
365
+ when /\AArray<(?<inner_type>.+)>\z/
366
+ inner_type = Regexp.last_match[:inner_type]
367
+ value.map { |v| _deserialize(inner_type, v) }
368
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
369
+ k_type = Regexp.last_match[:k_type]
370
+ v_type = Regexp.last_match[:v_type]
371
+ {}.tap do |hash|
372
+ value.each do |k, v|
373
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
374
+ end
375
+ end
376
+ else # model
377
+ # models (e.g. Pet) or oneOf
378
+ klass = VoucherifySdk.const_get(type)
379
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
380
+ end
381
+ end
382
+
383
+ # Returns the string representation of the object
384
+ # @return [String] String presentation of the object
385
+ def to_s
386
+ to_hash.to_s
387
+ end
388
+
389
+ # to_body is an alias to to_hash (backward compatibility)
390
+ # @return [Hash] Returns the object in the form of hash
391
+ def to_body
392
+ to_hash
393
+ end
394
+
395
+ # Returns the object in the form of hash
396
+ # @return [Hash] Returns the object in the form of hash
397
+ def to_hash
398
+ hash = {}
399
+ self.class.attribute_map.each_pair do |attr, param|
400
+ value = self.send(attr)
401
+ if value.nil?
402
+ is_nullable = self.class.openapi_nullable.include?(attr)
403
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
404
+ end
405
+
406
+ hash[param] = _to_hash(value)
407
+ end
408
+ hash
409
+ end
410
+
411
+ # Outputs non-array value in the form of hash
412
+ # For object, use to_hash. Otherwise, just return the value
413
+ # @param [Object] value Any valid value
414
+ # @return [Hash] Returns the value in the form of hash
415
+ def _to_hash(value)
416
+ if value.is_a?(Array)
417
+ value.compact.map { |v| _to_hash(v) }
418
+ elsif value.is_a?(Hash)
419
+ {}.tap do |hash|
420
+ value.each { |k, v| hash[k] = _to_hash(v) }
421
+ end
422
+ elsif value.respond_to? :to_hash
423
+ value.to_hash
424
+ else
425
+ value
426
+ end
427
+ end
428
+
429
+ end
430
+
431
+ end
@@ -14,44 +14,14 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module VoucherifySdk
17
- class ExportsGetResponseBodyParametersFilters
18
- attr_accessor :junction
19
-
20
- attr_accessor :campaign_id
21
-
22
- attr_accessor :voucher_id
23
-
24
- attr_accessor :created_at
25
-
26
- class EnumAttributeValidator
27
- attr_reader :datatype
28
- attr_reader :allowable_values
29
-
30
- def initialize(datatype, allowable_values)
31
- @allowable_values = allowable_values.map do |value|
32
- case datatype.to_s
33
- when /Integer/i
34
- value.to_i
35
- when /Float/i
36
- value.to_f
37
- else
38
- value
39
- end
40
- end
41
- end
42
-
43
- def valid?(value)
44
- !value || allowable_values.include?(value)
45
- end
46
- end
17
+ class VouchersCreateRequestBodyRedemption
18
+ # How many times a voucher can be redeemed. A `null` value means unlimited.
19
+ attr_accessor :quantity
47
20
 
48
21
  # Attribute mapping from ruby-style variable name to JSON key.
49
22
  def self.attribute_map
50
23
  {
51
- :'junction' => :'junction',
52
- :'campaign_id' => :'campaign_id',
53
- :'voucher_id' => :'voucher_id',
54
- :'created_at' => :'created_at'
24
+ :'quantity' => :'quantity'
55
25
  }
56
26
  end
57
27
 
@@ -63,16 +33,14 @@ module VoucherifySdk
63
33
  # Attribute type mapping.
64
34
  def self.openapi_types
65
35
  {
66
- :'junction' => :'Junction',
67
- :'campaign_id' => :'FieldConditions',
68
- :'voucher_id' => :'FieldConditions',
69
- :'created_at' => :'FieldConditions'
36
+ :'quantity' => :'Integer'
70
37
  }
71
38
  end
72
39
 
73
40
  # List of attributes with nullable: true
74
41
  def self.openapi_nullable
75
42
  Set.new([
43
+ :'quantity'
76
44
  ])
77
45
  end
78
46
 
@@ -84,20 +52,8 @@ module VoucherifySdk
84
52
  h[k.to_sym] = v
85
53
  }
86
54
 
87
- if attributes.key?(:'junction')
88
- self.junction = attributes[:'junction']
89
- end
90
-
91
- if attributes.key?(:'campaign_id')
92
- self.campaign_id = attributes[:'campaign_id']
93
- end
94
-
95
- if attributes.key?(:'voucher_id')
96
- self.voucher_id = attributes[:'voucher_id']
97
- end
98
-
99
- if attributes.key?(:'created_at')
100
- self.created_at = attributes[:'created_at']
55
+ if attributes.key?(:'quantity')
56
+ self.quantity = attributes[:'quantity']
101
57
  end
102
58
  end
103
59
 
@@ -121,10 +77,7 @@ module VoucherifySdk
121
77
  def ==(o)
122
78
  return true if self.equal?(o)
123
79
  self.class == o.class &&
124
- junction == o.junction &&
125
- campaign_id == o.campaign_id &&
126
- voucher_id == o.voucher_id &&
127
- created_at == o.created_at
80
+ quantity == o.quantity
128
81
  end
129
82
 
130
83
  # @see the `==` method
@@ -136,7 +89,7 @@ module VoucherifySdk
136
89
  # Calculates hash code according to all attributes.
137
90
  # @return [Integer] Hash code
138
91
  def hash
139
- [junction, campaign_id, voucher_id, created_at].hash
92
+ [quantity].hash
140
93
  end
141
94
 
142
95
  # Builds the object from hash
@@ -46,6 +46,7 @@ module VoucherifySdk
46
46
  # An optional field to keep any extra textual information about the code such as a code description and details.
47
47
  attr_accessor :additional_info
48
48
 
49
+ # The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.
49
50
  attr_accessor :metadata
50
51
 
51
52
  # Array containing the ID of the validation rule associated with the voucher.
@@ -23,6 +23,7 @@ module VoucherifySdk
23
23
  # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher
24
24
  attr_accessor :active
25
25
 
26
+ # The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.
26
27
  attr_accessor :metadata
27
28
 
28
29
  # Tag defining the category that this voucher belongs to. Useful when listing vouchers using the [List Vouchers](ref:list-vouchers) endpoint.
@@ -40,6 +40,7 @@ module VoucherifySdk
40
40
  # An optional field to keep any extra textual information about the code such as a code description and details.
41
41
  attr_accessor :additional_info
42
42
 
43
+ # The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.
43
44
  attr_accessor :metadata
44
45
 
45
46
  attr_accessor :type
@@ -11,5 +11,5 @@ OpenAPI Generator version: 7.0.1
11
11
  =end
12
12
 
13
13
  module VoucherifySdk
14
- VERSION = '7.0.0'
14
+ VERSION = '8.0.0'
15
15
  end
data/lib/VoucherifySdk.rb CHANGED
@@ -145,6 +145,7 @@ require 'VoucherifySdk/models/customers_update_response_body'
145
145
  require 'VoucherifySdk/models/customers_update_response_body_address'
146
146
  require 'VoucherifySdk/models/customers_update_response_body_assets'
147
147
  require 'VoucherifySdk/models/discount'
148
+ require 'VoucherifySdk/models/discount_product'
148
149
  require 'VoucherifySdk/models/discount_unit_multiple_one_unit'
149
150
  require 'VoucherifySdk/models/earning_rule'
150
151
  require 'VoucherifySdk/models/earning_rule_custom_event'
@@ -173,20 +174,16 @@ require 'VoucherifySdk/models/export'
173
174
  require 'VoucherifySdk/models/export_order_fields'
174
175
  require 'VoucherifySdk/models/export_order_order'
175
176
  require 'VoucherifySdk/models/export_parameters'
176
- require 'VoucherifySdk/models/export_parameters_filters'
177
177
  require 'VoucherifySdk/models/export_result'
178
178
  require 'VoucherifySdk/models/export_voucher_transactions_fields'
179
179
  require 'VoucherifySdk/models/export_voucher_transactions_filters'
180
180
  require 'VoucherifySdk/models/export_voucher_transactions_order'
181
181
  require 'VoucherifySdk/models/exports_create_request_body'
182
182
  require 'VoucherifySdk/models/exports_create_request_body_parameters'
183
- require 'VoucherifySdk/models/exports_create_request_body_parameters_filters'
184
183
  require 'VoucherifySdk/models/exports_create_response_body'
185
184
  require 'VoucherifySdk/models/exports_create_response_body_parameters'
186
- require 'VoucherifySdk/models/exports_create_response_body_parameters_filters'
187
185
  require 'VoucherifySdk/models/exports_get_response_body'
188
186
  require 'VoucherifySdk/models/exports_get_response_body_parameters'
189
- require 'VoucherifySdk/models/exports_get_response_body_parameters_filters'
190
187
  require 'VoucherifySdk/models/exports_get_response_body_result'
191
188
  require 'VoucherifySdk/models/exports_list_response_body'
192
189
  require 'VoucherifySdk/models/field_conditions'
@@ -1103,6 +1100,8 @@ require 'VoucherifySdk/models/voucher_with_categories_redemption'
1103
1100
  require 'VoucherifySdk/models/vouchers_balance_update_request_body'
1104
1101
  require 'VoucherifySdk/models/vouchers_balance_update_response_body'
1105
1102
  require 'VoucherifySdk/models/vouchers_balance_update_response_body_related_object'
1103
+ require 'VoucherifySdk/models/vouchers_create_request_body'
1104
+ require 'VoucherifySdk/models/vouchers_create_request_body_redemption'
1106
1105
  require 'VoucherifySdk/models/vouchers_create_response_body'
1107
1106
  require 'VoucherifySdk/models/vouchers_create_response_body_gift'
1108
1107
  require 'VoucherifySdk/models/vouchers_create_response_body_loyalty_card'