voucherify 7.0.0 → 8.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/Dockerfile +1 -1
  3. data/EXAMPLES.md +3 -3
  4. data/Gemfile.lock +2 -2
  5. data/README.md +12 -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 +3 -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/ValidationsRedeemableInapplicable.md +2 -0
  47. data/docs/ValidationsRedeemableSkipped.md +2 -0
  48. data/docs/ValidationsValidateResponseBodyRedeemablesItem.md +3 -1
  49. data/docs/ValidationsValidateResponseBodyRedeemablesItemResultDetails.md +1 -1
  50. data/docs/VouchersApi.md +2 -2
  51. data/docs/VouchersCreateRequestBody.md +27 -0
  52. data/docs/VouchersCreateRequestBodyRedemption.md +8 -0
  53. data/docs/VouchersCreateWithSpecificCodeRequestBody.md +1 -1
  54. data/docs/VouchersImportCreateItemRequestBody.md +1 -1
  55. data/docs/VouchersUpdateRequestBody.md +1 -1
  56. data/lib/VoucherifySdk/api/vouchers_api.rb +3 -3
  57. data/lib/VoucherifySdk/models/campaigns_create_request_body.rb +1 -0
  58. data/lib/VoucherifySdk/models/campaigns_import_voucher_item.rb +1 -0
  59. data/lib/VoucherifySdk/models/campaigns_update_request_body.rb +1 -0
  60. data/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item.rb +29 -5
  61. data/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result_details.rb +13 -13
  62. data/lib/VoucherifySdk/models/discount.rb +2 -1
  63. data/lib/VoucherifySdk/models/{export_parameters_filters.rb → discount_product.rb} +26 -51
  64. data/lib/VoucherifySdk/models/earning_rule_loyalty.rb +17 -17
  65. data/lib/VoucherifySdk/models/export_parameters.rb +3 -2
  66. data/lib/VoucherifySdk/models/exports_create_request_body_parameters.rb +3 -2
  67. data/lib/VoucherifySdk/models/exports_create_response_body_parameters.rb +3 -2
  68. data/lib/VoucherifySdk/models/exports_get_response_body_parameters.rb +3 -2
  69. data/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item.rb +2 -0
  70. data/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty.rb +22 -22
  71. data/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty.rb +17 -17
  72. data/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty.rb +17 -17
  73. data/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty.rb +17 -17
  74. data/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty.rb +17 -17
  75. data/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty.rb +17 -17
  76. data/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty.rb +17 -17
  77. data/lib/VoucherifySdk/models/product_collections_products_list_response_body_data_item.rb +1 -0
  78. data/lib/VoucherifySdk/models/publications_create_request_body.rb +1 -0
  79. data/lib/VoucherifySdk/models/publications_create_response_body.rb +1 -0
  80. data/lib/VoucherifySdk/models/redemption_entry.rb +1 -0
  81. data/lib/VoucherifySdk/models/redemption_entry_customer.rb +1 -0
  82. data/lib/VoucherifySdk/models/redemption_entry_order.rb +5 -2
  83. data/lib/VoucherifySdk/models/redemption_entry_promotion_tier.rb +1 -0
  84. data/lib/VoucherifySdk/models/redemption_entry_voucher.rb +1 -0
  85. data/lib/VoucherifySdk/models/redemptions_get_response_body.rb +1 -0
  86. data/lib/VoucherifySdk/models/redemptions_get_response_body_customer.rb +1 -0
  87. data/lib/VoucherifySdk/models/redemptions_get_response_body_order.rb +5 -2
  88. data/lib/VoucherifySdk/models/redemptions_get_response_body_promotion_tier.rb +1 -0
  89. data/lib/VoucherifySdk/models/redemptions_get_response_body_voucher.rb +1 -0
  90. data/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item.rb +2 -0
  91. data/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_customer.rb +2 -0
  92. data/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_order.rb +7 -2
  93. data/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier.rb +2 -0
  94. data/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_voucher.rb +2 -0
  95. data/lib/VoucherifySdk/models/rewards_create_request_body.rb +1 -0
  96. data/lib/VoucherifySdk/models/rewards_update_request_body.rb +1 -0
  97. data/lib/VoucherifySdk/models/validations_redeemable_inapplicable.rb +27 -5
  98. data/lib/VoucherifySdk/models/validations_redeemable_skipped.rb +27 -5
  99. data/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item.rb +29 -5
  100. data/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item_result_details.rb +13 -13
  101. data/lib/VoucherifySdk/models/vouchers_create_request_body.rb +431 -0
  102. data/lib/VoucherifySdk/models/{exports_get_response_body_parameters_filters.rb → vouchers_create_request_body_redemption.rb} +10 -57
  103. data/lib/VoucherifySdk/models/vouchers_create_with_specific_code_request_body.rb +1 -0
  104. data/lib/VoucherifySdk/models/vouchers_import_create_item_request_body.rb +1 -0
  105. data/lib/VoucherifySdk/models/vouchers_update_request_body.rb +1 -0
  106. data/lib/VoucherifySdk/version.rb +1 -1
  107. data/lib/VoucherifySdk.rb +3 -4
  108. metadata +8 -10
  109. data/docs/ExportParametersFilters.md +0 -11
  110. data/docs/ExportsCreateRequestBodyParametersFilters.md +0 -11
  111. data/docs/ExportsCreateResponseBodyParametersFilters.md +0 -11
  112. data/docs/ExportsGetResponseBodyParametersFilters.md +0 -11
  113. data/lib/VoucherifySdk/models/exports_create_request_body_parameters_filters.rb +0 -256
  114. data/lib/VoucherifySdk/models/exports_create_response_body_parameters_filters.rb +0 -256
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: voucherify
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.0
4
+ version: 8.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawelrychlik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-24 00:00:00.000000000 Z
11
+ date: 2024-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -265,6 +265,7 @@ files:
265
265
  - docs/CustomersUpdateResponseBodyAddress.md
