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
@@ -0,0 +1,256 @@
|
|
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
|
+
# A new loyalty tier
|
17
|
+
class NewLoyaltyTier
|
18
|
+
# The name of the tier
|
19
|
+
attr_accessor :name
|
20
|
+
|
21
|
+
# The minimum amount of points required to be eligible for the tier
|
22
|
+
attr_accessor :min_points
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'name' => :'name',
|
28
|
+
:'min_points' => :'minPoints'
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.openapi_types
|
34
|
+
{
|
35
|
+
:'name' => :'String',
|
36
|
+
:'min_points' => :'Float'
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
# List of attributes with nullable: true
|
41
|
+
def self.openapi_nullable
|
42
|
+
Set.new([
|
43
|
+
])
|
44
|
+
end
|
45
|
+
|
46
|
+
# Initializes the object
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
48
|
+
def initialize(attributes = {})
|
49
|
+
if (!attributes.is_a?(Hash))
|
50
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TalonOne::NewLoyaltyTier` initialize method"
|
51
|
+
end
|
52
|
+
|
53
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
54
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
55
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
56
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TalonOne::NewLoyaltyTier`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
57
|
+
end
|
58
|
+
h[k.to_sym] = v
|
59
|
+
}
|
60
|
+
|
61
|
+
if attributes.key?(:'name')
|
62
|
+
self.name = attributes[:'name']
|
63
|
+
end
|
64
|
+
|
65
|
+
if attributes.key?(:'min_points')
|
66
|
+
self.min_points = attributes[:'min_points']
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
71
|
+
# @return Array for valid properties with the reasons
|
72
|
+
def list_invalid_properties
|
73
|
+
invalid_properties = Array.new
|
74
|
+
if @name.nil?
|
75
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
76
|
+
end
|
77
|
+
|
78
|
+
if @min_points.nil?
|
79
|
+
invalid_properties.push('invalid value for "min_points", min_points cannot be nil.')
|
80
|
+
end
|
81
|
+
|
82
|
+
if @min_points >= 1E+8
|
83
|
+
invalid_properties.push('invalid value for "min_points", must be smaller than 1E+8.')
|
84
|
+
end
|
85
|
+
|
86
|
+
if @min_points < 0
|
87
|
+
invalid_properties.push('invalid value for "min_points", 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 @name.nil?
|
97
|
+
return false if @min_points.nil?
|
98
|
+
return false if @min_points >= 1E+8
|
99
|
+
return false if @min_points < 0
|
100
|
+
true
|
101
|
+
end
|
102
|
+
|
103
|
+
# Custom attribute writer method with validation
|
104
|
+
# @param [Object] min_points Value to be assigned
|
105
|
+
def min_points=(min_points)
|
106
|
+
if min_points.nil?
|
107
|
+
fail ArgumentError, 'min_points cannot be nil'
|
108
|
+
end
|
109
|
+
|
110
|
+
if min_points >= 1E+8
|
111
|
+
fail ArgumentError, 'invalid value for "min_points", must be smaller than 1E+8.'
|
112
|
+
end
|
113
|
+
|
114
|
+
if min_points < 0
|
115
|
+
fail ArgumentError, 'invalid value for "min_points", must be greater than or equal to 0.'
|
116
|
+
end
|
117
|
+
|
118
|
+
@min_points = min_points
|
119
|
+
end
|
120
|
+
|
121
|
+
# Checks equality by comparing each attribute.
|
122
|
+
# @param [Object] Object to be compared
|
123
|
+
def ==(o)
|
124
|
+
return true if self.equal?(o)
|
125
|
+
self.class == o.class &&
|
126
|
+
name == o.name &&
|
127
|
+
min_points == o.min_points
|
128
|
+
end
|
129
|
+
|
130
|
+
# @see the `==` method
|
131
|
+
# @param [Object] Object to be compared
|
132
|
+
def eql?(o)
|
133
|
+
self == o
|
134
|
+
end
|
135
|
+
|
136
|
+
# Calculates hash code according to all attributes.
|
137
|
+
# @return [Integer] Hash code
|
138
|
+
def hash
|
139
|
+
[name, min_points].hash
|
140
|
+
end
|
141
|
+
|
142
|
+
# Builds the object from hash
|
143
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
144
|
+
# @return [Object] Returns the model itself
|
145
|
+
def self.build_from_hash(attributes)
|
146
|
+
new.build_from_hash(attributes)
|
147
|
+
end
|
148
|
+
|
149
|
+
# Builds the object from hash
|
150
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
151
|
+
# @return [Object] Returns the model itself
|
152
|
+
def build_from_hash(attributes)
|
153
|
+
return nil unless attributes.is_a?(Hash)
|
154
|
+
self.class.openapi_types.each_pair do |key, type|
|
155
|
+
if type =~ /\AArray<(.*)>/i
|
156
|
+
# check to ensure the input is an array given that the attribute
|
157
|
+
# is documented as an array but the input is not
|
158
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
159
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
160
|
+
end
|
161
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
162
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
163
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
164
|
+
end
|
165
|
+
|
166
|
+
self
|
167
|
+
end
|
168
|
+
|
169
|
+
# Deserializes the data based on type
|
170
|
+
# @param string type Data type
|
171
|
+
# @param string value Value to be deserialized
|
172
|
+
# @return [Object] Deserialized data
|
173
|
+
def _deserialize(type, value)
|
174
|
+
case type.to_sym
|
175
|
+
when :DateTime
|
176
|
+
DateTime.parse(value)
|
177
|
+
when :Date
|
178
|
+
Date.parse(value)
|
179
|
+
when :String
|
180
|
+
value.to_s
|
181
|
+
when :Integer
|
182
|
+
value.to_i
|
183
|
+
when :Float
|
184
|
+
value.to_f
|
185
|
+
when :Boolean
|
186
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
187
|
+
true
|
188
|
+
else
|
189
|
+
false
|
190
|
+
end
|
191
|
+
when :Object
|
192
|
+
# generic object (usually a Hash), return directly
|
193
|
+
value
|
194
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
195
|
+
inner_type = Regexp.last_match[:inner_type]
|
196
|
+
value.map { |v| _deserialize(inner_type, v) }
|
197
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
198
|
+
k_type = Regexp.last_match[:k_type]
|
199
|
+
v_type = Regexp.last_match[:v_type]
|
200
|
+
{}.tap do |hash|
|
201
|
+
value.each do |k, v|
|
202
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
else # model
|
206
|
+
TalonOne.const_get(type).build_from_hash(value)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
# Returns the string representation of the object
|
211
|
+
# @return [String] String presentation of the object
|
212
|
+
def to_s
|
213
|
+
to_hash.to_s
|
214
|
+
end
|
215
|
+
|
216
|
+
# to_body is an alias to to_hash (backward compatibility)
|
217
|
+
# @return [Hash] Returns the object in the form of hash
|
218
|
+
def to_body
|
219
|
+
to_hash
|
220
|
+
end
|
221
|
+
|
222
|
+
# Returns the object in the form of hash
|
223
|
+
# @return [Hash] Returns the object in the form of hash
|
224
|
+
def to_hash
|
225
|
+
hash = {}
|
226
|
+
self.class.attribute_map.each_pair do |attr, param|
|
227
|
+
value = self.send(attr)
|
228
|
+
if value.nil?
|
229
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
230
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
231
|
+
end
|
232
|
+
|
233
|
+
hash[param] = _to_hash(value)
|
234
|
+
end
|
235
|
+
hash
|
236
|
+
end
|
237
|
+
|
238
|
+
# Outputs non-array value in the form of hash
|
239
|
+
# For object, use to_hash. Otherwise, just return the value
|
240
|
+
# @param [Object] value Any valid value
|
241
|
+
# @return [Hash] Returns the value in the form of hash
|
242
|
+
def _to_hash(value)
|
243
|
+
if value.is_a?(Array)
|
244
|
+
value.compact.map { |v| _to_hash(v) }
|
245
|
+
elsif value.is_a?(Hash)
|
246
|
+
{}.tap do |hash|
|
247
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
248
|
+
end
|
249
|
+
elsif value.respond_to? :to_hash
|
250
|
+
value.to_hash
|
251
|
+
else
|
252
|
+
value
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
@@ -13,41 +13,52 @@ OpenAPI Generator version: 4.3.1
|
|
13
13
|
require 'date'
|
14
14
|
|
15
15
|
module TalonOne
|
16
|
+
#
|
16
17
|
class NewReferral
|
18
|
+
# Timestamp at which point the referral code becomes valid.
|
19
|
+
attr_accessor :start_date
|
20
|
+
|
21
|
+
# Expiry date of the referral code. Referral never expires if this is omitted, zero, or negative.
|
22
|
+
attr_accessor :expiry_date
|
23
|
+
|
24
|
+
# 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.
|
25
|
+
attr_accessor :usage_limit
|
26
|
+
|
17
27
|
# ID of the campaign from which the referral received the referral code.
|
18
28
|
attr_accessor :campaign_id
|
19
29
|
|
20
|
-
# The Integration
|
30
|
+
# The Integration ID of the Advocate's Profile.
|
21
31
|
attr_accessor :advocate_profile_integration_id
|
22
32
|
|
23
33
|
# An optional Integration ID of the Friend's Profile
|
24
34
|
attr_accessor :friend_profile_integration_id
|
25
35
|
|
26
|
-
#
|
27
|
-
attr_accessor :
|
28
|
-
|
29
|
-
# Expiry date of the referral code. Referral never expires if this is omitted, zero, or negative.
|
30
|
-
attr_accessor :expiry_date
|
36
|
+
# Arbitrary properties associated with this item.
|
37
|
+
attr_accessor :attributes
|
31
38
|
|
32
39
|
# Attribute mapping from ruby-style variable name to JSON key.
|
33
40
|
def self.attribute_map
|
34
41
|
{
|
42
|
+
:'start_date' => :'startDate',
|
43
|
+
:'expiry_date' => :'expiryDate',
|
44
|
+
:'usage_limit' => :'usageLimit',
|
35
45
|
:'campaign_id' => :'campaignId',
|
36
46
|
:'advocate_profile_integration_id' => :'advocateProfileIntegrationId',
|
37
47
|
:'friend_profile_integration_id' => :'friendProfileIntegrationId',
|
38
|
-
:'
|
39
|
-
:'expiry_date' => :'expiryDate'
|
48
|
+
:'attributes' => :'attributes'
|
40
49
|
}
|
41
50
|
end
|
42
51
|
|
43
52
|
# Attribute type mapping.
|
44
53
|
def self.openapi_types
|
45
54
|
{
|
55
|
+
:'start_date' => :'DateTime',
|
56
|
+
:'expiry_date' => :'DateTime',
|
57
|
+
:'usage_limit' => :'Integer',
|
46
58
|
:'campaign_id' => :'Integer',
|
47
59
|
:'advocate_profile_integration_id' => :'String',
|
48
60
|
:'friend_profile_integration_id' => :'String',
|
49
|
-
:'
|
50
|
-
:'expiry_date' => :'DateTime'
|
61
|
+
:'attributes' => :'Object'
|
51
62
|
}
|
52
63
|
end
|
53
64
|
|
@@ -72,6 +83,18 @@ module TalonOne
|
|
72
83
|
h[k.to_sym] = v
|
73
84
|
}
|
74
85
|
|
86
|
+
if attributes.key?(:'start_date')
|
87
|
+
self.start_date = attributes[:'start_date']
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.key?(:'expiry_date')
|
91
|
+
self.expiry_date = attributes[:'expiry_date']
|
92
|
+
end
|
93
|
+
|
94
|
+
if attributes.key?(:'usage_limit')
|
95
|
+
self.usage_limit = attributes[:'usage_limit']
|
96
|
+
end
|
97
|
+
|
75
98
|
if attributes.key?(:'campaign_id')
|
76
99
|
self.campaign_id = attributes[:'campaign_id']
|
77
100
|
end
|
@@ -84,12 +107,8 @@ module TalonOne
|
|
84
107
|
self.friend_profile_integration_id = attributes[:'friend_profile_integration_id']
|
85
108
|
end
|
86
109
|
|
87
|
-
if attributes.key?(:'
|
88
|
-
self.
|
89
|
-
end
|
90
|
-
|
91
|
-
if attributes.key?(:'expiry_date')
|
92
|
-
self.expiry_date = attributes[:'expiry_date']
|
110
|
+
if attributes.key?(:'attributes')
|
111
|
+
self.attributes = attributes[:'attributes']
|
93
112
|
end
|
94
113
|
end
|
95
114
|
|
@@ -97,6 +116,14 @@ module TalonOne
|
|
97
116
|
# @return Array for valid properties with the reasons
|
98
117
|
def list_invalid_properties
|
99
118
|
invalid_properties = Array.new
|
119
|
+
if !@usage_limit.nil? && @usage_limit > 999999
|
120
|
+
invalid_properties.push('invalid value for "usage_limit", must be smaller than or equal to 999999.')
|
121
|
+
end
|
122
|
+
|
123
|
+
if !@usage_limit.nil? && @usage_limit < 0
|
124
|
+
invalid_properties.push('invalid value for "usage_limit", must be greater than or equal to 0.')
|
125
|
+
end
|
126
|
+
|
100
127
|
if @campaign_id.nil?
|
101
128
|
invalid_properties.push('invalid value for "campaign_id", campaign_id cannot be nil.')
|
102
129
|
end
|
@@ -111,21 +138,39 @@ module TalonOne
|
|
111
138
|
# Check to see if the all the properties in the model are valid
|
112
139
|
# @return true if the model is valid
|
113
140
|
def valid?
|
141
|
+
return false if !@usage_limit.nil? && @usage_limit > 999999
|
142
|
+
return false if !@usage_limit.nil? && @usage_limit < 0
|
114
143
|
return false if @campaign_id.nil?
|
115
144
|
return false if @advocate_profile_integration_id.nil?
|
116
145
|
true
|
117
146
|
end
|
118
147
|
|
148
|
+
# Custom attribute writer method with validation
|
149
|
+
# @param [Object] usage_limit Value to be assigned
|
150
|
+
def usage_limit=(usage_limit)
|
151
|
+
if !usage_limit.nil? && usage_limit > 999999
|
152
|
+
fail ArgumentError, 'invalid value for "usage_limit", must be smaller than or equal to 999999.'
|
153
|
+
end
|
154
|
+
|
155
|
+
if !usage_limit.nil? && usage_limit < 0
|
156
|
+
fail ArgumentError, 'invalid value for "usage_limit", must be greater than or equal to 0.'
|
157
|
+
end
|
158
|
+
|
159
|
+
@usage_limit = usage_limit
|
160
|
+
end
|
161
|
+
|
119
162
|
# Checks equality by comparing each attribute.
|
120
163
|
# @param [Object] Object to be compared
|
121
164
|
def ==(o)
|
122
165
|
return true if self.equal?(o)
|
123
166
|
self.class == o.class &&
|
167
|
+
start_date == o.start_date &&
|
168
|
+
expiry_date == o.expiry_date &&
|
169
|
+
usage_limit == o.usage_limit &&
|
124
170
|
campaign_id == o.campaign_id &&
|
125
171
|
advocate_profile_integration_id == o.advocate_profile_integration_id &&
|
126
172
|
friend_profile_integration_id == o.friend_profile_integration_id &&
|
127
|
-
|
128
|
-
expiry_date == o.expiry_date
|
173
|
+
attributes == o.attributes
|
129
174
|
end
|
130
175
|
|
131
176
|
# @see the `==` method
|
@@ -137,7 +182,7 @@ module TalonOne
|
|
137
182
|
# Calculates hash code according to all attributes.
|
138
183
|
# @return [Integer] Hash code
|
139
184
|
def hash
|
140
|
-
[campaign_id, advocate_profile_integration_id, friend_profile_integration_id,
|
185
|
+
[start_date, expiry_date, usage_limit, campaign_id, advocate_profile_integration_id, friend_profile_integration_id, attributes].hash
|
141
186
|
end
|
142
187
|
|
143
188
|
# Builds the object from hash
|
@@ -0,0 +1,349 @@
|
|
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
|
+
#
|
17
|
+
class NewReferralsForMultipleAdvocates
|
18
|
+
# Timestamp at which point the referral code becomes valid.
|
19
|
+
attr_accessor :start_date
|
20
|
+
|
21
|
+
# Expiry date of the referral code. Referral never expires if this is omitted, zero, or negative.
|
22
|
+
attr_accessor :expiry_date
|
23
|
+
|
24
|
+
# 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.
|
25
|
+
attr_accessor :usage_limit
|
26
|
+
|
27
|
+
# The ID of the campaign from which the referral received the referral code.
|
28
|
+
attr_accessor :campaign_id
|
29
|
+
|
30
|
+
# An array containing all the respective advocate profiles.
|
31
|
+
attr_accessor :advocate_profile_integration_ids
|
32
|
+
|
33
|
+
# Arbitrary properties associated with this item.
|
34
|
+
attr_accessor :attributes
|
35
|
+
|
36
|
+
# Set of characters to be used when generating random part of code. Defaults to [A-Z, 0-9] (in terms of RegExp).
|
37
|
+
attr_accessor :valid_characters
|
38
|
+
|
39
|
+
# The pattern that will be used to generate referrals. The character `#` acts as a placeholder and will be replaced by a random character from the `validCharacters` set.
|
40
|
+
attr_accessor :referral_pattern
|
41
|
+
|
42
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
43
|
+
def self.attribute_map
|
44
|
+
{
|
45
|
+
:'start_date' => :'startDate',
|
46
|
+
:'expiry_date' => :'expiryDate',
|
47
|
+
:'usage_limit' => :'usageLimit',
|
48
|
+
:'campaign_id' => :'campaignId',
|
49
|
+
:'advocate_profile_integration_ids' => :'advocateProfileIntegrationIds',
|
50
|
+
:'attributes' => :'attributes',
|
51
|
+
:'valid_characters' => :'validCharacters',
|
52
|
+
:'referral_pattern' => :'referralPattern'
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# Attribute type mapping.
|
57
|
+
def self.openapi_types
|
58
|
+
{
|
59
|
+
:'start_date' => :'DateTime',
|
60
|
+
:'expiry_date' => :'DateTime',
|
61
|
+
:'usage_limit' => :'Integer',
|
62
|
+
:'campaign_id' => :'Integer',
|
63
|
+
:'advocate_profile_integration_ids' => :'Array<String>',
|
64
|
+
:'attributes' => :'Object',
|
65
|
+
:'valid_characters' => :'Array<String>',
|
66
|
+
:'referral_pattern' => :'String'
|
67
|
+
}
|
68
|
+
end
|
69
|
+
|
70
|
+
# List of attributes with nullable: true
|
71
|
+
def self.openapi_nullable
|
72
|
+
Set.new([
|
73
|
+
])
|
74
|
+
end
|
75
|
+
|
76
|
+
# Initializes the object
|
77
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
78
|
+
def initialize(attributes = {})
|
79
|
+
if (!attributes.is_a?(Hash))
|
80
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TalonOne::NewReferralsForMultipleAdvocates` initialize method"
|
81
|
+
end
|
82
|
+
|
83
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
84
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
85
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
86
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TalonOne::NewReferralsForMultipleAdvocates`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
87
|
+
end
|
88
|
+
h[k.to_sym] = v
|
89
|
+
}
|
90
|
+
|
91
|
+
if attributes.key?(:'start_date')
|
92
|
+
self.start_date = attributes[:'start_date']
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.key?(:'expiry_date')
|
96
|
+
self.expiry_date = attributes[:'expiry_date']
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.key?(:'usage_limit')
|
100
|
+
self.usage_limit = attributes[:'usage_limit']
|
101
|
+
end
|
102
|
+
|
103
|
+
if attributes.key?(:'campaign_id')
|
104
|
+
self.campaign_id = attributes[:'campaign_id']
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.key?(:'advocate_profile_integration_ids')
|
108
|
+
if (value = attributes[:'advocate_profile_integration_ids']).is_a?(Array)
|
109
|
+
self.advocate_profile_integration_ids = value
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.key?(:'attributes')
|
114
|
+
self.attributes = attributes[:'attributes']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.key?(:'valid_characters')
|
118
|
+
if (value = attributes[:'valid_characters']).is_a?(Array)
|
119
|
+
self.valid_characters = value
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
if attributes.key?(:'referral_pattern')
|
124
|
+
self.referral_pattern = attributes[:'referral_pattern']
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
129
|
+
# @return Array for valid properties with the reasons
|
130
|
+
def list_invalid_properties
|
131
|
+
invalid_properties = Array.new
|
132
|
+
if @usage_limit.nil?
|
133
|
+
invalid_properties.push('invalid value for "usage_limit", usage_limit cannot be nil.')
|
134
|
+
end
|
135
|
+
|
136
|
+
if @usage_limit > 999999
|
137
|
+
invalid_properties.push('invalid value for "usage_limit", must be smaller than or equal to 999999.')
|
138
|
+
end
|
139
|
+
|
140
|
+
if @usage_limit < 0
|
141
|
+
invalid_properties.push('invalid value for "usage_limit", must be greater than or equal to 0.')
|
142
|
+
end
|
143
|
+
|
144
|
+
if @campaign_id.nil?
|
145
|
+
invalid_properties.push('invalid value for "campaign_id", campaign_id cannot be nil.')
|
146
|
+
end
|
147
|
+
|
148
|
+
if @advocate_profile_integration_ids.nil?
|
149
|
+
invalid_properties.push('invalid value for "advocate_profile_integration_ids", advocate_profile_integration_ids cannot be nil.')
|
150
|
+
end
|
151
|
+
|
152
|
+
if !@referral_pattern.nil? && @referral_pattern.to_s.length > 100
|
153
|
+
invalid_properties.push('invalid value for "referral_pattern", the character length must be smaller than or equal to 100.')
|
154
|
+
end
|
155
|
+
|
156
|
+
if !@referral_pattern.nil? && @referral_pattern.to_s.length < 3
|
157
|
+
invalid_properties.push('invalid value for "referral_pattern", the character length must be great than or equal to 3.')
|
158
|
+
end
|
159
|
+
|
160
|
+
invalid_properties
|
161
|
+
end
|
162
|
+
|
163
|
+
# Check to see if the all the properties in the model are valid
|
164
|
+
# @return true if the model is valid
|
165
|
+
def valid?
|
166
|
+
return false if @usage_limit.nil?
|
167
|
+
return false if @usage_limit > 999999
|
168
|
+
return false if @usage_limit < 0
|
169
|
+
return false if @campaign_id.nil?
|
170
|
+
return false if @advocate_profile_integration_ids.nil?
|
171
|
+
return false if !@referral_pattern.nil? && @referral_pattern.to_s.length > 100
|
172
|
+
return false if !@referral_pattern.nil? && @referral_pattern.to_s.length < 3
|
173
|
+
true
|
174
|
+
end
|
175
|
+
|
176
|
+
# Custom attribute writer method with validation
|
177
|
+
# @param [Object] usage_limit Value to be assigned
|
178
|
+
def usage_limit=(usage_limit)
|
179
|
+
if usage_limit.nil?
|
180
|
+
fail ArgumentError, 'usage_limit cannot be nil'
|
181
|
+
end
|
182
|
+
|
183
|
+
if usage_limit > 999999
|
184
|
+
fail ArgumentError, 'invalid value for "usage_limit", must be smaller than or equal to 999999.'
|
185
|
+
end
|
186
|
+
|
187
|
+
if usage_limit < 0
|
188
|
+
fail ArgumentError, 'invalid value for "usage_limit", must be greater than or equal to 0.'
|
189
|
+
end
|
190
|
+
|
191
|
+
@usage_limit = usage_limit
|
192
|
+
end
|
193
|
+
|
194
|
+
# Custom attribute writer method with validation
|
195
|
+
# @param [Object] referral_pattern Value to be assigned
|
196
|
+
def referral_pattern=(referral_pattern)
|
197
|
+
if !referral_pattern.nil? && referral_pattern.to_s.length > 100
|
198
|
+
fail ArgumentError, 'invalid value for "referral_pattern", the character length must be smaller than or equal to 100.'
|
199
|
+
end
|
200
|
+
|
201
|
+
if !referral_pattern.nil? && referral_pattern.to_s.length < 3
|
202
|
+
fail ArgumentError, 'invalid value for "referral_pattern", the character length must be great than or equal to 3.'
|
203
|
+
end
|
204
|
+
|
205
|
+
@referral_pattern = referral_pattern
|
206
|
+
end
|
207
|
+
|
208
|
+
# Checks equality by comparing each attribute.
|
209
|
+
# @param [Object] Object to be compared
|
210
|
+
def ==(o)
|
211
|
+
return true if self.equal?(o)
|
212
|
+
self.class == o.class &&
|
213
|
+
start_date == o.start_date &&
|
214
|
+
expiry_date == o.expiry_date &&
|
215
|
+
usage_limit == o.usage_limit &&
|
216
|
+
campaign_id == o.campaign_id &&
|
217
|
+
advocate_profile_integration_ids == o.advocate_profile_integration_ids &&
|
218
|
+
attributes == o.attributes &&
|
219
|
+
valid_characters == o.valid_characters &&
|
220
|
+
referral_pattern == o.referral_pattern
|
221
|
+
end
|
222
|
+
|
223
|
+
# @see the `==` method
|
224
|
+
# @param [Object] Object to be compared
|
225
|
+
def eql?(o)
|
226
|
+
self == o
|
227
|
+
end
|
228
|
+
|
229
|
+
# Calculates hash code according to all attributes.
|
230
|
+
# @return [Integer] Hash code
|
231
|
+
def hash
|
232
|
+
[start_date, expiry_date, usage_limit, campaign_id, advocate_profile_integration_ids, attributes, valid_characters, referral_pattern].hash
|
233
|
+
end
|
234
|
+
|
235
|
+
# Builds the object from hash
|
236
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
237
|
+
# @return [Object] Returns the model itself
|
238
|
+
def self.build_from_hash(attributes)
|
239
|
+
new.build_from_hash(attributes)
|
240
|
+
end
|
241
|
+
|
242
|
+
# Builds the object from hash
|
243
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
244
|
+
# @return [Object] Returns the model itself
|
245
|
+
def build_from_hash(attributes)
|
246
|
+
return nil unless attributes.is_a?(Hash)
|
247
|
+
self.class.openapi_types.each_pair do |key, type|
|
248
|
+
if type =~ /\AArray<(.*)>/i
|
249
|
+
# check to ensure the input is an array given that the attribute
|
250
|
+
# is documented as an array but the input is not
|
251
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
252
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
253
|
+
end
|
254
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
255
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
256
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
257
|
+
end
|
258
|
+
|
259
|
+
self
|
260
|
+
end
|
261
|
+
|
262
|
+
# Deserializes the data based on type
|
263
|
+
# @param string type Data type
|
264
|
+
# @param string value Value to be deserialized
|
265
|
+
# @return [Object] Deserialized data
|
266
|
+
def _deserialize(type, value)
|
267
|
+
case type.to_sym
|
268
|
+
when :DateTime
|
269
|
+
DateTime.parse(value)
|
270
|
+
when :Date
|
271
|
+
Date.parse(value)
|
272
|
+
when :String
|
273
|
+
value.to_s
|
274
|
+
when :Integer
|
275
|
+
value.to_i
|
276
|
+
when :Float
|
277
|
+
value.to_f
|
278
|
+
when :Boolean
|
279
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
280
|
+
true
|
281
|
+
else
|
282
|
+
false
|
283
|
+
end
|
284
|
+
when :Object
|
285
|
+
# generic object (usually a Hash), return directly
|
286
|
+
value
|
287
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
288
|
+
inner_type = Regexp.last_match[:inner_type]
|
289
|
+
value.map { |v| _deserialize(inner_type, v) }
|
290
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
291
|
+
k_type = Regexp.last_match[:k_type]
|
292
|
+
v_type = Regexp.last_match[:v_type]
|
293
|
+
{}.tap do |hash|
|
294
|
+
value.each do |k, v|
|
295
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
296
|
+
end
|
297
|
+
end
|
298
|
+
else # model
|
299
|
+
TalonOne.const_get(type).build_from_hash(value)
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
# Returns the string representation of the object
|
304
|
+
# @return [String] String presentation of the object
|
305
|
+
def to_s
|
306
|
+
to_hash.to_s
|
307
|
+
end
|
308
|
+
|
309
|
+
# to_body is an alias to to_hash (backward compatibility)
|
310
|
+
# @return [Hash] Returns the object in the form of hash
|
311
|
+
def to_body
|
312
|
+
to_hash
|
313
|
+
end
|
314
|
+
|
315
|
+
# Returns the object in the form of hash
|
316
|
+
# @return [Hash] Returns the object in the form of hash
|
317
|
+
def to_hash
|
318
|
+
hash = {}
|
319
|
+
self.class.attribute_map.each_pair do |attr, param|
|
320
|
+
value = self.send(attr)
|
321
|
+
if value.nil?
|
322
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
323
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
324
|
+
end
|
325
|
+
|
326
|
+
hash[param] = _to_hash(value)
|
327
|
+
end
|
328
|
+
hash
|
329
|
+
end
|
330
|
+
|
331
|
+
# Outputs non-array value in the form of hash
|
332
|
+
# For object, use to_hash. Otherwise, just return the value
|
333
|
+
# @param [Object] value Any valid value
|
334
|
+
# @return [Hash] Returns the value in the form of hash
|
335
|
+
def _to_hash(value)
|
336
|
+
if value.is_a?(Array)
|
337
|
+
value.compact.map { |v| _to_hash(v) }
|
338
|
+
elsif value.is_a?(Hash)
|
339
|
+
{}.tap do |hash|
|
340
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
341
|
+
end
|
342
|
+
elsif value.respond_to? :to_hash
|
343
|
+
value.to_hash
|
344
|
+
else
|
345
|
+
value
|
346
|
+
end
|
347
|
+
end
|
348
|
+
end
|
349
|
+
end
|