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