266
266
  - docs/CustomersUpdateResponseBodyAssets.md
267
267
  - docs/Discount.md
268
+ - docs/DiscountProduct.md
268
269
  - docs/DiscountUnitMultipleOneUnit.md
269
270
  - docs/EarningRule.md
270
271
  - docs/EarningRuleCustomEvent.md
@@ -294,7 +295,6 @@ files:
294
295
  - docs/ExportOrderFields.md
295
296
  - docs/ExportOrderOrder.md
296
297
  - docs/ExportParameters.md
297
- - docs/ExportParametersFilters.md
298
298
  - docs/ExportResult.md
299
299
  - docs/ExportVoucherTransactionsFields.md
300
300
  - docs/ExportVoucherTransactionsFilters.md
@@ -302,13 +302,10 @@ files:
302
302
  - docs/ExportsApi.md
303
303
  - docs/ExportsCreateRequestBody.md
304
304
  - docs/ExportsCreateRequestBodyParameters.md
305
- - docs/ExportsCreateRequestBodyParametersFilters.md
306
305
  - docs/ExportsCreateResponseBody.md
307
306
  - docs/ExportsCreateResponseBodyParameters.md
308
- - docs/ExportsCreateResponseBodyParametersFilters.md
309
307
  - docs/ExportsGetResponseBody.md
310
308
  - docs/ExportsGetResponseBodyParameters.md
311
- - docs/ExportsGetResponseBodyParametersFilters.md
312
309
  - docs/ExportsGetResponseBodyResult.md
313
310
  - docs/ExportsListResponseBody.md
314
311
  - docs/FieldConditions.md
@@ -1243,6 +1240,8 @@ files:
1243
1240
  - docs/VouchersBalanceUpdateRequestBody.md
1244
1241
  - docs/VouchersBalanceUpdateResponseBody.md
1245
1242
  - docs/VouchersBalanceUpdateResponseBodyRelatedObject.md
1243
+ - docs/VouchersCreateRequestBody.md
1244
+ - docs/VouchersCreateRequestBodyRedemption.md
1246
1245
  - docs/VouchersCreateResponseBody.md
1247
1246
  - docs/VouchersCreateResponseBodyGift.md
1248
1247
  - docs/VouchersCreateResponseBodyLoyaltyCard.md
@@ -1444,6 +1443,7 @@ files:
1444
1443
  - lib/VoucherifySdk/models/customers_update_response_body_address.rb
