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,288 @@
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
+ # Provides statistics regarding an application's campaigns
17
+ class ApplicationCampaignStats
18
+ # Number of draft campaigns
19
+ attr_accessor :draft
20
+
21
+ # Number of disabled campaigns
22
+ attr_accessor :disabled
23
+
24
+ # Number of scheduled campaigns
25
+ attr_accessor :scheduled
26
+
27
+ # Number of running campaigns
28
+ attr_accessor :running
29
+
30
+ # Number of expired campaigns
31
+ attr_accessor :expired
32
+
33
+ # Number of archived campaigns
34
+ attr_accessor :archived
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'draft' => :'draft',
40
+ :'disabled' => :'disabled',
41
+ :'scheduled' => :'scheduled',
42
+ :'running' => :'running',
43
+ :'expired' => :'expired',
44
+ :'archived' => :'archived'
45
+ }
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.openapi_types
50
+ {
51
+ :'draft' => :'Integer',
52
+ :'disabled' => :'Integer',
53
+ :'scheduled' => :'Integer',
54
+ :'running' => :'Integer',
55
+ :'expired' => :'Integer',
56
+ :'archived' => :'Integer'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TalonOne::ApplicationCampaignStats` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ attributes = attributes.each_with_object({}) { |(k, v), h|
75
+ if (!self.class.attribute_map.key?(k.to_sym))
76
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TalonOne::ApplicationCampaignStats`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
77
+ end
78
+ h[k.to_sym] = v
79
+ }
80
+
81
+ if attributes.key?(:'draft')
82
+ self.draft = attributes[:'draft']
83
+ end
84
+
85
+ if attributes.key?(:'disabled')
86
+ self.disabled = attributes[:'disabled']
87
+ end
88
+
89
+ if attributes.key?(:'scheduled')
90
+ self.scheduled = attributes[:'scheduled']
91
+ end
92
+
93
+ if attributes.key?(:'running')
94
+ self.running = attributes[:'running']
95
+ end
96
+
97
+ if attributes.key?(:'expired')
98
+ self.expired = attributes[:'expired']
99
+ end
100
+
101
+ if attributes.key?(:'archived')
102
+ self.archived = attributes[:'archived']
103
+ end
104
+ end
105
+
106
+ # Show invalid properties with the reasons. Usually used together with valid?
107
+ # @return Array for valid properties with the reasons
108
+ def list_invalid_properties
109
+ invalid_properties = Array.new
110
+ if @draft.nil?
111
+ invalid_properties.push('invalid value for "draft", draft cannot be nil.')
112
+ end
113
+
114
+ if @disabled.nil?
115
+ invalid_properties.push('invalid value for "disabled", disabled cannot be nil.')
116
+ end
117
+
118
+ if @scheduled.nil?
119
+ invalid_properties.push('invalid value for "scheduled", scheduled cannot be nil.')
120
+ end
121
+
122
+ if @running.nil?
123
+ invalid_properties.push('invalid value for "running", running cannot be nil.')
124
+ end
125
+
126
+ if @expired.nil?
127
+ invalid_properties.push('invalid value for "expired", expired cannot be nil.')
128
+ end
129
+
130
+ if @archived.nil?
131
+ invalid_properties.push('invalid value for "archived", archived cannot be nil.')
132
+ end
133
+
134
+ invalid_properties
135
+ end
136
+
137
+ # Check to see if the all the properties in the model are valid
138
+ # @return true if the model is valid
139
+ def valid?
140
+ return false if @draft.nil?
141
+ return false if @disabled.nil?
142
+ return false if @scheduled.nil?
143
+ return false if @running.nil?
144
+ return false if @expired.nil?
145
+ return false if @archived.nil?
146
+ true
147
+ end
148
+
149
+ # Checks equality by comparing each attribute.
150
+ # @param [Object] Object to be compared
151
+ def ==(o)
152
+ return true if self.equal?(o)
153
+ self.class == o.class &&
154
+ draft == o.draft &&
155
+ disabled == o.disabled &&
156
+ scheduled == o.scheduled &&
157
+ running == o.running &&
158
+ expired == o.expired &&
159
+ archived == o.archived
160
+ end
161
+
162
+ # @see the `==` method
163
+ # @param [Object] Object to be compared
164
+ def eql?(o)
165
+ self == o
166
+ end
167
+
168
+ # Calculates hash code according to all attributes.
169
+ # @return [Integer] Hash code
170
+ def hash
171
+ [draft, disabled, scheduled, running, expired, archived].hash
172
+ end
173
+
174
+ # Builds the object from hash
175
+ # @param [Hash] attributes Model attributes in the form of hash
176
+ # @return [Object] Returns the model itself
177
+ def self.build_from_hash(attributes)
178
+ new.build_from_hash(attributes)
179
+ end
180
+
181
+ # Builds the object from hash
182
+ # @param [Hash] attributes Model attributes in the form of hash
183
+ # @return [Object] Returns the model itself
184
+ def build_from_hash(attributes)
185
+ return nil unless attributes.is_a?(Hash)
186
+ self.class.openapi_types.each_pair do |key, type|
187
+ if type =~ /\AArray<(.*)>/i
188
+ # check to ensure the input is an array given that the attribute
189
+ # is documented as an array but the input is not
190
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
191
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
192
+ end
193
+ elsif !attributes[self.class.attribute_map[key]].nil?
194
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
195
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
196
+ end
197
+
198
+ self
199
+ end
200
+
201
+ # Deserializes the data based on type
202
+ # @param string type Data type
203
+ # @param string value Value to be deserialized
204
+ # @return [Object] Deserialized data
205
+ def _deserialize(type, value)
206
+ case type.to_sym
207
+ when :DateTime
208
+ DateTime.parse(value)
209
+ when :Date
210
+ Date.parse(value)
211
+ when :String
212
+ value.to_s
213
+ when :Integer
214
+ value.to_i
215
+ when :Float
216
+ value.to_f
217
+ when :Boolean
218
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
219
+ true
220
+ else
221
+ false
222
+ end
223
+ when :Object
224
+ # generic object (usually a Hash), return directly
225
+ value
226
+ when /\AArray<(?<inner_type>.+)>\z/
227
+ inner_type = Regexp.last_match[:inner_type]
228
+ value.map { |v| _deserialize(inner_type, v) }
229
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
230
+ k_type = Regexp.last_match[:k_type]
231
+ v_type = Regexp.last_match[:v_type]
232
+ {}.tap do |hash|
233
+ value.each do |k, v|
234
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
235
+ end
236
+ end
237
+ else # model
238
+ TalonOne.const_get(type).build_from_hash(value)
239
+ end
240
+ end
241
+
242
+ # Returns the string representation of the object
243
+ # @return [String] String presentation of the object
244
+ def to_s
245
+ to_hash.to_s
246
+ end
247
+
248
+ # to_body is an alias to to_hash (backward compatibility)
249
+ # @return [Hash] Returns the object in the form of hash
250
+ def to_body
251
+ to_hash
252
+ end
253
+
254
+ # Returns the object in the form of hash
255
+ # @return [Hash] Returns the object in the form of hash
256
+ def to_hash
257
+ hash = {}
258
+ self.class.attribute_map.each_pair do |attr, param|
259
+ value = self.send(attr)
260
+ if value.nil?
261
+ is_nullable = self.class.openapi_nullable.include?(attr)
262
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
263
+ end
264
+
265
+ hash[param] = _to_hash(value)
266
+ end
267
+ hash
268
+ end
269
+
270
+ # Outputs non-array value in the form of hash
271
+ # For object, use to_hash. Otherwise, just return the value
272
+ # @param [Object] value Any valid value
273
+ # @return [Hash] Returns the value in the form of hash
274
+ def _to_hash(value)
275
+ if value.is_a?(Array)
276
+ value.compact.map { |v| _to_hash(v) }
277
+ elsif value.is_a?(Hash)
278
+ {}.tap do |hash|
279
+ value.each { |k, v| hash[k] = _to_hash(v) }
280
+ end
281
+ elsif value.respond_to? :to_hash
282
+ value.to_hash
283
+ else
284
+ value
285
+ end
286
+ end
287
+ end
288
+ end
@@ -0,0 +1,288 @@
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 ApplicationReferee
18
+ # The ID of the application that owns this entity.
19
+ attr_accessor :application_id
20
+
21
+ # Integration ID of the session in which the customer redeemed the referral
22
+ attr_accessor :session_id
23
+
24
+ # Integration ID of the Advocate's Profile
25
+ attr_accessor :advocate_integration_id
26
+
27
+ # Integration ID of the Friend's Profile
28
+ attr_accessor :friend_integration_id
29
+
30
+ # Advocate's referral code.
31
+ attr_accessor :code
32
+
33
+ # Timestamp of the moment the customer redeemed the referral
34
+ attr_accessor :created
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'application_id' => :'applicationId',
40
+ :'session_id' => :'sessionId',
41
+ :'advocate_integration_id' => :'advocateIntegrationId',
42
+ :'friend_integration_id' => :'friendIntegrationId',
43
+ :'code' => :'code',
44
+ :'created' => :'created'
45
+ }
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.openapi_types
50
+ {
51
+ :'application_id' => :'Integer',
52
+ :'session_id' => :'String',
53
+ :'advocate_integration_id' => :'String',
54
+ :'friend_integration_id' => :'String',
55
+ :'code' => :'String',
56
+ :'created' => :'DateTime'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TalonOne::ApplicationReferee` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ attributes = attributes.each_with_object({}) { |(k, v), h|
75
+ if (!self.class.attribute_map.key?(k.to_sym))
76
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TalonOne::ApplicationReferee`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
77
+ end
78
+ h[k.to_sym] = v
79
+ }
80
+
81
+ if attributes.key?(:'application_id')
82
+ self.application_id = attributes[:'application_id']
83
+ end
84
+
85
+ if attributes.key?(:'session_id')
86
+ self.session_id = attributes[:'session_id']
87
+ end
88
+
89
+ if attributes.key?(:'advocate_integration_id')
90
+ self.advocate_integration_id = attributes[:'advocate_integration_id']
91
+ end
92
+
93
+ if attributes.key?(:'friend_integration_id')
94
+ self.friend_integration_id = attributes[:'friend_integration_id']
95
+ end
96
+
97
+ if attributes.key?(:'code')
98
+ self.code = attributes[:'code']
99
+ end
100
+
101
+ if attributes.key?(:'created')
102
+ self.created = attributes[:'created']
103
+ end
104
+ end
105
+
106
+ # Show invalid properties with the reasons. Usually used together with valid?
107
+ # @return Array for valid properties with the reasons
108
+ def list_invalid_properties
109
+ invalid_properties = Array.new
110
+ if @application_id.nil?
111
+ invalid_properties.push('invalid value for "application_id", application_id cannot be nil.')
112
+ end
113
+
114
+ if @session_id.nil?
115
+ invalid_properties.push('invalid value for "session_id", session_id cannot be nil.')
116
+ end
117
+
118
+ if @advocate_integration_id.nil?
119
+ invalid_properties.push('invalid value for "advocate_integration_id", advocate_integration_id cannot be nil.')
120
+ end
121
+
122
+ if @friend_integration_id.nil?
123
+ invalid_properties.push('invalid value for "friend_integration_id", friend_integration_id cannot be nil.')
124
+ end
125
+
126
+ if @code.nil?
127
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
128
+ end
129
+
130
+ if @created.nil?
131
+ invalid_properties.push('invalid value for "created", created cannot be nil.')
132
+ end
133
+
134
+ invalid_properties
135
+ end
136
+
137
+ # Check to see if the all the properties in the model are valid
138
+ # @return true if the model is valid
139
+ def valid?
140
+ return false if @application_id.nil?
141
+ return false if @session_id.nil?
142
+ return false if @advocate_integration_id.nil?
143
+ return false if @friend_integration_id.nil?
144
+ return false if @code.nil?
145
+ return false if @created.nil?
146
+ true
147
+ end
148
+
149
+ # Checks equality by comparing each attribute.
150
+ # @param [Object] Object to be compared
151
+ def ==(o)
152
+ return true if self.equal?(o)
153
+ self.class == o.class &&
154
+ application_id == o.application_id &&
155
+ session_id == o.session_id &&
156
+ advocate_integration_id == o.advocate_integration_id &&
157
+ friend_integration_id == o.friend_integration_id &&
158
+ code == o.code &&
159
+ created == o.created
160
+ end
161
+
162
+ # @see the `==` method
163
+ # @param [Object] Object to be compared
164
+ def eql?(o)
165
+ self == o
166
+ end
167
+
168
+ # Calculates hash code according to all attributes.
169
+ # @return [Integer] Hash code
170
+ def hash
171
+ [application_id, session_id, advocate_integration_id, friend_integration_id, code, created].hash
172
+ end
173
+
174
+ # Builds the object from hash
175
+ # @param [Hash] attributes Model attributes in the form of hash
176
+ # @return [Object] Returns the model itself
177
+ def self.build_from_hash(attributes)
178
+ new.build_from_hash(attributes)
179
+ end
180
+
181
+ # Builds the object from hash
182
+ # @param [Hash] attributes Model attributes in the form of hash
183
+ # @return [Object] Returns the model itself
184
+ def build_from_hash(attributes)
185
+ return nil unless attributes.is_a?(Hash)
186
+ self.class.openapi_types.each_pair do |key, type|
187
+ if type =~ /\AArray<(.*)>/i
188
+ # check to ensure the input is an array given that the attribute
189
+ # is documented as an array but the input is not
190
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
191
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
192
+ end
193
+ elsif !attributes[self.class.attribute_map[key]].nil?
194
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
195
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
196
+ end
197
+
198
+ self
199
+ end
200
+
201
+ # Deserializes the data based on type
202
+ # @param string type Data type
203
+ # @param string value Value to be deserialized
204
+ # @return [Object] Deserialized data
205
+ def _deserialize(type, value)
206
+ case type.to_sym
207
+ when :DateTime
208
+ DateTime.parse(value)
209
+ when :Date
210
+ Date.parse(value)
211
+ when :String
212
+ value.to_s
213
+ when :Integer
214
+ value.to_i
215
+ when :Float
216
+ value.to_f
217
+ when :Boolean
218
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
219
+ true
220
+ else
221
+ false
222
+ end
223
+ when :Object
224
+ # generic object (usually a Hash), return directly
225
+ value
226
+ when /\AArray<(?<inner_type>.+)>\z/
227
+ inner_type = Regexp.last_match[:inner_type]
228
+ value.map { |v| _deserialize(inner_type, v) }
229
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
230
+ k_type = Regexp.last_match[:k_type]
231
+ v_type = Regexp.last_match[:v_type]
232
+ {}.tap do |hash|
233
+ value.each do |k, v|
234
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
235
+ end
236
+ end
237
+ else # model
238
+ TalonOne.const_get(type).build_from_hash(value)
239
+ end
240
+ end
241
+
242
+ # Returns the string representation of the object
243
+ # @return [String] String presentation of the object
244
+ def to_s
245
+ to_hash.to_s
246
+ end
247
+
248
+ # to_body is an alias to to_hash (backward compatibility)
249
+ # @return [Hash] Returns the object in the form of hash
250
+ def to_body
251
+ to_hash
252
+ end
253
+
254
+ # Returns the object in the form of hash
255
+ # @return [Hash] Returns the object in the form of hash
256
+ def to_hash
257
+ hash = {}
258
+ self.class.attribute_map.each_pair do |attr, param|
259
+ value = self.send(attr)
260
+ if value.nil?
261
+ is_nullable = self.class.openapi_nullable.include?(attr)
262
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
263
+ end
264
+
265
+ hash[param] = _to_hash(value)
266
+ end
267
+ hash
268
+ end
269
+
270
+ # Outputs non-array value in the form of hash
271
+ # For object, use to_hash. Otherwise, just return the value
272
+ # @param [Object] value Any valid value
273
+ # @return [Hash] Returns the value in the form of hash
274
+ def _to_hash(value)
275
+ if value.is_a?(Array)
276
+ value.compact.map { |v| _to_hash(v) }
277
+ elsif value.is_a?(Hash)
278
+ {}.tap do |hash|
279
+ value.each { |k, v| hash[k] = _to_hash(v) }
280
+ end
281
+ elsif value.respond_to? :to_hash
282
+ value.to_hash
283
+ else
284
+ value
285
+ end
286
+ end
287
+ end
288
+ end