voucherify 8.0.1 → 8.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Dockerfile +1 -1
- data/ENDPOINTS-COVERAGE.md +64 -60
- data/Gemfile.lock +4 -4
- data/README.md +11 -0
- data/docs/Campaign.md +2 -2
- data/docs/CampaignBase.md +2 -2
- data/docs/CampaignsApi.md +3 -3
- data/docs/CampaignsCreateRequestBody.md +1 -1
- data/docs/CampaignsCreateResponseBody.md +2 -2
- data/docs/CampaignsGetResponseBody.md +2 -2
- data/docs/CampaignsUpdateRequestBody.md +2 -2
- data/docs/CampaignsUpdateResponseBody.md +2 -2
- data/docs/ClientValidationsValidateResponseBodyRedeemablesItem.md +3 -2
- data/docs/Error.md +1 -0
- data/docs/ErrorError.md +8 -0
- data/docs/LoyaltiesCreateCampaignRequestBody.md +1 -1
- data/docs/LoyaltiesMembersBalanceUpdateResponseBody.md +1 -1
- data/docs/LoyaltiesMembersPointsExpirationListResponseBodyDataItem.md +9 -9
- data/docs/LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket.md +1 -1
- data/docs/LoyaltiesUpdateCampaignRequestBody.md +2 -2
- data/docs/LoyaltyCardTransaction.md +2 -2
- data/docs/LoyaltyCardTransactionDetailsBalance.md +5 -4
- data/docs/LoyaltyCardTransactionDetailsBalanceRelatedObject.md +1 -1
- data/docs/LoyaltyPointsBucket.md +16 -0
- data/docs/LoyaltyPointsBucketBucket.md +8 -0
- data/docs/Order.md +1 -1
- data/docs/OrderCalculated.md +1 -1
- data/docs/OrderCalculatedItem.md +1 -1
- data/docs/OrderCalculatedItemProduct.md +1 -1
- data/docs/OrderCalculatedItemSku.md +1 -0
- data/docs/OrderItem.md +1 -1
- data/docs/OrderItemProduct.md +1 -1
- data/docs/OrderItemSku.md +1 -0
- data/docs/OrdersCreateRequestBody.md +1 -1
- data/docs/OrdersCreateResponseBody.md +1 -1
- data/docs/OrdersGetResponseBody.md +1 -1
- data/docs/OrdersImportCreateRequestBodyItem.md +1 -1
- data/docs/OrdersUpdateRequestBody.md +1 -1
- data/docs/OrdersUpdateResponseBody.md +1 -1
- data/docs/Product.md +1 -1
- data/docs/ProductCollectionsProductsListResponseBodyDataItem.md +1 -1
- data/docs/ProductWithoutSkus.md +1 -1
- data/docs/ProductsCreateResponseBody.md +1 -1
- data/docs/ProductsGetResponseBody.md +1 -1
- data/docs/ProductsSkusCreateResponseBody.md +1 -1
- data/docs/ProductsSkusUpdateResponseBody.md +1 -1
- data/docs/ProductsUpdateResponseBody.md +1 -1
- data/docs/RedemptionEntryOrder.md +1 -1
- data/docs/RedemptionsGetResponseBodyOrder.md +1 -1
- data/docs/RedemptionsListResponseBodyRedemptionsItemOrder.md +1 -1
- data/docs/Sku.md +1 -1
- data/docs/SkusGetResponseBody.md +1 -1
- data/docs/TemplatesCampaignsCampaignSetupCreateRequestBody.md +1 -1
- data/docs/ValidationsRedeemableInapplicable.md +3 -2
- data/docs/ValidationsRedeemableSkipped.md +3 -2
- data/docs/ValidationsValidateResponseBodyRedeemablesItem.md +3 -2
- data/docs/VoucherBalance.md +14 -0
- data/docs/VoucherBalanceRelatedObject.md +9 -0
- data/docs/VoucherTransaction.md +2 -2
- data/docs/VoucherTransactionDetailsBalance.md +5 -4
- data/docs/VoucherTransactionDetailsBalanceRelatedObject.md +1 -1
- data/docs/VouchersApi.md +6 -6
- data/docs/VouchersBalanceUpdateResponseBody.md +1 -1
- data/lib/VoucherifySdk/api/campaigns_api.rb +4 -4
- data/lib/VoucherifySdk/api/vouchers_api.rb +10 -10
- data/lib/VoucherifySdk/models/access_settings_campaign_assignments_list.rb +1 -1
- data/lib/VoucherifySdk/models/campaign.rb +3 -3
- data/lib/VoucherifySdk/models/campaign_base.rb +3 -3
- data/lib/VoucherifySdk/models/campaigns_create_request_body.rb +1 -1
- data/lib/VoucherifySdk/models/campaigns_create_response_body.rb +3 -3
- data/lib/VoucherifySdk/models/campaigns_get_response_body.rb +3 -3
- data/lib/VoucherifySdk/models/campaigns_update_request_body.rb +2 -2
- data/lib/VoucherifySdk/models/campaigns_update_response_body.rb +3 -3
- data/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item.rb +18 -7
- data/lib/VoucherifySdk/models/error.rb +15 -5
- data/lib/VoucherifySdk/models/error_error.rb +210 -0
- data/lib/VoucherifySdk/models/loyalties_create_campaign_request_body.rb +1 -1
- data/lib/VoucherifySdk/models/loyalties_members_balance_update_response_body.rb +1 -0
- data/lib/VoucherifySdk/models/loyalties_members_points_expiration_list_response_body_data_item.rb +27 -77
- data/lib/VoucherifySdk/models/loyalties_members_points_expiration_list_response_body_data_item_bucket.rb +3 -9
- data/lib/VoucherifySdk/models/loyalties_update_campaign_request_body.rb +2 -2
- data/lib/VoucherifySdk/models/loyalty_card_transaction.rb +24 -31
- data/lib/VoucherifySdk/models/loyalty_card_transaction_details.rb +0 -1
- data/lib/VoucherifySdk/models/loyalty_card_transaction_details_balance.rb +18 -19
- data/lib/VoucherifySdk/models/loyalty_card_transaction_details_balance_related_object.rb +1 -7
- data/lib/VoucherifySdk/models/loyalty_points_bucket.rb +323 -0
- data/lib/VoucherifySdk/models/loyalty_points_bucket_bucket.rb +210 -0
- data/lib/VoucherifySdk/models/order.rb +1 -1
- data/lib/VoucherifySdk/models/order_calculated.rb +1 -1
- data/lib/VoucherifySdk/models/order_calculated_item.rb +1 -1
- data/lib/VoucherifySdk/models/order_calculated_item_product.rb +1 -1
- data/lib/VoucherifySdk/models/order_calculated_item_sku.rb +16 -5
- data/lib/VoucherifySdk/models/order_item.rb +1 -1
- data/lib/VoucherifySdk/models/order_item_product.rb +1 -1
- data/lib/VoucherifySdk/models/order_item_sku.rb +16 -5
- data/lib/VoucherifySdk/models/orders_create_request_body.rb +1 -1
- data/lib/VoucherifySdk/models/orders_create_response_body.rb +1 -1
- data/lib/VoucherifySdk/models/orders_get_response_body.rb +1 -1
- data/lib/VoucherifySdk/models/orders_import_create_request_body_item.rb +1 -1
- data/lib/VoucherifySdk/models/orders_update_request_body.rb +1 -1
- data/lib/VoucherifySdk/models/orders_update_response_body.rb +1 -1
- data/lib/VoucherifySdk/models/parameter_expand_list_campaigns.rb +2 -1
- data/lib/VoucherifySdk/models/product.rb +1 -1
- data/lib/VoucherifySdk/models/product_collections_products_list_response_body_data_item.rb +1 -1
- data/lib/VoucherifySdk/models/product_without_skus.rb +1 -1
- data/lib/VoucherifySdk/models/products_create_response_body.rb +1 -1
- data/lib/VoucherifySdk/models/products_get_response_body.rb +1 -1
- data/lib/VoucherifySdk/models/products_skus_create_response_body.rb +1 -1
- data/lib/VoucherifySdk/models/products_skus_update_response_body.rb +1 -1
- data/lib/VoucherifySdk/models/products_update_response_body.rb +1 -1
- data/lib/VoucherifySdk/models/redemption_entry_order.rb +1 -1
- data/lib/VoucherifySdk/models/redemptions_get_response_body_order.rb +1 -1
- data/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_order.rb +1 -1
- data/lib/VoucherifySdk/models/sku.rb +1 -1
- data/lib/VoucherifySdk/models/skus_get_response_body.rb +1 -1
- data/lib/VoucherifySdk/models/templates_campaigns_campaign_setup_create_request_body.rb +1 -1
- data/lib/VoucherifySdk/models/validations_redeemable_inapplicable.rb +18 -7
- data/lib/VoucherifySdk/models/validations_redeemable_skipped.rb +18 -7
- data/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item.rb +18 -7
- data/lib/VoucherifySdk/models/voucher_balance.rb +305 -0
- data/lib/VoucherifySdk/models/voucher_balance_related_object.rb +247 -0
- data/lib/VoucherifySdk/models/voucher_transaction.rb +27 -31
- data/lib/VoucherifySdk/models/voucher_transaction_details.rb +0 -1
- data/lib/VoucherifySdk/models/voucher_transaction_details_balance.rb +18 -19
- data/lib/VoucherifySdk/models/voucher_transaction_details_balance_related_object.rb +1 -7
- data/lib/VoucherifySdk/models/vouchers_balance_update_response_body.rb +1 -0
- data/lib/VoucherifySdk/version.rb +1 -1
- data/lib/VoucherifySdk.rb +5 -0
- metadata +12 -2
|
@@ -0,0 +1,305 @@
|
|
|
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
|
+
# Contains information on how the balance was affected by the transaction.
|
|
18
|
+
class VoucherBalance
|
|
19
|
+
# The type of voucher whose balance is being adjusted due to the transaction.
|
|
20
|
+
attr_accessor :type
|
|
21
|
+
|
|
22
|
+
# The number of all points or credits accumulated on the card as affected by add or subtract operations.
|
|
23
|
+
attr_accessor :total
|
|
24
|
+
|
|
25
|
+
# The type of the object represented by the JSON.
|
|
26
|
+
attr_accessor :object
|
|
27
|
+
|
|
28
|
+
# Points added or subtracted in the transaction of a loyalty card.
|
|
29
|
+
attr_accessor :points
|
|
30
|
+
|
|
31
|
+
# The available points or credits on the card after the transaction as affected by redemption or rollback.
|
|
32
|
+
attr_accessor :balance
|
|
33
|
+
|
|
34
|
+
# The type of the operation being performed. The operation type is `AUTOMATIC` if it is an automatic redemption.
|
|
35
|
+
attr_accessor :operation_type
|
|
36
|
+
|
|
37
|
+
attr_accessor :related_object
|
|
38
|
+
|
|
39
|
+
class EnumAttributeValidator
|
|
40
|
+
attr_reader :datatype
|
|
41
|
+
attr_reader :allowable_values
|
|
42
|
+
|
|
43
|
+
def initialize(datatype, allowable_values)
|
|
44
|
+
@allowable_values = allowable_values.map do |value|
|
|
45
|
+
case datatype.to_s
|
|
46
|
+
when /Integer/i
|
|
47
|
+
value.to_i
|
|
48
|
+
when /Float/i
|
|
49
|
+
value.to_f
|
|
50
|
+
else
|
|
51
|
+
value
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def valid?(value)
|
|
57
|
+
!value || allowable_values.include?(value)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
62
|
+
def self.attribute_map
|
|
63
|
+
{
|
|
64
|
+
:'type' => :'type',
|
|
65
|
+
:'total' => :'total',
|
|
66
|
+
:'object' => :'object',
|
|
67
|
+
:'points' => :'points',
|
|
68
|
+
:'balance' => :'balance',
|
|
69
|
+
:'operation_type' => :'operation_type',
|
|
70
|
+
:'related_object' => :'related_object'
|
|
71
|
+
}
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Returns all the JSON keys this model knows about
|
|
75
|
+
def self.acceptable_attributes
|
|
76
|
+
attribute_map.values
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Attribute type mapping.
|
|
80
|
+
def self.openapi_types
|
|
81
|
+
{
|
|
82
|
+
:'type' => :'String',
|
|
83
|
+
:'total' => :'Integer',
|
|
84
|
+
:'object' => :'String',
|
|
85
|
+
:'points' => :'Integer',
|
|
86
|
+
:'balance' => :'Integer',
|
|
87
|
+
:'operation_type' => :'String',
|
|
88
|
+
:'related_object' => :'VoucherBalanceRelatedObject'
|
|
89
|
+
}
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# List of attributes with nullable: true
|
|
93
|
+
def self.openapi_nullable
|
|
94
|
+
Set.new([
|
|
95
|
+
:'type',
|
|
96
|
+
:'total',
|
|
97
|
+
:'object',
|
|
98
|
+
:'points',
|
|
99
|
+
:'balance',
|
|
100
|
+
:'operation_type',
|
|
101
|
+
:'related_object'
|
|
102
|
+
])
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Initializes the object
|
|
106
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
107
|
+
def initialize(attributes = {})
|
|
108
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
109
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
110
|
+
h[k.to_sym] = v
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if attributes.key?(:'type')
|
|
114
|
+
self.type = attributes[:'type']
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
if attributes.key?(:'total')
|
|
118
|
+
self.total = attributes[:'total']
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
if attributes.key?(:'object')
|
|
122
|
+
self.object = attributes[:'object']
|
|
123
|
+
else
|
|
124
|
+
self.object = 'balance'
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
if attributes.key?(:'points')
|
|
128
|
+
self.points = attributes[:'points']
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
if attributes.key?(:'balance')
|
|
132
|
+
self.balance = attributes[:'balance']
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
if attributes.key?(:'operation_type')
|
|
136
|
+
self.operation_type = attributes[:'operation_type']
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
if attributes.key?(:'related_object')
|
|
140
|
+
self.related_object = attributes[:'related_object']
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
145
|
+
# @return Array for valid properties with the reasons
|
|
146
|
+
def list_invalid_properties
|
|
147
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
148
|
+
invalid_properties = Array.new
|
|
149
|
+
invalid_properties
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# Check to see if the all the properties in the model are valid
|
|
153
|
+
# @return true if the model is valid
|
|
154
|
+
def valid?
|
|
155
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
156
|
+
type_validator = EnumAttributeValidator.new('String', ["loyalty_card", "gift_voucher"])
|
|
157
|
+
return false unless type_validator.valid?(@type)
|
|
158
|
+
object_validator = EnumAttributeValidator.new('String', ["balance"])
|
|
159
|
+
return false unless object_validator.valid?(@object)
|
|
160
|
+
operation_type_validator = EnumAttributeValidator.new('String', ["MANUAL", "AUTOMATIC"])
|
|
161
|
+
return false unless operation_type_validator.valid?(@operation_type)
|
|
162
|
+
true
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Checks equality by comparing each attribute.
|
|
166
|
+
# @param [Object] Object to be compared
|
|
167
|
+
def ==(o)
|
|
168
|
+
return true if self.equal?(o)
|
|
169
|
+
self.class == o.class &&
|
|
170
|
+
type == o.type &&
|
|
171
|
+
total == o.total &&
|
|
172
|
+
object == o.object &&
|
|
173
|
+
points == o.points &&
|
|
174
|
+
balance == o.balance &&
|
|
175
|
+
operation_type == o.operation_type &&
|
|
176
|
+
related_object == o.related_object
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# @see the `==` method
|
|
180
|
+
# @param [Object] Object to be compared
|
|
181
|
+
def eql?(o)
|
|
182
|
+
self == o
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# Calculates hash code according to all attributes.
|
|
186
|
+
# @return [Integer] Hash code
|
|
187
|
+
def hash
|
|
188
|
+
[type, total, object, points, balance, operation_type, related_object].hash
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Builds the object from hash
|
|
192
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
193
|
+
# @return [Object] Returns the model itself
|
|
194
|
+
def self.build_from_hash(attributes)
|
|
195
|
+
return nil unless attributes.is_a?(Hash)
|
|
196
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
197
|
+
transformed_hash = {}
|
|
198
|
+
openapi_types.each_pair do |key, type|
|
|
199
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
200
|
+
transformed_hash["#{key}"] = nil
|
|
201
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
202
|
+
# check to ensure the input is an array given that the attribute
|
|
203
|
+
# is documented as an array but the input is not
|
|
204
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
205
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
206
|
+
end
|
|
207
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
208
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
new(transformed_hash)
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# Deserializes the data based on type
|
|
215
|
+
# @param string type Data type
|
|
216
|
+
# @param string value Value to be deserialized
|
|
217
|
+
# @return [Object] Deserialized data
|
|
218
|
+
def self._deserialize(type, value)
|
|
219
|
+
case type.to_sym
|
|
220
|
+
when :Time
|
|
221
|
+
Time.parse(value)
|
|
222
|
+
when :Date
|
|
223
|
+
Date.parse(value)
|
|
224
|
+
when :String
|
|
225
|
+
value.to_s
|
|
226
|
+
when :Integer
|
|
227
|
+
value.to_i
|
|
228
|
+
when :Float
|
|
229
|
+
value.to_f
|
|
230
|
+
when :Boolean
|
|
231
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
232
|
+
true
|
|
233
|
+
else
|
|
234
|
+
false
|
|
235
|
+
end
|
|
236
|
+
when :Object
|
|
237
|
+
# generic object (usually a Hash), return directly
|
|
238
|
+
value
|
|
239
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
240
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
241
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
242
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
243
|
+
k_type = Regexp.last_match[:k_type]
|
|
244
|
+
v_type = Regexp.last_match[:v_type]
|
|
245
|
+
{}.tap do |hash|
|
|
246
|
+
value.each do |k, v|
|
|
247
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
248
|
+
end
|
|
249
|
+
end
|
|
250
|
+
else # model
|
|
251
|
+
# models (e.g. Pet) or oneOf
|
|
252
|
+
klass = VoucherifySdk.const_get(type)
|
|
253
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
254
|
+
end
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
# Returns the string representation of the object
|
|
258
|
+
# @return [String] String presentation of the object
|
|
259
|
+
def to_s
|
|
260
|
+
to_hash.to_s
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
264
|
+
# @return [Hash] Returns the object in the form of hash
|
|
265
|
+
def to_body
|
|
266
|
+
to_hash
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
# Returns the object in the form of hash
|
|
270
|
+
# @return [Hash] Returns the object in the form of hash
|
|
271
|
+
def to_hash
|
|
272
|
+
hash = {}
|
|
273
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
274
|
+
value = self.send(attr)
|
|
275
|
+
if value.nil?
|
|
276
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
277
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
hash[param] = _to_hash(value)
|
|
281
|
+
end
|
|
282
|
+
hash
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
# Outputs non-array value in the form of hash
|
|
286
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
287
|
+
# @param [Object] value Any valid value
|
|
288
|
+
# @return [Hash] Returns the value in the form of hash
|
|
289
|
+
def _to_hash(value)
|
|
290
|
+
if value.is_a?(Array)
|
|
291
|
+
value.compact.map { |v| _to_hash(v) }
|
|
292
|
+
elsif value.is_a?(Hash)
|
|
293
|
+
{}.tap do |hash|
|
|
294
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
295
|
+
end
|
|
296
|
+
elsif value.respond_to? :to_hash
|
|
297
|
+
value.to_hash
|
|
298
|
+
else
|
|
299
|
+
value
|
|
300
|
+
end
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
end
|
|
@@ -0,0 +1,247 @@
|
|
|
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
|
+
# Defines the resource that is being modified with the values that are returned in the balance object.
|
|
18
|
+
class VoucherBalanceRelatedObject
|
|
19
|
+
# Identifies the voucher that is being modified. The ID is assigned by the Voucherify API.
|
|
20
|
+
attr_accessor :id
|
|
21
|
+
|
|
22
|
+
# The object being modified, i.e. voucher.
|
|
23
|
+
attr_accessor :type
|
|
24
|
+
|
|
25
|
+
class EnumAttributeValidator
|
|
26
|
+
attr_reader :datatype
|
|
27
|
+
attr_reader :allowable_values
|
|
28
|
+
|
|
29
|
+
def initialize(datatype, allowable_values)
|
|
30
|
+
@allowable_values = allowable_values.map do |value|
|
|
31
|
+
case datatype.to_s
|
|
32
|
+
when /Integer/i
|
|
33
|
+
value.to_i
|
|
34
|
+
when /Float/i
|
|
35
|
+
value.to_f
|
|
36
|
+
else
|
|
37
|
+
value
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def valid?(value)
|
|
43
|
+
!value || allowable_values.include?(value)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
48
|
+
def self.attribute_map
|
|
49
|
+
{
|
|
50
|
+
:'id' => :'id',
|
|
51
|
+
:'type' => :'type'
|
|
52
|
+
}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Returns all the JSON keys this model knows about
|
|
56
|
+
def self.acceptable_attributes
|
|
57
|
+
attribute_map.values
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Attribute type mapping.
|
|
61
|
+
def self.openapi_types
|
|
62
|
+
{
|
|
63
|
+
:'id' => :'String',
|
|
64
|
+
:'type' => :'String'
|
|
65
|
+
}
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# List of attributes with nullable: true
|
|
69
|
+
def self.openapi_nullable
|
|
70
|
+
Set.new([
|
|
71
|
+
:'id',
|
|
72
|
+
:'type'
|
|
73
|
+
])
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Initializes the object
|
|
77
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
78
|
+
def initialize(attributes = {})
|
|
79
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
80
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
81
|
+
h[k.to_sym] = v
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if attributes.key?(:'id')
|
|
85
|
+
self.id = attributes[:'id']
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
if attributes.key?(:'type')
|
|
89
|
+
self.type = attributes[:'type']
|
|
90
|
+
else
|
|
91
|
+
self.type = 'voucher'
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
96
|
+
# @return Array for valid properties with the reasons
|
|
97
|
+
def list_invalid_properties
|
|
98
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
99
|
+
invalid_properties = Array.new
|
|
100
|
+
invalid_properties
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Check to see if the all the properties in the model are valid
|
|
104
|
+
# @return true if the model is valid
|
|
105
|
+
def valid?
|
|
106
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
107
|
+
type_validator = EnumAttributeValidator.new('String', ["voucher"])
|
|
108
|
+
return false unless type_validator.valid?(@type)
|
|
109
|
+
true
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Checks equality by comparing each attribute.
|
|
113
|
+
# @param [Object] Object to be compared
|
|
114
|
+
def ==(o)
|
|
115
|
+
return true if self.equal?(o)
|
|
116
|
+
self.class == o.class &&
|
|
117
|
+
id == o.id &&
|
|
118
|
+
type == o.type
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# @see the `==` method
|
|
122
|
+
# @param [Object] Object to be compared
|
|
123
|
+
def eql?(o)
|
|
124
|
+
self == o
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Calculates hash code according to all attributes.
|
|
128
|
+
# @return [Integer] Hash code
|
|
129
|
+
def hash
|
|
130
|
+
[id, type].hash
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# Builds the object from hash
|
|
134
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
135
|
+
# @return [Object] Returns the model itself
|
|
136
|
+
def self.build_from_hash(attributes)
|
|
137
|
+
return nil unless attributes.is_a?(Hash)
|
|
138
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
139
|
+
transformed_hash = {}
|
|
140
|
+
openapi_types.each_pair do |key, type|
|
|
141
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
142
|
+
transformed_hash["#{key}"] = nil
|
|
143
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
144
|
+
# check to ensure the input is an array given that the attribute
|
|
145
|
+
# is documented as an array but the input is not
|
|
146
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
147
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
148
|
+
end
|
|
149
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
150
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
new(transformed_hash)
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# Deserializes the data based on type
|
|
157
|
+
# @param string type Data type
|
|
158
|
+
# @param string value Value to be deserialized
|
|
159
|
+
# @return [Object] Deserialized data
|
|
160
|
+
def self._deserialize(type, value)
|
|
161
|
+
case type.to_sym
|
|
162
|
+
when :Time
|
|
163
|
+
Time.parse(value)
|
|
164
|
+
when :Date
|
|
165
|
+
Date.parse(value)
|
|
166
|
+
when :String
|
|
167
|
+
value.to_s
|
|
168
|
+
when :Integer
|
|
169
|
+
value.to_i
|
|
170
|
+
when :Float
|
|
171
|
+
value.to_f
|
|
172
|
+
when :Boolean
|
|
173
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
174
|
+
true
|
|
175
|
+
else
|
|
176
|
+
false
|
|
177
|
+
end
|
|
178
|
+
when :Object
|
|
179
|
+
# generic object (usually a Hash), return directly
|
|
180
|
+
value
|
|
181
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
182
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
183
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
184
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
185
|
+
k_type = Regexp.last_match[:k_type]
|
|
186
|
+
v_type = Regexp.last_match[:v_type]
|
|
187
|
+
{}.tap do |hash|
|
|
188
|
+
value.each do |k, v|
|
|
189
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
else # model
|
|
193
|
+
# models (e.g. Pet) or oneOf
|
|
194
|
+
klass = VoucherifySdk.const_get(type)
|
|
195
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# Returns the string representation of the object
|
|
200
|
+
# @return [String] String presentation of the object
|
|
201
|
+
def to_s
|
|
202
|
+
to_hash.to_s
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
206
|
+
# @return [Hash] Returns the object in the form of hash
|
|
207
|
+
def to_body
|
|
208
|
+
to_hash
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# Returns the object in the form of hash
|
|
212
|
+
# @return [Hash] Returns the object in the form of hash
|
|
213
|
+
def to_hash
|
|
214
|
+
hash = {}
|
|
215
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
216
|
+
value = self.send(attr)
|
|
217
|
+
if value.nil?
|
|
218
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
219
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
hash[param] = _to_hash(value)
|
|
223
|
+
end
|
|
224
|
+
hash
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
# Outputs non-array value in the form of hash
|
|
228
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
229
|
+
# @param [Object] value Any valid value
|
|
230
|
+
# @return [Hash] Returns the value in the form of hash
|
|
231
|
+
def _to_hash(value)
|
|
232
|
+
if value.is_a?(Array)
|
|
233
|
+
value.compact.map { |v| _to_hash(v) }
|
|
234
|
+
elsif value.is_a?(Hash)
|
|
235
|
+
{}.tap do |hash|
|
|
236
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
237
|
+
end
|
|
238
|
+
elsif value.respond_to? :to_hash
|
|
239
|
+
value.to_hash
|
|
240
|
+
else
|
|
241
|
+
value
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
end
|
|
@@ -33,16 +33,16 @@ module VoucherifySdk
|
|
|
33
33
|
# Reason why the transaction occurred. In case of a redemption, this value is null.
|
|
34
34
|
attr_accessor :reason
|
|
35
35
|
|
|
36
|
-
attr_accessor :type
|
|
37
|
-
|
|
38
|
-
attr_accessor :details
|
|
39
|
-
|
|
40
36
|
# The related transaction ID on the receiving card.
|
|
41
37
|
attr_accessor :related_transaction_id
|
|
42
38
|
|
|
43
39
|
# Timestamp representing the date and time when the transaction was created. The value is shown in the ISO 8601 format.
|
|
44
40
|
attr_accessor :created_at
|
|
45
41
|
|
|
42
|
+
attr_accessor :details
|
|
43
|
+
|
|
44
|
+
attr_accessor :type
|
|
45
|
+
|
|
46
46
|
class EnumAttributeValidator
|
|
47
47
|
attr_reader :datatype
|
|
48
48
|
attr_reader :allowable_values
|
|
@@ -74,10 +74,10 @@ module VoucherifySdk
|
|
|
74
74
|
:'campaign_id' => :'campaign_id',
|
|
75
75
|
:'source' => :'source',
|
|
76
76
|
:'reason' => :'reason',
|
|
77
|
-
:'type' => :'type',
|
|
78
|
-
:'details' => :'details',
|
|
79
77
|
:'related_transaction_id' => :'related_transaction_id',
|
|
80
|
-
:'created_at' => :'created_at'
|
|
78
|
+
:'created_at' => :'created_at',
|
|
79
|
+
:'details' => :'details',
|
|
80
|
+
:'type' => :'type'
|
|
81
81
|
}
|
|
82
82
|
end
|
|
83
83
|
|
|
@@ -95,10 +95,10 @@ module VoucherifySdk
|
|
|
95
95
|
:'campaign_id' => :'String',
|
|
96
96
|
:'source' => :'String',
|
|
97
97
|
:'reason' => :'String',
|
|
98
|
-
:'type' => :'LoyaltyCardTransactionsType',
|
|
99
|
-
:'details' => :'VoucherTransactionDetails',
|
|
100
98
|
:'related_transaction_id' => :'String',
|
|
101
|
-
:'created_at' => :'Time'
|
|
99
|
+
:'created_at' => :'Time',
|
|
100
|
+
:'details' => :'VoucherTransactionDetails',
|
|
101
|
+
:'type' => :'String'
|
|
102
102
|
}
|
|
103
103
|
end
|
|
104
104
|
|
|
@@ -111,9 +111,10 @@ module VoucherifySdk
|
|
|
111
111
|
:'campaign_id',
|
|
112
112
|
:'source',
|
|
113
113
|
:'reason',
|
|
114
|
-
:'details',
|
|
115
114
|
:'related_transaction_id',
|
|
116
|
-
:'created_at'
|
|
115
|
+
:'created_at',
|
|
116
|
+
:'details',
|
|
117
|
+
:'type'
|
|
117
118
|
])
|
|
118
119
|
end
|
|
119
120
|
|
|
@@ -149,16 +150,6 @@ module VoucherifySdk
|
|
|
149
150
|
self.reason = attributes[:'reason']
|
|
150
151
|
end
|
|
151
152
|
|
|
152
|
-
if attributes.key?(:'type')
|
|
153
|
-
self.type = attributes[:'type']
|
|
154
|
-
else
|
|
155
|
-
self.type = nil
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
if attributes.key?(:'details')
|
|
159
|
-
self.details = attributes[:'details']
|
|
160
|
-
end
|
|
161
|
-
|
|
162
153
|
if attributes.key?(:'related_transaction_id')
|
|
163
154
|
self.related_transaction_id = attributes[:'related_transaction_id']
|
|
164
155
|
end
|
|
@@ -166,6 +157,14 @@ module VoucherifySdk
|
|
|
166
157
|
if attributes.key?(:'created_at')
|
|
167
158
|
self.created_at = attributes[:'created_at']
|
|
168
159
|
end
|
|
160
|
+
|
|
161
|
+
if attributes.key?(:'details')
|
|
162
|
+
self.details = attributes[:'details']
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
if attributes.key?(:'type')
|
|
166
|
+
self.type = attributes[:'type']
|
|
167
|
+
end
|
|
169
168
|
end
|
|
170
169
|
|
|
171
170
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -173,10 +172,6 @@ module VoucherifySdk
|
|
|
173
172
|
def list_invalid_properties
|
|
174
173
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
175
174
|
invalid_properties = Array.new
|
|
176
|
-
if @type.nil?
|
|
177
|
-
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
|
178
|
-
end
|
|
179
|
-
|
|
180
175
|
invalid_properties
|
|
181
176
|
end
|
|
182
177
|
|
|
@@ -184,7 +179,8 @@ module VoucherifySdk
|
|
|
184
179
|
# @return true if the model is valid
|
|
185
180
|
def valid?
|
|
186
181
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
187
|
-
|
|
182
|
+
type_validator = EnumAttributeValidator.new('String', ["CREDITS_REDEMPTION", "CREDITS_REFUND", "CREDITS_ADDITION", "CREDITS_REMOVAL", "POINTS_ACCRUAL", "POINTS_REDEMPTION", "POINTS_REFUND", "POINTS_ADDITION", "POINTS_REMOVAL", "POINTS_EXPIRATION", "POINTS_TRANSFER_IN", "POINTS_TRANSFER_OUT"])
|
|
183
|
+
return false unless type_validator.valid?(@type)
|
|
188
184
|
true
|
|
189
185
|
end
|
|
190
186
|
|
|
@@ -199,10 +195,10 @@ module VoucherifySdk
|
|
|
199
195
|
campaign_id == o.campaign_id &&
|
|
200
196
|
source == o.source &&
|
|
201
197
|
reason == o.reason &&
|
|
202
|
-
type == o.type &&
|
|
203
|
-
details == o.details &&
|
|
204
198
|
related_transaction_id == o.related_transaction_id &&
|
|
205
|
-
created_at == o.created_at
|
|
199
|
+
created_at == o.created_at &&
|
|
200
|
+
details == o.details &&
|
|
201
|
+
type == o.type
|
|
206
202
|
end
|
|
207
203
|
|
|
208
204
|
# @see the `==` method
|
|
@@ -214,7 +210,7 @@ module VoucherifySdk
|
|
|
214
210
|
# Calculates hash code according to all attributes.
|
|
215
211
|
# @return [Integer] Hash code
|
|
216
212
|
def hash
|
|
217
|
-
[id, source_id, voucher_id, campaign_id, source, reason,
|
|
213
|
+
[id, source_id, voucher_id, campaign_id, source, reason, related_transaction_id, created_at, details, type].hash
|
|
218
214
|
end
|
|
219
215
|
|
|
220
216
|
# Builds the object from hash
|