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