voucherify 8.0.1 → 8.0.2
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -19,18 +19,21 @@ module VoucherifySdk
|
|
19
19
|
# The type of voucher whose balance is being adjusted due to the transaction.
|
20
20
|
attr_accessor :type
|
21
21
|
|
22
|
-
# The number of all points accumulated on the card as affected by add or subtract operations.
|
22
|
+
# The number of all points or credits accumulated on the card as affected by add or subtract operations.
|
23
23
|
attr_accessor :total
|
24
24
|
|
25
25
|
# The type of the object represented by the JSON.
|
26
26
|
attr_accessor :object
|
27
27
|
|
28
|
-
# Points added or subtracted in the transaction.
|
28
|
+
# Points added or subtracted in the transaction of a loyalty card.
|
29
29
|
attr_accessor :points
|
30
30
|
|
31
|
-
# The available points on the card after the transaction as affected by redemption or rollback.
|
31
|
+
# The available points or credits on the card after the transaction as affected by redemption or rollback.
|
32
32
|
attr_accessor :balance
|
33
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
|
+
|
34
37
|
attr_accessor :related_object
|
35
38
|
|
36
39
|
class EnumAttributeValidator
|
@@ -63,6 +66,7 @@ module VoucherifySdk
|
|
63
66
|
:'object' => :'object',
|
64
67
|
:'points' => :'points',
|
65
68
|
:'balance' => :'balance',
|
69
|
+
:'operation_type' => :'operation_type',
|
66
70
|
:'related_object' => :'related_object'
|
67
71
|
}
|
68
72
|
end
|
@@ -80,6 +84,7 @@ module VoucherifySdk
|
|
80
84
|
:'object' => :'String',
|
81
85
|
:'points' => :'Integer',
|
82
86
|
:'balance' => :'Integer',
|
87
|
+
:'operation_type' => :'String',
|
83
88
|
:'related_object' => :'LoyaltyCardTransactionDetailsBalanceRelatedObject'
|
84
89
|
}
|
85
90
|
end
|
@@ -92,6 +97,7 @@ module VoucherifySdk
|
|
92
97
|
:'object',
|
93
98
|
:'points',
|
94
99
|
:'balance',
|
100
|
+
:'operation_type',
|
95
101
|
:'related_object'
|
96
102
|
])
|
97
103
|
end
|
@@ -106,8 +112,6 @@ module VoucherifySdk
|
|
106
112
|
|
107
113
|
if attributes.key?(:'type')
|
108
114
|
self.type = attributes[:'type']
|
109
|
-
else
|
110
|
-
self.type = 'loyalty_card'
|
111
115
|
end
|
112
116
|
|
113
117
|
if attributes.key?(:'total')
|
@@ -128,6 +132,10 @@ module VoucherifySdk
|
|
128
132
|
self.balance = attributes[:'balance']
|
129
133
|
end
|
130
134
|
|
135
|
+
if attributes.key?(:'operation_type')
|
136
|
+
self.operation_type = attributes[:'operation_type']
|
137
|
+
end
|
138
|
+
|
131
139
|
if attributes.key?(:'related_object')
|
132
140
|
self.related_object = attributes[:'related_object']
|
133
141
|
end
|
@@ -138,16 +146,6 @@ module VoucherifySdk
|
|
138
146
|
def list_invalid_properties
|
139
147
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
140
148
|
invalid_properties = Array.new
|
141
|
-
pattern = Regexp.new(/loyalty_card/)
|
142
|
-
if !@type.nil? && @type !~ pattern
|
143
|
-
invalid_properties.push("invalid value for \"type\", must conform to the pattern #{pattern}.")
|
144
|
-
end
|
145
|
-
|
146
|
-
pattern = Regexp.new(/balance/)
|
147
|
-
if !@object.nil? && @object !~ pattern
|
148
|
-
invalid_properties.push("invalid value for \"object\", must conform to the pattern #{pattern}.")
|
149
|
-
end
|
150
|
-
|
151
149
|
invalid_properties
|
152
150
|
end
|
153
151
|
|
@@ -155,12 +153,12 @@ module VoucherifySdk
|
|
155
153
|
# @return true if the model is valid
|
156
154
|
def valid?
|
157
155
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
158
|
-
type_validator = EnumAttributeValidator.new('String', ["loyalty_card"])
|
156
|
+
type_validator = EnumAttributeValidator.new('String', ["loyalty_card", "gift_voucher"])
|
159
157
|
return false unless type_validator.valid?(@type)
|
160
|
-
return false if !@type.nil? && @type !~ Regexp.new(/loyalty_card/)
|
161
158
|
object_validator = EnumAttributeValidator.new('String', ["balance"])
|
162
159
|
return false unless object_validator.valid?(@object)
|
163
|
-
|
160
|
+
operation_type_validator = EnumAttributeValidator.new('String', ["MANUAL", "AUTOMATIC"])
|
161
|
+
return false unless operation_type_validator.valid?(@operation_type)
|
164
162
|
true
|
165
163
|
end
|
166
164
|
|
@@ -174,6 +172,7 @@ module VoucherifySdk
|
|
174
172
|
object == o.object &&
|
175
173
|
points == o.points &&
|
176
174
|
balance == o.balance &&
|
175
|
+
operation_type == o.operation_type &&
|
177
176
|
related_object == o.related_object
|
178
177
|
end
|
179
178
|
|
@@ -186,7 +185,7 @@ module VoucherifySdk
|
|
186
185
|
# Calculates hash code according to all attributes.
|
187
186
|
# @return [Integer] Hash code
|
188
187
|
def hash
|
189
|
-
[type, total, object, points, balance, related_object].hash
|
188
|
+
[type, total, object, points, balance, operation_type, related_object].hash
|
190
189
|
end
|
191
190
|
|
192
191
|
# Builds the object from hash
|
@@ -16,7 +16,7 @@ require 'time'
|
|
16
16
|
module VoucherifySdk
|
17
17
|
# Defines the resource that is being modified with the values that are returned in the balance object.
|
18
18
|
class LoyaltyCardTransactionDetailsBalanceRelatedObject
|
19
|
-
# Identifies the voucher that is being modified
|
19
|
+
# Identifies the voucher that is being modified. The ID is assigned by the Voucherify API.
|
20
20
|
attr_accessor :id
|
21
21
|
|
22
22
|
# The object being modified, i.e. voucher.
|
@@ -97,11 +97,6 @@ module VoucherifySdk
|
|
97
97
|
def list_invalid_properties
|
98
98
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
99
99
|
invalid_properties = Array.new
|
100
|
-
pattern = Regexp.new(/voucher/)
|
101
|
-
if !@type.nil? && @type !~ pattern
|
102
|
-
invalid_properties.push("invalid value for \"type\", must conform to the pattern #{pattern}.")
|
103
|
-
end
|
104
|
-
|
105
100
|
invalid_properties
|
106
101
|
end
|
107
102
|
|
@@ -111,7 +106,6 @@ module VoucherifySdk
|
|
111
106
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
112
107
|
type_validator = EnumAttributeValidator.new('String', ["voucher"])
|
113
108
|
return false unless type_validator.valid?(@type)
|
114
|
-
return false if !@type.nil? && @type !~ Regexp.new(/voucher/)
|
115
109
|
true
|
116
110
|
end
|
117
111
|
|
@@ -0,0 +1,323 @@
|
|
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 the details about expiring loyalty points.
|
18
|
+
class LoyaltyPointsBucket
|
19
|
+
# Unique identifier of the loyalty points bucket.
|
20
|
+
attr_accessor :id
|
21
|
+
|
22
|
+
# Unique identifier of the parent loyalty card.
|
23
|
+
attr_accessor :voucher_id
|
24
|
+
|
25
|
+
# Unique identifier of the parent campaign.
|
26
|
+
attr_accessor :campaign_id
|
27
|
+
|
28
|
+
attr_accessor :bucket
|
29
|
+
|
30
|
+
# Loyalty point point bucket status.
|
31
|
+
attr_accessor :status
|
32
|
+
|
33
|
+
# Date when the number of points defined in the bucket object are due to expire.
|
34
|
+
attr_accessor :expires_at
|
35
|
+
|
36
|
+
# Timestamp representing the date and time when the loyalty point bucket object was created in ISO 8601 format.
|
37
|
+
attr_accessor :created_at
|
38
|
+
|
39
|
+
# Timestamp representing the date and time when the loyalty point bucket object was updated in ISO 8601 format.
|
40
|
+
attr_accessor :updated_at
|
41
|
+
|
42
|
+
# The type of the object represented by JSON. This object stores information about the loyalty point bucket.
|
43
|
+
attr_accessor :object
|
44
|
+
|
45
|
+
class EnumAttributeValidator
|
46
|
+
attr_reader :datatype
|
47
|
+
attr_reader :allowable_values
|
48
|
+
|
49
|
+
def initialize(datatype, allowable_values)
|
50
|
+
@allowable_values = allowable_values.map do |value|
|
51
|
+
case datatype.to_s
|
52
|
+
when /Integer/i
|
53
|
+
value.to_i
|
54
|
+
when /Float/i
|
55
|
+
value.to_f
|
56
|
+
else
|
57
|
+
value
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def valid?(value)
|
63
|
+
!value || allowable_values.include?(value)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
68
|
+
def self.attribute_map
|
69
|
+
{
|
70
|
+
:'id' => :'id',
|
71
|
+
:'voucher_id' => :'voucher_id',
|
72
|
+
:'campaign_id' => :'campaign_id',
|
73
|
+
:'bucket' => :'bucket',
|
74
|
+
:'status' => :'status',
|
75
|
+
:'expires_at' => :'expires_at',
|
76
|
+
:'created_at' => :'created_at',
|
77
|
+
:'updated_at' => :'updated_at',
|
78
|
+
:'object' => :'object'
|
79
|
+
}
|
80
|
+
end
|
81
|
+
|
82
|
+
# Returns all the JSON keys this model knows about
|
83
|
+
def self.acceptable_attributes
|
84
|
+
attribute_map.values
|
85
|
+
end
|
86
|
+
|
87
|
+
# Attribute type mapping.
|
88
|
+
def self.openapi_types
|
89
|
+
{
|
90
|
+
:'id' => :'String',
|
91
|
+
:'voucher_id' => :'String',
|
92
|
+
:'campaign_id' => :'String',
|
93
|
+
:'bucket' => :'LoyaltyPointsBucketBucket',
|
94
|
+
:'status' => :'String',
|
95
|
+
:'expires_at' => :'Time',
|
96
|
+
:'created_at' => :'Time',
|
97
|
+
:'updated_at' => :'Time',
|
98
|
+
:'object' => :'String'
|
99
|
+
}
|
100
|
+
end
|
101
|
+
|
102
|
+
# List of attributes with nullable: true
|
103
|
+
def self.openapi_nullable
|
104
|
+
Set.new([
|
105
|
+
:'id',
|
106
|
+
:'voucher_id',
|
107
|
+
:'campaign_id',
|
108
|
+
:'bucket',
|
109
|
+
:'status',
|
110
|
+
:'expires_at',
|
111
|
+
:'created_at',
|
112
|
+
:'updated_at',
|
113
|
+
:'object'
|
114
|
+
])
|
115
|
+
end
|
116
|
+
|
117
|
+
# Initializes the object
|
118
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
119
|
+
def initialize(attributes = {})
|
120
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
121
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
122
|
+
h[k.to_sym] = v
|
123
|
+
}
|
124
|
+
|
125
|
+
if attributes.key?(:'id')
|
126
|
+
self.id = attributes[:'id']
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.key?(:'voucher_id')
|
130
|
+
self.voucher_id = attributes[:'voucher_id']
|
131
|
+
end
|
132
|
+
|
133
|
+
if attributes.key?(:'campaign_id')
|
134
|
+
self.campaign_id = attributes[:'campaign_id']
|
135
|
+
end
|
136
|
+
|
137
|
+
if attributes.key?(:'bucket')
|
138
|
+
self.bucket = attributes[:'bucket']
|
139
|
+
end
|
140
|
+
|
141
|
+
if attributes.key?(:'status')
|
142
|
+
self.status = attributes[:'status']
|
143
|
+
end
|
144
|
+
|
145
|
+
if attributes.key?(:'expires_at')
|
146
|
+
self.expires_at = attributes[:'expires_at']
|
147
|
+
end
|
148
|
+
|
149
|
+
if attributes.key?(:'created_at')
|
150
|
+
self.created_at = attributes[:'created_at']
|
151
|
+
end
|
152
|
+
|
153
|
+
if attributes.key?(:'updated_at')
|
154
|
+
self.updated_at = attributes[:'updated_at']
|
155
|
+
end
|
156
|
+
|
157
|
+
if attributes.key?(:'object')
|
158
|
+
self.object = attributes[:'object']
|
159
|
+
else
|
160
|
+
self.object = 'loyalty_points_bucket'
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
165
|
+
# @return Array for valid properties with the reasons
|
166
|
+
def list_invalid_properties
|
167
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
168
|
+
invalid_properties = Array.new
|
169
|
+
invalid_properties
|
170
|
+
end
|
171
|
+
|
172
|
+
# Check to see if the all the properties in the model are valid
|
173
|
+
# @return true if the model is valid
|
174
|
+
def valid?
|
175
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
176
|
+
object_validator = EnumAttributeValidator.new('String', ["loyalty_points_bucket"])
|
177
|
+
return false unless object_validator.valid?(@object)
|
178
|
+
true
|
179
|
+
end
|
180
|
+
|
181
|
+
# Checks equality by comparing each attribute.
|
182
|
+
# @param [Object] Object to be compared
|
183
|
+
def ==(o)
|
184
|
+
return true if self.equal?(o)
|
185
|
+
self.class == o.class &&
|
186
|
+
id == o.id &&
|
187
|
+
voucher_id == o.voucher_id &&
|
188
|
+
campaign_id == o.campaign_id &&
|
189
|
+
bucket == o.bucket &&
|
190
|
+
status == o.status &&
|
191
|
+
expires_at == o.expires_at &&
|
192
|
+
created_at == o.created_at &&
|
193
|
+
updated_at == o.updated_at &&
|
194
|
+
object == o.object
|
195
|
+
end
|
196
|
+
|
197
|
+
# @see the `==` method
|
198
|
+
# @param [Object] Object to be compared
|
199
|
+
def eql?(o)
|
200
|
+
self == o
|
201
|
+
end
|
202
|
+
|
203
|
+
# Calculates hash code according to all attributes.
|
204
|
+
# @return [Integer] Hash code
|
205
|
+
def hash
|
206
|
+
[id, voucher_id, campaign_id, bucket, status, expires_at, created_at, updated_at, object].hash
|
207
|
+
end
|
208
|
+
|
209
|
+
# Builds the object from hash
|
210
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
211
|
+
# @return [Object] Returns the model itself
|
212
|
+
def self.build_from_hash(attributes)
|
213
|
+
return nil unless attributes.is_a?(Hash)
|
214
|
+
attributes = attributes.transform_keys(&:to_sym)
|
215
|
+
transformed_hash = {}
|
216
|
+
openapi_types.each_pair do |key, type|
|
217
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
218
|
+
transformed_hash["#{key}"] = nil
|
219
|
+
elsif type =~ /\AArray<(.*)>/i
|
220
|
+
# check to ensure the input is an array given that the attribute
|
221
|
+
# is documented as an array but the input is not
|
222
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
223
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
224
|
+
end
|
225
|
+
elsif !attributes[attribute_map[key]].nil?
|
226
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
227
|
+
end
|
228
|
+
end
|
229
|
+
new(transformed_hash)
|
230
|
+
end
|
231
|
+
|
232
|
+
# Deserializes the data based on type
|
233
|
+
# @param string type Data type
|
234
|
+
# @param string value Value to be deserialized
|
235
|
+
# @return [Object] Deserialized data
|
236
|
+
def self._deserialize(type, value)
|
237
|
+
case type.to_sym
|
238
|
+
when :Time
|
239
|
+
Time.parse(value)
|
240
|
+
when :Date
|
241
|
+
Date.parse(value)
|
242
|
+
when :String
|
243
|
+
value.to_s
|
244
|
+
when :Integer
|
245
|
+
value.to_i
|
246
|
+
when :Float
|
247
|
+
value.to_f
|
248
|
+
when :Boolean
|
249
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
250
|
+
true
|
251
|
+
else
|
252
|
+
false
|
253
|
+
end
|
254
|
+
when :Object
|
255
|
+
# generic object (usually a Hash), return directly
|
256
|
+
value
|
257
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
258
|
+
inner_type = Regexp.last_match[:inner_type]
|
259
|
+
value.map { |v| _deserialize(inner_type, v) }
|
260
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
261
|
+
k_type = Regexp.last_match[:k_type]
|
262
|
+
v_type = Regexp.last_match[:v_type]
|
263
|
+
{}.tap do |hash|
|
264
|
+
value.each do |k, v|
|
265
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
266
|
+
end
|
267
|
+
end
|
268
|
+
else # model
|
269
|
+
# models (e.g. Pet) or oneOf
|
270
|
+
klass = VoucherifySdk.const_get(type)
|
271
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
# Returns the string representation of the object
|
276
|
+
# @return [String] String presentation of the object
|
277
|
+
def to_s
|
278
|
+
to_hash.to_s
|
279
|
+
end
|
280
|
+
|
281
|
+
# to_body is an alias to to_hash (backward compatibility)
|
282
|
+
# @return [Hash] Returns the object in the form of hash
|
283
|
+
def to_body
|
284
|
+
to_hash
|
285
|
+
end
|
286
|
+
|
287
|
+
# Returns the object in the form of hash
|
288
|
+
# @return [Hash] Returns the object in the form of hash
|
289
|
+
def to_hash
|
290
|
+
hash = {}
|
291
|
+
self.class.attribute_map.each_pair do |attr, param|
|
292
|
+
value = self.send(attr)
|
293
|
+
if value.nil?
|
294
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
295
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
296
|
+
end
|
297
|
+
|
298
|
+
hash[param] = _to_hash(value)
|
299
|
+
end
|
300
|
+
hash
|
301
|
+
end
|
302
|
+
|
303
|
+
# Outputs non-array value in the form of hash
|
304
|
+
# For object, use to_hash. Otherwise, just return the value
|
305
|
+
# @param [Object] value Any valid value
|
306
|
+
# @return [Hash] Returns the value in the form of hash
|
307
|
+
def _to_hash(value)
|
308
|
+
if value.is_a?(Array)
|
309
|
+
value.compact.map { |v| _to_hash(v) }
|
310
|
+
elsif value.is_a?(Hash)
|
311
|
+
{}.tap do |hash|
|
312
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
313
|
+
end
|
314
|
+
elsif value.respond_to? :to_hash
|
315
|
+
value.to_hash
|
316
|
+
else
|
317
|
+
value
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
321
|
+
end
|
322
|
+
|
323
|
+
end
|
@@ -0,0 +1,210 @@
|
|
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 number of points stored in this loyalty point bucket.
|
18
|
+
class LoyaltyPointsBucketBucket
|
19
|
+
# Total number of points in the loyalty point bucket.
|
20
|
+
attr_accessor :total_points
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'total_points' => :'total_points'
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
# Returns all the JSON keys this model knows about
|
30
|
+
def self.acceptable_attributes
|
31
|
+
attribute_map.values
|
32
|
+
end
|
33
|
+
|
34
|
+
# Attribute type mapping.
|
35
|
+
def self.openapi_types
|
36
|
+
{
|
37
|
+
:'total_points' => :'Integer'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# List of attributes with nullable: true
|
42
|
+
def self.openapi_nullable
|
43
|
+
Set.new([
|
44
|
+
:'total_points'
|
45
|
+
])
|
46
|
+
end
|
47
|
+
|
48
|
+
# Initializes the object
|
49
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
50
|
+
def initialize(attributes = {})
|
51
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
52
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
53
|
+
h[k.to_sym] = v
|
54
|
+
}
|
55
|
+
|
56
|
+
if attributes.key?(:'total_points')
|
57
|
+
self.total_points = attributes[:'total_points']
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
62
|
+
# @return Array for valid properties with the reasons
|
63
|
+
def list_invalid_properties
|
64
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
65
|
+
invalid_properties = Array.new
|
66
|
+
invalid_properties
|
67
|
+
end
|
68
|
+
|
69
|
+
# Check to see if the all the properties in the model are valid
|
70
|
+
# @return true if the model is valid
|
71
|
+
def valid?
|
72
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
73
|
+
true
|
74
|
+
end
|
75
|
+
|
76
|
+
# Checks equality by comparing each attribute.
|
77
|
+
# @param [Object] Object to be compared
|
78
|
+
def ==(o)
|
79
|
+
return true if self.equal?(o)
|
80
|
+
self.class == o.class &&
|
81
|
+
total_points == o.total_points
|
82
|
+
end
|
83
|
+
|
84
|
+
# @see the `==` method
|
85
|
+
# @param [Object] Object to be compared
|
86
|
+
def eql?(o)
|
87
|
+
self == o
|
88
|
+
end
|
89
|
+
|
90
|
+
# Calculates hash code according to all attributes.
|
91
|
+
# @return [Integer] Hash code
|
92
|
+
def hash
|
93
|
+
[total_points].hash
|
94
|
+
end
|
95
|
+
|
96
|
+
# Builds the object from hash
|
97
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
98
|
+
# @return [Object] Returns the model itself
|
99
|
+
def self.build_from_hash(attributes)
|
100
|
+
return nil unless attributes.is_a?(Hash)
|
101
|
+
attributes = attributes.transform_keys(&:to_sym)
|
102
|
+
transformed_hash = {}
|
103
|
+
openapi_types.each_pair do |key, type|
|
104
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
105
|
+
transformed_hash["#{key}"] = nil
|
106
|
+
elsif type =~ /\AArray<(.*)>/i
|
107
|
+
# check to ensure the input is an array given that the attribute
|
108
|
+
# is documented as an array but the input is not
|
109
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
110
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
111
|
+
end
|
112
|
+
elsif !attributes[attribute_map[key]].nil?
|
113
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
114
|
+
end
|
115
|
+
end
|
116
|
+
new(transformed_hash)
|
117
|
+
end
|
118
|
+
|
119
|
+
# Deserializes the data based on type
|
120
|
+
# @param string type Data type
|
121
|
+
# @param string value Value to be deserialized
|
122
|
+
# @return [Object] Deserialized data
|
123
|
+
def self._deserialize(type, value)
|
124
|
+
case type.to_sym
|
125
|
+
when :Time
|
126
|
+
Time.parse(value)
|
127
|
+
when :Date
|
128
|
+
Date.parse(value)
|
129
|
+
when :String
|
130
|
+
value.to_s
|
131
|
+
when :Integer
|
132
|
+
value.to_i
|
133
|
+
when :Float
|
134
|
+
value.to_f
|
135
|
+
when :Boolean
|
136
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
137
|
+
true
|
138
|
+
else
|
139
|
+
false
|
140
|
+
end
|
141
|
+
when :Object
|
142
|
+
# generic object (usually a Hash), return directly
|
143
|
+
value
|
144
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
145
|
+
inner_type = Regexp.last_match[:inner_type]
|
146
|
+
value.map { |v| _deserialize(inner_type, v) }
|
147
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
148
|
+
k_type = Regexp.last_match[:k_type]
|
149
|
+
v_type = Regexp.last_match[:v_type]
|
150
|
+
{}.tap do |hash|
|
151
|
+
value.each do |k, v|
|
152
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
else # model
|
156
|
+
# models (e.g. Pet) or oneOf
|
157
|
+
klass = VoucherifySdk.const_get(type)
|
158
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
# Returns the string representation of the object
|
163
|
+
# @return [String] String presentation of the object
|
164
|
+
def to_s
|
165
|
+
to_hash.to_s
|
166
|
+
end
|
167
|
+
|
168
|
+
# to_body is an alias to to_hash (backward compatibility)
|
169
|
+
# @return [Hash] Returns the object in the form of hash
|
170
|
+
def to_body
|
171
|
+
to_hash
|
172
|
+
end
|
173
|
+
|
174
|
+
# Returns the object in the form of hash
|
175
|
+
# @return [Hash] Returns the object in the form of hash
|
176
|
+
def to_hash
|
177
|
+
hash = {}
|
178
|
+
self.class.attribute_map.each_pair do |attr, param|
|
179
|
+
value = self.send(attr)
|
180
|
+
if value.nil?
|
181
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
182
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
183
|
+
end
|
184
|
+
|
185
|
+
hash[param] = _to_hash(value)
|
186
|
+
end
|
187
|
+
hash
|
188
|
+
end
|
189
|
+
|
190
|
+
# Outputs non-array value in the form of hash
|
191
|
+
# For object, use to_hash. Otherwise, just return the value
|
192
|
+
# @param [Object] value Any valid value
|
193
|
+
# @return [Hash] Returns the value in the form of hash
|
194
|
+
def _to_hash(value)
|
195
|
+
if value.is_a?(Array)
|
196
|
+
value.compact.map { |v| _to_hash(v) }
|
197
|
+
elsif value.is_a?(Hash)
|
198
|
+
{}.tap do |hash|
|
199
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
200
|
+
end
|
201
|
+
elsif value.respond_to? :to_hash
|
202
|
+
value.to_hash
|
203
|
+
else
|
204
|
+
value
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
end
|
209
|
+
|
210
|
+
end
|
@@ -37,7 +37,7 @@ module VoucherifySdk
|
|
37
37
|
# Array of items applied to the order. It can include up 500 items.
|
38
38
|
attr_accessor :items
|
39
39
|
|
40
|
-
# A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format.
|
40
|
+
# A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. It can be used to define business validation rules or discount formulas.
|
41
41
|
attr_accessor :metadata
|
42
42
|
|
43
43
|
class EnumAttributeValidator
|
@@ -55,7 +55,7 @@ module VoucherifySdk
|
|
55
55
|
# Array of items applied to the order. It can include up 500 items.
|
56
56
|
attr_accessor :items
|
57
57
|
|
58
|
-
# A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format.
|
58
|
+
# A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. It can be used to define business validation rules or discount formulas.
|
59
59
|
attr_accessor :metadata
|
60
60
|
|
61
61
|
# The type of the object represented by JSON.
|