1445
1444
  - lib/VoucherifySdk/models/customers_update_response_body_assets.rb
1446
1445
  - lib/VoucherifySdk/models/discount.rb
1446
+ - lib/VoucherifySdk/models/discount_product.rb
1447
1447
  - lib/VoucherifySdk/models/discount_unit_multiple_one_unit.rb
1448
1448
  - lib/VoucherifySdk/models/earning_rule.rb
1449
1449
  - lib/VoucherifySdk/models/earning_rule_custom_event.rb
@@ -1472,20 +1472,16 @@ files:
1472
1472
  - lib/VoucherifySdk/models/export_order_fields.rb
1473
1473
  - lib/VoucherifySdk/models/export_order_order.rb
1474
1474
  - lib/VoucherifySdk/models/export_parameters.rb
1475
- - lib/VoucherifySdk/models/export_parameters_filters.rb
1476
1475
  - lib/VoucherifySdk/models/export_result.rb
1477
1476
  - lib/VoucherifySdk/models/export_voucher_transactions_fields.rb
1478
1477
  - lib/VoucherifySdk/models/export_voucher_transactions_filters.rb
1479
1478
  - lib/VoucherifySdk/models/export_voucher_transactions_order.rb
1480
1479
  - lib/VoucherifySdk/models/exports_create_request_body.rb
1481
1480
  - lib/VoucherifySdk/models/exports_create_request_body_parameters.rb
1482
- - lib/VoucherifySdk/models/exports_create_request_body_parameters_filters.rb
1483
1481
  - lib/VoucherifySdk/models/exports_create_response_body.rb
1484
1482
  - lib/VoucherifySdk/models/exports_create_response_body_parameters.rb
1485
- - lib/VoucherifySdk/models/exports_create_response_body_parameters_filters.rb
1486
1483
  - lib/VoucherifySdk/models/exports_get_response_body.rb
1487
1484
  - lib/VoucherifySdk/models/exports_get_response_body_parameters.rb
1488
- - lib/VoucherifySdk/models/exports_get_response_body_parameters_filters.rb
1489
1485
  - lib/VoucherifySdk/models/exports_get_response_body_result.rb
1490
1486
  - lib/VoucherifySdk/models/exports_list_response_body.rb
1491
1487
  - lib/VoucherifySdk/models/field_conditions.rb
@@ -2402,6 +2398,8 @@ files:
2402
2398
  - lib/VoucherifySdk/models/vouchers_balance_update_request_body.rb
2403
2399
  - lib/VoucherifySdk/models/vouchers_balance_update_response_body.rb
2404
2400
  - lib/VoucherifySdk/models/vouchers_balance_update_response_body_related_object.rb
2401
+ - lib/VoucherifySdk/models/vouchers_create_request_body.rb
2402
+ - lib/VoucherifySdk/models/vouchers_create_request_body_redemption.rb
2405
2403
  - lib/VoucherifySdk/models/vouchers_create_response_body.rb
2406
2404
  - lib/VoucherifySdk/models/vouchers_create_response_body_gift.rb
2407
2405
  - lib/VoucherifySdk/models/vouchers_create_response_body_loyalty_card.rb
