talon_one 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +31 -5
- data/docs/ApplicationCampaignStats.md +27 -0
- data/docs/ApplicationReferee.md +27 -0
- data/docs/AwardGiveawayEffectProps.md +25 -0
- data/docs/Campaign.md +2 -0
- data/docs/Coupon.md +1 -1
- data/docs/CustomEffect.md +41 -0
- data/docs/CustomEffectProps.md +19 -0
- data/docs/CustomerInventory.md +4 -2
- data/docs/CustomerProfileIntegrationRequestV2.md +1 -1
- data/docs/Environment.md +10 -0
- data/docs/Giveaway.md +33 -0
- data/docs/GiveawaysPool.md +33 -0
- data/docs/ImportEntity.md +17 -0
- data/docs/InlineResponse20010.md +3 -3
- data/docs/InlineResponse20011.md +4 -2
- data/docs/InlineResponse20012.md +2 -4
- data/docs/InlineResponse20013.md +3 -3
- data/docs/InlineResponse20014.md +2 -2
- data/docs/InlineResponse20015.md +2 -2
- data/docs/InlineResponse20016.md +3 -3
- data/docs/InlineResponse20017.md +2 -2
- data/docs/InlineResponse20018.md +3 -3
- data/docs/InlineResponse20019.md +5 -3
- data/docs/InlineResponse20020.md +2 -2
- data/docs/InlineResponse20021.md +1 -1
- data/docs/InlineResponse20022.md +1 -1
- data/docs/InlineResponse20023.md +1 -1
- data/docs/InlineResponse20024.md +1 -1
- data/docs/InlineResponse20025.md +1 -1
- data/docs/InlineResponse20026.md +1 -1
- data/docs/InlineResponse20027.md +4 -2
- data/docs/InlineResponse20028.md +2 -4
- data/docs/InlineResponse20029.md +1 -1
- data/docs/InlineResponse2006.md +2 -2
- data/docs/InlineResponse2007.md +3 -3
- data/docs/InlineResponse2008.md +1 -1
- data/docs/InlineResponse2009.md +2 -2
- data/docs/{InlineResponse20030.md → InlineResponse201.md} +3 -3
- data/docs/IntegrationApi.md +77 -11
- data/docs/IntegrationRequest.md +1 -1
- data/docs/IntegrationStateV2.md +3 -1
- data/docs/InventoryCoupon.md +53 -0
- data/docs/LoyaltyProgram.md +3 -1
- data/docs/LoyaltyProgramEntity.md +17 -0
- data/docs/LoyaltyTier.md +25 -0
- data/docs/ManagementApi.md +370 -69
- data/docs/NewCustomEffect.md +29 -0
- data/docs/NewGiveawaysPool.md +21 -0
- data/docs/NewLoyaltyTier.md +19 -0
- data/docs/NewReferral.md +10 -6
- data/docs/NewReferralsForMultipleAdvocates.md +31 -0
- data/docs/NewRole.md +1 -1
- data/docs/Referral.md +13 -7
- data/docs/ReferralConstraints.md +21 -0
- data/docs/Role.md +8 -4
- data/docs/UpdateCustomEffect.md +29 -0
- data/docs/UpdateLoyaltyTier.md +19 -0
- data/docs/UpdateReferral.md +25 -0
- data/docs/UpdateRole.md +1 -1
- data/docs/WillAwardGiveawayEffectProps.md +21 -0
- data/lib/talon_one.rb +21 -1
- data/lib/talon_one/api/integration_api.rb +80 -10
- data/lib/talon_one/api/management_api.rb +460 -97
- data/lib/talon_one/models/application_campaign_stats.rb +288 -0
- data/lib/talon_one/models/application_referee.rb +288 -0
- data/lib/talon_one/models/attribute.rb +2 -2
- data/lib/talon_one/models/award_giveaway_effect_props.rb +273 -0
- data/lib/talon_one/models/campaign.rb +11 -1
- data/lib/talon_one/models/coupon.rb +1 -1
- data/lib/talon_one/models/custom_effect.rb +377 -0
- data/lib/talon_one/models/custom_effect_props.rb +228 -0
- data/lib/talon_one/models/customer_inventory.rb +15 -4
- data/lib/talon_one/models/customer_profile_integration_request_v2.rb +1 -1
- data/lib/talon_one/models/environment.rb +61 -1
- data/lib/talon_one/models/export.rb +2 -2
- data/lib/talon_one/models/giveaway.rb +308 -0
- data/lib/talon_one/models/giveaways_pool.rb +315 -0
- data/lib/talon_one/models/import_entity.rb +207 -0
- data/lib/talon_one/models/inline_response20010.rb +11 -11
- data/lib/talon_one/models/inline_response20011.rb +11 -7
- data/lib/talon_one/models/inline_response20012.rb +6 -10
- data/lib/talon_one/models/inline_response20013.rb +11 -11
- data/lib/talon_one/models/inline_response20014.rb +10 -10
- data/lib/talon_one/models/inline_response20015.rb +1 -6
- data/lib/talon_one/models/inline_response20016.rb +13 -8
- data/lib/talon_one/models/inline_response20017.rb +10 -10
- data/lib/talon_one/models/inline_response20018.rb +11 -11
- data/lib/talon_one/models/inline_response20019.rb +11 -7
- data/lib/talon_one/models/inline_response20020.rb +6 -1
- data/lib/talon_one/models/inline_response20021.rb +1 -1
- data/lib/talon_one/models/inline_response20022.rb +1 -1
- data/lib/talon_one/models/inline_response20023.rb +1 -1
- data/lib/talon_one/models/inline_response20024.rb +1 -1
- data/lib/talon_one/models/inline_response20025.rb +1 -1
- data/lib/talon_one/models/inline_response20026.rb +1 -1
- data/lib/talon_one/models/inline_response20027.rb +11 -7
- data/lib/talon_one/models/inline_response20028.rb +7 -11
- data/lib/talon_one/models/inline_response20029.rb +1 -1
- data/lib/talon_one/models/inline_response2006.rb +10 -10
- data/lib/talon_one/models/inline_response2007.rb +11 -11
- data/lib/talon_one/models/inline_response2008.rb +1 -1
- data/lib/talon_one/models/inline_response2009.rb +10 -10
- data/lib/talon_one/models/{inline_response20030.rb → inline_response201.rb} +4 -4
- data/lib/talon_one/models/integration_request.rb +1 -1
- data/lib/talon_one/models/integration_state_v2.rb +15 -4
- data/lib/talon_one/models/inventory_coupon.rb +499 -0
- data/lib/talon_one/models/loyalty_program.rb +16 -4
- data/lib/talon_one/models/loyalty_program_entity.rb +212 -0
- data/lib/talon_one/models/loyalty_tier.rb +301 -0
- data/lib/talon_one/models/new_attribute.rb +2 -2
- data/lib/talon_one/models/new_custom_effect.rb +291 -0
- data/lib/talon_one/models/new_giveaways_pool.rb +234 -0
- data/lib/talon_one/models/new_loyalty_tier.rb +256 -0
- data/lib/talon_one/models/new_referral.rb +64 -19
- data/lib/talon_one/models/new_referrals_for_multiple_advocates.rb +349 -0
- data/lib/talon_one/models/new_role.rb +1 -1
- data/lib/talon_one/models/referral.rb +86 -47
- data/lib/talon_one/models/referral_constraints.rb +251 -0
- data/lib/talon_one/models/role.rb +44 -4
- data/lib/talon_one/models/update_custom_effect.rb +292 -0
- data/lib/talon_one/models/update_loyalty_tier.rb +256 -0
- data/lib/talon_one/models/update_referral.rb +271 -0
- data/lib/talon_one/models/update_role.rb +1 -1
- data/lib/talon_one/models/will_award_giveaway_effect_props.rb +243 -0
- data/lib/talon_one/version.rb +1 -1
- data/spec/api/integration_api_spec.rb +19 -5
- data/spec/api/management_api_spec.rb +102 -33
- data/spec/models/application_campaign_stats_spec.rb +71 -0
- data/spec/models/application_referee_spec.rb +71 -0
- data/spec/models/attribute_spec.rb +1 -1
- data/spec/models/award_giveaway_effect_props_spec.rb +65 -0
- data/spec/models/campaign_spec.rb +7 -1
- data/spec/models/custom_effect_props_spec.rb +47 -0
- data/spec/models/custom_effect_spec.rb +113 -0
- data/spec/models/customer_inventory_spec.rb +6 -0
- data/spec/models/customer_profile_integration_request_v2_spec.rb +1 -1
- data/spec/models/environment_spec.rb +30 -0
- data/spec/models/export_spec.rb +1 -1
- data/spec/models/giveaway_spec.rb +89 -0
- data/spec/models/giveaways_pool_spec.rb +89 -0
- data/spec/models/import_entity_spec.rb +41 -0
- data/spec/models/inline_response20010_spec.rb +1 -1
- data/spec/models/inline_response20011_spec.rb +6 -0
- data/spec/models/inline_response20012_spec.rb +0 -6
- data/spec/models/inline_response20013_spec.rb +1 -1
- data/spec/models/inline_response20014_spec.rb +1 -1
- data/spec/models/inline_response20016_spec.rb +1 -1
- data/spec/models/inline_response20017_spec.rb +1 -1
- data/spec/models/inline_response20018_spec.rb +1 -1
- data/spec/models/inline_response20019_spec.rb +6 -0
- data/spec/models/inline_response20027_spec.rb +6 -0
- data/spec/models/inline_response20028_spec.rb +0 -6
- data/spec/models/inline_response2006_spec.rb +1 -1
- data/spec/models/inline_response2007_spec.rb +1 -1
- data/spec/models/inline_response2009_spec.rb +1 -1
- data/spec/models/{inline_response20030_spec.rb → inline_response201_spec.rb} +6 -6
- data/spec/models/integration_request_spec.rb +1 -1
- data/spec/models/integration_state_v2_spec.rb +6 -0
- data/spec/models/inventory_coupon_spec.rb +149 -0
- data/spec/models/loyalty_program_entity_spec.rb +41 -0
- data/spec/models/loyalty_program_spec.rb +6 -0
- data/spec/models/loyalty_tier_spec.rb +65 -0
- data/spec/models/new_attribute_spec.rb +1 -1
- data/spec/models/new_campaign_spec.rb +1 -1
- data/spec/models/new_custom_effect_spec.rb +77 -0
- data/spec/models/new_giveaways_pool_spec.rb +53 -0
- data/spec/models/new_loyalty_tier_spec.rb +47 -0
- data/spec/models/new_referral_spec.rb +17 -5
- data/spec/models/new_referrals_for_multiple_advocates_spec.rb +83 -0
- data/spec/models/referral_constraints_spec.rb +53 -0
- data/spec/models/referral_spec.rb +21 -3
- data/spec/models/role_spec.rb +12 -0
- data/spec/models/update_campaign_spec.rb +1 -1
- data/spec/models/update_custom_effect_spec.rb +77 -0
- data/spec/models/update_loyalty_tier_spec.rb +47 -0
- data/spec/models/update_referral_spec.rb +65 -0
- data/spec/models/will_award_giveaway_effect_props_spec.rb +53 -0
- metadata +86 -6
@@ -21,20 +21,29 @@ module TalonOne
|
|
21
21
|
# The exact moment this entity was created.
|
22
22
|
attr_accessor :created
|
23
23
|
|
24
|
+
# Timestamp at which point the referral code becomes valid.
|
25
|
+
attr_accessor :start_date
|
26
|
+
|
27
|
+
# Expiry date of the referral code. Referral never expires if this is omitted, zero, or negative.
|
28
|
+
attr_accessor :expiry_date
|
29
|
+
|
30
|
+
# The number of times a referral code can be used. This can be set to 0 for no limit, but any campaign usage limits will still apply.
|
31
|
+
attr_accessor :usage_limit
|
32
|
+
|
24
33
|
# ID of the campaign from which the referral received the referral code.
|
25
34
|
attr_accessor :campaign_id
|
26
35
|
|
27
|
-
# The Integration
|
36
|
+
# The Integration ID of the Advocate's Profile.
|
28
37
|
attr_accessor :advocate_profile_integration_id
|
29
38
|
|
30
39
|
# An optional Integration ID of the Friend's Profile
|
31
40
|
attr_accessor :friend_profile_integration_id
|
32
41
|
|
33
|
-
#
|
34
|
-
attr_accessor :
|
42
|
+
# Arbitrary properties associated with this item.
|
43
|
+
attr_accessor :attributes
|
35
44
|
|
36
|
-
#
|
37
|
-
attr_accessor :
|
45
|
+
# The ID of the Import which created this referral.
|
46
|
+
attr_accessor :import_id
|
38
47
|
|
39
48
|
# The actual referral code.
|
40
49
|
attr_accessor :code
|
@@ -42,22 +51,25 @@ module TalonOne
|
|
42
51
|
# The number of times this referral code has been successfully used.
|
43
52
|
attr_accessor :usage_counter
|
44
53
|
|
45
|
-
# The
|
46
|
-
attr_accessor :
|
54
|
+
# The ID of the batch the referrals belong to.
|
55
|
+
attr_accessor :batch_id
|
47
56
|
|
48
57
|
# Attribute mapping from ruby-style variable name to JSON key.
|
49
58
|
def self.attribute_map
|
50
59
|
{
|
51
60
|
:'id' => :'id',
|
52
61
|
:'created' => :'created',
|
62
|
+
:'start_date' => :'startDate',
|
63
|
+
:'expiry_date' => :'expiryDate',
|
64
|
+
:'usage_limit' => :'usageLimit',
|
53
65
|
:'campaign_id' => :'campaignId',
|
54
66
|
:'advocate_profile_integration_id' => :'advocateProfileIntegrationId',
|
55
67
|
:'friend_profile_integration_id' => :'friendProfileIntegrationId',
|
56
|
-
:'
|
57
|
-
:'
|
68
|
+
:'attributes' => :'attributes',
|
69
|
+
:'import_id' => :'importId',
|
58
70
|
:'code' => :'code',
|
59
71
|
:'usage_counter' => :'usageCounter',
|
60
|
-
:'
|
72
|
+
:'batch_id' => :'batchId'
|
61
73
|
}
|
62
74
|
end
|
63
75
|
|
@@ -66,14 +78,17 @@ module TalonOne
|
|
66
78
|
{
|
67
79
|
:'id' => :'Integer',
|
68
80
|
:'created' => :'DateTime',
|
81
|
+
:'start_date' => :'DateTime',
|
82
|
+
:'expiry_date' => :'DateTime',
|
83
|
+
:'usage_limit' => :'Integer',
|
69
84
|
:'campaign_id' => :'Integer',
|
70
85
|
:'advocate_profile_integration_id' => :'String',
|
71
86
|
:'friend_profile_integration_id' => :'String',
|
72
|
-
:'
|
73
|
-
:'
|
87
|
+
:'attributes' => :'Object',
|
88
|
+
:'import_id' => :'Integer',
|
74
89
|
:'code' => :'String',
|
75
90
|
:'usage_counter' => :'Integer',
|
76
|
-
:'
|
91
|
+
:'batch_id' => :'String'
|
77
92
|
}
|
78
93
|
end
|
79
94
|
|
@@ -106,6 +121,18 @@ module TalonOne
|
|
106
121
|
self.created = attributes[:'created']
|
107
122
|
end
|
108
123
|
|
124
|
+
if attributes.key?(:'start_date')
|
125
|
+
self.start_date = attributes[:'start_date']
|
126
|
+
end
|
127
|
+
|
128
|
+
if attributes.key?(:'expiry_date')
|
129
|
+
self.expiry_date = attributes[:'expiry_date']
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.key?(:'usage_limit')
|
133
|
+
self.usage_limit = attributes[:'usage_limit']
|
134
|
+
end
|
135
|
+
|
109
136
|
if attributes.key?(:'campaign_id')
|
110
137
|
self.campaign_id = attributes[:'campaign_id']
|
111
138
|
end
|
@@ -118,12 +145,12 @@ module TalonOne
|
|
118
145
|
self.friend_profile_integration_id = attributes[:'friend_profile_integration_id']
|
119
146
|
end
|
120
147
|
|
121
|
-
if attributes.key?(:'
|
122
|
-
self.
|
148
|
+
if attributes.key?(:'attributes')
|
149
|
+
self.attributes = attributes[:'attributes']
|
123
150
|
end
|
124
151
|
|
125
|
-
if attributes.key?(:'
|
126
|
-
self.
|
152
|
+
if attributes.key?(:'import_id')
|
153
|
+
self.import_id = attributes[:'import_id']
|
127
154
|
end
|
128
155
|
|
129
156
|
if attributes.key?(:'code')
|
@@ -134,8 +161,8 @@ module TalonOne
|
|
134
161
|
self.usage_counter = attributes[:'usage_counter']
|
135
162
|
end
|
136
163
|
|
137
|
-
if attributes.key?(:'
|
138
|
-
self.
|
164
|
+
if attributes.key?(:'batch_id')
|
165
|
+
self.batch_id = attributes[:'batch_id']
|
139
166
|
end
|
140
167
|
end
|
141
168
|
|
@@ -151,6 +178,18 @@ module TalonOne
|
|
151
178
|
invalid_properties.push('invalid value for "created", created cannot be nil.')
|
152
179
|
end
|
153
180
|
|
181
|
+
if @usage_limit.nil?
|
182
|
+
invalid_properties.push('invalid value for "usage_limit", usage_limit cannot be nil.')
|
183
|
+
end
|
184
|
+
|
185
|
+
if @usage_limit > 999999
|
186
|
+
invalid_properties.push('invalid value for "usage_limit", must be smaller than or equal to 999999.')
|
187
|
+
end
|
188
|
+
|
189
|
+
if @usage_limit < 0
|
190
|
+
invalid_properties.push('invalid value for "usage_limit", must be greater than or equal to 0.')
|
191
|
+
end
|
192
|
+
|
154
193
|
if @campaign_id.nil?
|
155
194
|
invalid_properties.push('invalid value for "campaign_id", campaign_id cannot be nil.')
|
156
195
|
end
|
@@ -171,14 +210,6 @@ module TalonOne
|
|
171
210
|
invalid_properties.push('invalid value for "usage_counter", usage_counter cannot be nil.')
|
172
211
|
end
|
173
212
|
|
174
|
-
if @usage_limit.nil?
|
175
|
-
invalid_properties.push('invalid value for "usage_limit", usage_limit cannot be nil.')
|
176
|
-
end
|
177
|
-
|
178
|
-
if @usage_limit < 0
|
179
|
-
invalid_properties.push('invalid value for "usage_limit", must be greater than or equal to 0.')
|
180
|
-
end
|
181
|
-
|
182
213
|
invalid_properties
|
183
214
|
end
|
184
215
|
|
@@ -187,30 +218,17 @@ module TalonOne
|
|
187
218
|
def valid?
|
188
219
|
return false if @id.nil?
|
189
220
|
return false if @created.nil?
|
221
|
+
return false if @usage_limit.nil?
|
222
|
+
return false if @usage_limit > 999999
|
223
|
+
return false if @usage_limit < 0
|
190
224
|
return false if @campaign_id.nil?
|
191
225
|
return false if @advocate_profile_integration_id.nil?
|
192
226
|
return false if @code.nil?
|
193
227
|
return false if @code.to_s.length < 4
|
194
228
|
return false if @usage_counter.nil?
|
195
|
-
return false if @usage_limit.nil?
|
196
|
-
return false if @usage_limit < 0
|
197
229
|
true
|
198
230
|
end
|
199
231
|
|
200
|
-
# Custom attribute writer method with validation
|
201
|
-
# @param [Object] code Value to be assigned
|
202
|
-
def code=(code)
|
203
|
-
if code.nil?
|
204
|
-
fail ArgumentError, 'code cannot be nil'
|
205
|
-
end
|
206
|
-
|
207
|
-
if code.to_s.length < 4
|
208
|
-
fail ArgumentError, 'invalid value for "code", the character length must be great than or equal to 4.'
|
209
|
-
end
|
210
|
-
|
211
|
-
@code = code
|
212
|
-
end
|
213
|
-
|
214
232
|
# Custom attribute writer method with validation
|
215
233
|
# @param [Object] usage_limit Value to be assigned
|
216
234
|
def usage_limit=(usage_limit)
|
@@ -218,6 +236,10 @@ module TalonOne
|
|
218
236
|
fail ArgumentError, 'usage_limit cannot be nil'
|
219
237
|
end
|
220
238
|
|
239
|
+
if usage_limit > 999999
|
240
|
+
fail ArgumentError, 'invalid value for "usage_limit", must be smaller than or equal to 999999.'
|
241
|
+
end
|
242
|
+
|
221
243
|
if usage_limit < 0
|
222
244
|
fail ArgumentError, 'invalid value for "usage_limit", must be greater than or equal to 0.'
|
223
245
|
end
|
@@ -225,6 +247,20 @@ module TalonOne
|
|
225
247
|
@usage_limit = usage_limit
|
226
248
|
end
|
227
249
|
|
250
|
+
# Custom attribute writer method with validation
|
251
|
+
# @param [Object] code Value to be assigned
|
252
|
+
def code=(code)
|
253
|
+
if code.nil?
|
254
|
+
fail ArgumentError, 'code cannot be nil'
|
255
|
+
end
|
256
|
+
|
257
|
+
if code.to_s.length < 4
|
258
|
+
fail ArgumentError, 'invalid value for "code", the character length must be great than or equal to 4.'
|
259
|
+
end
|
260
|
+
|
261
|
+
@code = code
|
262
|
+
end
|
263
|
+
|
228
264
|
# Checks equality by comparing each attribute.
|
229
265
|
# @param [Object] Object to be compared
|
230
266
|
def ==(o)
|
@@ -232,14 +268,17 @@ module TalonOne
|
|
232
268
|
self.class == o.class &&
|
233
269
|
id == o.id &&
|
234
270
|
created == o.created &&
|
271
|
+
start_date == o.start_date &&
|
272
|
+
expiry_date == o.expiry_date &&
|
273
|
+
usage_limit == o.usage_limit &&
|
235
274
|
campaign_id == o.campaign_id &&
|
236
275
|
advocate_profile_integration_id == o.advocate_profile_integration_id &&
|
237
276
|
friend_profile_integration_id == o.friend_profile_integration_id &&
|
238
|
-
|
239
|
-
|
277
|
+
attributes == o.attributes &&
|
278
|
+
import_id == o.import_id &&
|
240
279
|
code == o.code &&
|
241
280
|
usage_counter == o.usage_counter &&
|
242
|
-
|
281
|
+
batch_id == o.batch_id
|
243
282
|
end
|
244
283
|
|
245
284
|
# @see the `==` method
|
@@ -251,7 +290,7 @@ module TalonOne
|
|
251
290
|
# Calculates hash code according to all attributes.
|
252
291
|
# @return [Integer] Hash code
|
253
292
|
def hash
|
254
|
-
[id, created, campaign_id, advocate_profile_integration_id, friend_profile_integration_id,
|
293
|
+
[id, created, start_date, expiry_date, usage_limit, campaign_id, advocate_profile_integration_id, friend_profile_integration_id, attributes, import_id, code, usage_counter, batch_id].hash
|
255
294
|
end
|
256
295
|
|
257
296
|
# Builds the object from hash
|
@@ -0,0 +1,251 @@
|
|
1
|
+
=begin
|
2
|
+
#Talon.One API
|
3
|
+
|
4
|
+
#The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. ### Where is the API? The API is available at the same hostname as these docs. For example, if you are reading this page at `https://mycompany.talon.one/docs/api/`, the URL for the [updateCustomerProfile][] operation is `https://mycompany.talon.one/v1/customer_profiles/id` [updateCustomerProfile]: #operation--v1-customer_profiles--integrationId--put
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module TalonOne
|
16
|
+
class ReferralConstraints
|
17
|
+
# Timestamp at which point the referral code becomes valid.
|
18
|
+
attr_accessor :start_date
|
19
|
+
|
20
|
+
# Expiry date of the referral code. Referral never expires if this is omitted, zero, or negative.
|
21
|
+
attr_accessor :expiry_date
|
22
|
+
|
23
|
+
# The number of times a referral code can be used. This can be set to 0 for no limit, but any campaign usage limits will still apply.
|
24
|
+
attr_accessor :usage_limit
|
25
|
+
|
26
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
27
|
+
def self.attribute_map
|
28
|
+
{
|
29
|
+
:'start_date' => :'startDate',
|
30
|
+
:'expiry_date' => :'expiryDate',
|
31
|
+
:'usage_limit' => :'usageLimit'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# Attribute type mapping.
|
36
|
+
def self.openapi_types
|
37
|
+
{
|
38
|
+
:'start_date' => :'DateTime',
|
39
|
+
:'expiry_date' => :'DateTime',
|
40
|
+
:'usage_limit' => :'Integer'
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
# List of attributes with nullable: true
|
45
|
+
def self.openapi_nullable
|
46
|
+
Set.new([
|
47
|
+
])
|
48
|
+
end
|
49
|
+
|
50
|
+
# Initializes the object
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
+
def initialize(attributes = {})
|
53
|
+
if (!attributes.is_a?(Hash))
|
54
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TalonOne::ReferralConstraints` initialize method"
|
55
|
+
end
|
56
|
+
|
57
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
58
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
59
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
60
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TalonOne::ReferralConstraints`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
61
|
+
end
|
62
|
+
h[k.to_sym] = v
|
63
|
+
}
|
64
|
+
|
65
|
+
if attributes.key?(:'start_date')
|
66
|
+
self.start_date = attributes[:'start_date']
|
67
|
+
end
|
68
|
+
|
69
|
+
if attributes.key?(:'expiry_date')
|
70
|
+
self.expiry_date = attributes[:'expiry_date']
|
71
|
+
end
|
72
|
+
|
73
|
+
if attributes.key?(:'usage_limit')
|
74
|
+
self.usage_limit = attributes[:'usage_limit']
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
79
|
+
# @return Array for valid properties with the reasons
|
80
|
+
def list_invalid_properties
|
81
|
+
invalid_properties = Array.new
|
82
|
+
if !@usage_limit.nil? && @usage_limit > 999999
|
83
|
+
invalid_properties.push('invalid value for "usage_limit", must be smaller than or equal to 999999.')
|
84
|
+
end
|
85
|
+
|
86
|
+
if !@usage_limit.nil? && @usage_limit < 0
|
87
|
+
invalid_properties.push('invalid value for "usage_limit", must be greater than or equal to 0.')
|
88
|
+
end
|
89
|
+
|
90
|
+
invalid_properties
|
91
|
+
end
|
92
|
+
|
93
|
+
# Check to see if the all the properties in the model are valid
|
94
|
+
# @return true if the model is valid
|
95
|
+
def valid?
|
96
|
+
return false if !@usage_limit.nil? && @usage_limit > 999999
|
97
|
+
return false if !@usage_limit.nil? && @usage_limit < 0
|
98
|
+
true
|
99
|
+
end
|
100
|
+
|
101
|
+
# Custom attribute writer method with validation
|
102
|
+
# @param [Object] usage_limit Value to be assigned
|
103
|
+
def usage_limit=(usage_limit)
|
104
|
+
if !usage_limit.nil? && usage_limit > 999999
|
105
|
+
fail ArgumentError, 'invalid value for "usage_limit", must be smaller than or equal to 999999.'
|
106
|
+
end
|
107
|
+
|
108
|
+
if !usage_limit.nil? && usage_limit < 0
|
109
|
+
fail ArgumentError, 'invalid value for "usage_limit", must be greater than or equal to 0.'
|
110
|
+
end
|
111
|
+
|
112
|
+
@usage_limit = usage_limit
|
113
|
+
end
|
114
|
+
|
115
|
+
# Checks equality by comparing each attribute.
|
116
|
+
# @param [Object] Object to be compared
|
117
|
+
def ==(o)
|
118
|
+
return true if self.equal?(o)
|
119
|
+
self.class == o.class &&
|
120
|
+
start_date == o.start_date &&
|
121
|
+
expiry_date == o.expiry_date &&
|
122
|
+
usage_limit == o.usage_limit
|
123
|
+
end
|
124
|
+
|
125
|
+
# @see the `==` method
|
126
|
+
# @param [Object] Object to be compared
|
127
|
+
def eql?(o)
|
128
|
+
self == o
|
129
|
+
end
|
130
|
+
|
131
|
+
# Calculates hash code according to all attributes.
|
132
|
+
# @return [Integer] Hash code
|
133
|
+
def hash
|
134
|
+
[start_date, expiry_date, usage_limit].hash
|
135
|
+
end
|
136
|
+
|
137
|
+
# Builds the object from hash
|
138
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
139
|
+
# @return [Object] Returns the model itself
|
140
|
+
def self.build_from_hash(attributes)
|
141
|
+
new.build_from_hash(attributes)
|
142
|
+
end
|
143
|
+
|
144
|
+
# Builds the object from hash
|
145
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
146
|
+
# @return [Object] Returns the model itself
|
147
|
+
def build_from_hash(attributes)
|
148
|
+
return nil unless attributes.is_a?(Hash)
|
149
|
+
self.class.openapi_types.each_pair do |key, type|
|
150
|
+
if type =~ /\AArray<(.*)>/i
|
151
|
+
# check to ensure the input is an array given that the attribute
|
152
|
+
# is documented as an array but the input is not
|
153
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
154
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
155
|
+
end
|
156
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
157
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
158
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
159
|
+
end
|
160
|
+
|
161
|
+
self
|
162
|
+
end
|
163
|
+
|
164
|
+
# Deserializes the data based on type
|
165
|
+
# @param string type Data type
|
166
|
+
# @param string value Value to be deserialized
|
167
|
+
# @return [Object] Deserialized data
|
168
|
+
def _deserialize(type, value)
|
169
|
+
case type.to_sym
|
170
|
+
when :DateTime
|
171
|
+
DateTime.parse(value)
|
172
|
+
when :Date
|
173
|
+
Date.parse(value)
|
174
|
+
when :String
|
175
|
+
value.to_s
|
176
|
+
when :Integer
|
177
|
+
value.to_i
|
178
|
+
when :Float
|
179
|
+
value.to_f
|
180
|
+
when :Boolean
|
181
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
182
|
+
true
|
183
|
+
else
|
184
|
+
false
|
185
|
+
end
|
186
|
+
when :Object
|
187
|
+
# generic object (usually a Hash), return directly
|
188
|
+
value
|
189
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
190
|
+
inner_type = Regexp.last_match[:inner_type]
|
191
|
+
value.map { |v| _deserialize(inner_type, v) }
|
192
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
193
|
+
k_type = Regexp.last_match[:k_type]
|
194
|
+
v_type = Regexp.last_match[:v_type]
|
195
|
+
{}.tap do |hash|
|
196
|
+
value.each do |k, v|
|
197
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
198
|
+
end
|
199
|
+
end
|
200
|
+
else # model
|
201
|
+
TalonOne.const_get(type).build_from_hash(value)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
# Returns the string representation of the object
|
206
|
+
# @return [String] String presentation of the object
|
207
|
+
def to_s
|
208
|
+
to_hash.to_s
|
209
|
+
end
|
210
|
+
|
211
|
+
# to_body is an alias to to_hash (backward compatibility)
|
212
|
+
# @return [Hash] Returns the object in the form of hash
|
213
|
+
def to_body
|
214
|
+
to_hash
|
215
|
+
end
|
216
|
+
|
217
|
+
# Returns the object in the form of hash
|
218
|
+
# @return [Hash] Returns the object in the form of hash
|
219
|
+
def to_hash
|
220
|
+
hash = {}
|
221
|
+
self.class.attribute_map.each_pair do |attr, param|
|
222
|
+
value = self.send(attr)
|
223
|
+
if value.nil?
|
224
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
225
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
226
|
+
end
|
227
|
+
|
228
|
+
hash[param] = _to_hash(value)
|
229
|
+
end
|
230
|
+
hash
|
231
|
+
end
|
232
|
+
|
233
|
+
# Outputs non-array value in the form of hash
|
234
|
+
# For object, use to_hash. Otherwise, just return the value
|
235
|
+
# @param [Object] value Any valid value
|
236
|
+
# @return [Hash] Returns the value in the form of hash
|
237
|
+
def _to_hash(value)
|
238
|
+
if value.is_a?(Array)
|
239
|
+
value.compact.map { |v| _to_hash(v) }
|
240
|
+
elsif value.is_a?(Hash)
|
241
|
+
{}.tap do |hash|
|
242
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
243
|
+
end
|
244
|
+
elsif value.respond_to? :to_hash
|
245
|
+
value.to_hash
|
246
|
+
else
|
247
|
+
value
|
248
|
+
end
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|