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