@@ -1,11 +0,0 @@
1
- # VoucherifySdk::ExportParametersFilters
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **junction** | [**Junction**](Junction.md) | | [optional] |
8
- | **campaign_id** | [**FieldConditions**](FieldConditions.md) | | [optional] |
9
- | **voucher_id** | [**FieldConditions**](FieldConditions.md) | | [optional] |
10
- | **created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] |
11
-
@@ -1,11 +0,0 @@
1
- # VoucherifySdk::ExportsCreateRequestBodyParametersFilters
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **junction** | [**Junction**](Junction.md) | | [optional] |
8
- | **campaign_id** | [**FieldConditions**](FieldConditions.md) | | [optional] |
9
- | **voucher_id** | [**FieldConditions**](FieldConditions.md) | | [optional] |
10
- | **created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] |
11
-
@@ -1,11 +0,0 @@
1
- # VoucherifySdk::ExportsCreateResponseBodyParametersFilters
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **junction** | [**Junction**](Junction.md) | | [optional] |
8
- | **campaign_id** | [**FieldConditions**](FieldConditions.md) | | [optional] |
9
- | **voucher_id** | [**FieldConditions**](FieldConditions.md) | | [optional] |
10
- | **created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] |
11
-
@@ -1,11 +0,0 @@
1
- # VoucherifySdk::ExportsGetResponseBodyParametersFilters
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **junction** | [**Junction**](Junction.md) | | [optional] |
8
- | **campaign_id** | [**FieldConditions**](FieldConditions.md) | | [optional] |
9
- | **voucher_id** | [**FieldConditions**](FieldConditions.md) | | [optional] |
10
- | **created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] |
11
-
@@ -1,256 +0,0 @@
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 ExportsCreateRequestBodyParametersFilters
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
47
-
48
- # Attribute mapping from ruby-style variable name to JSON key.
49
- def self.attribute_map
50
- {
51
- :'junction' => :'junction',
52
- :'campaign_id' => :'campaign_id',
53
- :'voucher_id' => :'voucher_id',
54
- :'created_at' => :'created_at'
55
- }
56
- end
57
-
58
- # Returns all the JSON keys this model knows about
59
- def self.acceptable_attributes
60
- attribute_map.values
61
- end
62
-
63
- # Attribute type mapping.
64
- def self.openapi_types
65
- {
66
- :'junction' => :'Junction',
67
- :'campaign_id' => :'FieldConditions',
68
- :'voucher_id' => :'FieldConditions',
69
- :'created_at' => :'FieldConditions'
70
- }
71
- end
72
-
73
- # List of attributes with nullable: true
74
- def self.openapi_nullable
75
- Set.new([
76
- ])
77
- end
78
-
79
- # Initializes the object
80
- # @param [Hash] attributes Model attributes in the form of hash
81
- def initialize(attributes = {})
82
- # check to see if the attribute exists and convert string to symbol for hash key
83
- attributes = attributes.each_with_object({}) { |(k, v), h|
84
- h[k.to_sym] = v
85
- }
86
-
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']
101
- end
102
- end
103
-
104
- # Show invalid properties with the reasons. Usually used together with valid?
105
- # @return Array for valid properties with the reasons
106
- def list_invalid_properties
107
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
108
- invalid_properties = Array.new
109
- invalid_properties
110
- end
111
-
112
- # Check to see if the all the properties in the model are valid
113
- # @return true if the model is valid
114
- def valid?
115
- warn '[DEPRECATED] the `valid?` method is obsolete'
116
- true
117
- end
118
-
119
- # Checks equality by comparing each attribute.
120
- # @param [Object] Object to be compared
121
- def ==(o)
122
- return true if self.equal?(o)
123
- 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
128
- end
129
-
130
- # @see the `==` method
131
- # @param [Object] Object to be compared
132
- def eql?(o)
133
- self == o
134
- end
135
-
136
- # Calculates hash code according to all attributes.
137
- # @return [Integer] Hash code
138
- def hash
139
- [junction, campaign_id, voucher_id, created_at].hash
140
- end
141
-
142
- # Builds the object from hash
143
- # @param [Hash] attributes Model attributes in the form of hash
144
- # @return [Object] Returns the model itself
145
- def self.build_from_hash(attributes)
146
- return nil unless attributes.is_a?(Hash)
147
- attributes = attributes.transform_keys(&:to_sym)
148
- transformed_hash = {}
149
- openapi_types.each_pair do |key, type|
150
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
151
- transformed_hash["#{key}"] = nil
152
- elsif type =~ /\AArray<(.*)>/i
153
- # check to ensure the input is an array given that the attribute
154
- # is documented as an array but the input is not
155
- if attributes[attribute_map[key]].is_a?(Array)
156
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
157
- end
158
- elsif !attributes[attribute_map[key]].nil?
159
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
160
- end
161
- end
162
- new(transformed_hash)
163
- end
164
-
165
- # Deserializes the data based on type
166
- # @param string type Data type
167
- # @param string value Value to be deserialized
168
- # @return [Object] Deserialized data
169
- def self._deserialize(type, value)
170
- case type.to_sym
171
- when :Time
172
- Time.parse(value)
173
- when :Date
174
- Date.parse(value)
175
- when :String
176
- value.to_s
177
- when :Integer
178
- value.to_i
179
- when :Float
180
- value.to_f
181
- when :Boolean
182
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
183
- true
184
- else
185
- false
186
- end
187
- when :Object
188
- # generic object (usually a Hash), return directly
189
- value
190
- when /\AArray<(?<inner_type>.+)>\z/
191
- inner_type = Regexp.last_match[:inner_type]
192
- value.map { |v| _deserialize(inner_type, v) }
193
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
194
- k_type = Regexp.last_match[:k_type]
195
- v_type = Regexp.last_match[:v_type]
196
- {}.tap do |hash|
197
- value.each do |k, v|
198
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
199
- end
200
- end
201
- else # model
202
- # models (e.g. Pet) or oneOf
203
- klass = VoucherifySdk.const_get(type)
204
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
205
- end
206
- end
207
-
208
- # Returns the string representation of the object
209
- # @return [String] String presentation of the object
210
- def to_s
211
- to_hash.to_s
212
- end
213
-
214
- # to_body is an alias to to_hash (backward compatibility)
215
- # @return [Hash] Returns the object in the form of hash
216
- def to_body
217
- to_hash
218
- end
219
-
220
- # Returns the object in the form of hash
221
- # @return [Hash] Returns the object in the form of hash
222
- def to_hash
223
- hash = {}
224
- self.class.attribute_map.each_pair do |attr, param|
225
- value = self.send(attr)
226
- if value.nil?
227
- is_nullable = self.class.openapi_nullable.include?(attr)
228
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
229
- end
230
-
231
- hash[param] = _to_hash(value)
232
- end
233
- hash
234
- end
235
-
236
- # Outputs non-array value in the form of hash
237
- # For object, use to_hash. Otherwise, just return the value
238
- # @param [Object] value Any valid value
239
- # @return [Hash] Returns the value in the form of hash
240
- def _to_hash(value)
241
- if value.is_a?(Array)
242
- value.compact.map { |v| _to_hash(v) }
243
- elsif value.is_a?(Hash)
244
- {}.tap do |hash|
245
- value.each { |k, v| hash[k] = _to_hash(v) }
246
- end
247
- elsif value.respond_to? :to_hash
248
- value.to_hash
249
- else
250
- value
251
- end
252
- end
253
-
254
- end
255
-
256
- end
@@ -1,256 +0,0 @@
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 ExportsCreateResponseBodyParametersFilters
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
47
-
48
- # Attribute mapping from ruby-style variable name to JSON key.
49
- def self.attribute_map
50
- {
51
- :'junction' => :'junction',
52
- :'campaign_id' => :'campaign_id',
53
- :'voucher_id' => :'voucher_id',
54
- :'created_at' => :'created_at'
55
- }
56
- end
57
-
58
- # Returns all the JSON keys this model knows about
59
- def self.acceptable_attributes
60
- attribute_map.values
61
- end
62
-
63
- # Attribute type mapping.
64
- def self.openapi_types
65
- {
66
- :'junction' => :'Junction',
67
- :'campaign_id' => :'FieldConditions',
68
- :'voucher_id' => :'FieldConditions',
69
- :'created_at' => :'FieldConditions'
70
- }
71
- end
72
-
73
- # List of attributes with nullable: true
74
- def self.openapi_nullable
75
- Set.new([
76
- ])
77
- end
78
-
79
- # Initializes the object
80
- # @param [Hash] attributes Model attributes in the form of hash
81
- def initialize(attributes = {})
82
- # check to see if the attribute exists and convert string to symbol for hash key
83
- attributes = attributes.each_with_object({}) { |(k, v), h|
84
- h[k.to_sym] = v
85
- }
86
-
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']
101
- end
102
- end
103
-
104
- # Show invalid properties with the reasons. Usually used together with valid?
105
- # @return Array for valid properties with the reasons
106
- def list_invalid_properties
107
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
108
- invalid_properties = Array.new
109
- invalid_properties
110
- end
111
-
112
- # Check to see if the all the properties in the model are valid
113
- # @return true if the model is valid
114
- def valid?
115
- warn '[DEPRECATED] the `valid?` method is obsolete'
116
- true
117
- end
118
-
119
- # Checks equality by comparing each attribute.
120
- # @param [Object] Object to be compared
121
- def ==(o)
122
- return true if self.equal?(o)
123
- 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
128
- end
129
-
130
- # @see the `==` method
131
- # @param [Object] Object to be compared
132
- def eql?(o)
133
- self == o
134
- end
135
-
136
- # Calculates hash code according to all attributes.
137
- # @return [Integer] Hash code
138
- def hash
139
- [junction, campaign_id, voucher_id, created_at].hash
140
- end
141
-
142
- # Builds the object from hash
143
- # @param [Hash] attributes Model attributes in the form of hash
144
- # @return [Object] Returns the model itself
145
- def self.build_from_hash(attributes)
146
- return nil unless attributes.is_a?(Hash)
147
- attributes = attributes.transform_keys(&:to_sym)
148
- transformed_hash = {}
149
- openapi_types.each_pair do |key, type|
150
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
151
- transformed_hash["#{key}"] = nil
152
- elsif type =~ /\AArray<(.*)>/i
153
- # check to ensure the input is an array given that the attribute
154
- # is documented as an array but the input is not
155
- if attributes[attribute_map[key]].is_a?(Array)
156
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
157
- end
158
- elsif !attributes[attribute_map[key]].nil?
159
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
160
- end
161
- end
162
- new(transformed_hash)
163
- end
164
-
165
- # Deserializes the data based on type
166
- # @param string type Data type
167
- # @param string value Value to be deserialized
168
- # @return [Object] Deserialized data
169
- def self._deserialize(type, value)
170
- case type.to_sym
171
- when :Time
172
- Time.parse(value)
173
- when :Date
174
- Date.parse(value)
175
- when :String
176
- value.to_s
177
- when :Integer
178
- value.to_i
179
- when :Float
180
- value.to_f
181
- when :Boolean
182
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
183
- true
184
- else
185
- false
186
- end
187
- when :Object
188
- # generic object (usually a Hash), return directly
189
- value
190
- when /\AArray<(?<inner_type>.+)>\z/
191
- inner_type = Regexp.last_match[:inner_type]
192
- value.map { |v| _deserialize(inner_type, v) }
193
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
194
- k_type = Regexp.last_match[:k_type]
195
- v_type = Regexp.last_match[:v_type]
196
- {}.tap do |hash|
197
- value.each do |k, v|
198
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
199
- end
200
- end
201
- else # model
202
- # models (e.g. Pet) or oneOf
203
- klass = VoucherifySdk.const_get(type)
204
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
205
- end
206
- end
207
-
208
- # Returns the string representation of the object
209
- # @return [String] String presentation of the object
210
- def to_s
211
- to_hash.to_s
212
- end
213
-
214
- # to_body is an alias to to_hash (backward compatibility)
215
- # @return [Hash] Returns the object in the form of hash
216
- def to_body
217
- to_hash
218
- end
219
-
220
- # Returns the object in the form of hash
221
- # @return [Hash] Returns the object in the form of hash
222
- def to_hash
223
- hash = {}
224
- self.class.attribute_map.each_pair do |attr, param|
225
- value = self.send(attr)
226
- if value.nil?
227
- is_nullable = self.class.openapi_nullable.include?(attr)
228
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
229
- end
230
-
231
- hash[param] = _to_hash(value)
232
- end
233
- hash
234
- end
235
-
236
- # Outputs non-array value in the form of hash
237
- # For object, use to_hash. Otherwise, just return the value
238
- # @param [Object] value Any valid value
239
- # @return [Hash] Returns the value in the form of hash
240
- def _to_hash(value)
241
- if value.is_a?(Array)
242
- value.compact.map { |v| _to_hash(v) }
243
- elsif value.is_a?(Hash)
244
- {}.tap do |hash|
245
- value.each { |k, v| hash[k] = _to_hash(v) }
246
- end
247
- elsif value.respond_to? :to_hash
248
- value.to_hash
249
- else
250
- value
251
- end
252
- end
253
-
254
- end
255
-
256
- end