talon_one 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +22 -12
  3. data/docs/AddLoyaltyPointsEffectProps.md +3 -1
  4. data/docs/Application.md +2 -0
  5. data/docs/ApplicationEvent.md +3 -1
  6. data/docs/Binding.md +2 -0
  7. data/docs/Campaign.md +11 -1
  8. data/docs/CartItem.md +1 -3
  9. data/docs/Change.md +2 -0
  10. data/docs/CustomerProfileIntegrationRequestV2.md +3 -1
  11. data/docs/DeductLoyaltyPointsEffectProps.md +3 -1
  12. data/docs/Effect.md +2 -0
  13. data/docs/EffectEntity.md +3 -1
  14. data/docs/Import.md +1 -1
  15. data/docs/InlineResponse20020.md +2 -2
  16. data/docs/InlineResponse20021.md +1 -1
  17. data/docs/InlineResponse20022.md +1 -1
  18. data/docs/InlineResponse20023.md +1 -1
  19. data/docs/InlineResponse20024.md +1 -1
  20. data/docs/InlineResponse20025.md +1 -1
  21. data/docs/InlineResponse20026.md +1 -1
  22. data/docs/InlineResponse20027.md +2 -4
  23. data/docs/InlineResponse20028.md +4 -2
  24. data/docs/InlineResponse20029.md +1 -1
  25. data/docs/IntegrationApi.md +27 -27
  26. data/docs/IntegrationRequest.md +1 -1
  27. data/docs/IntegrationStateV2.md +2 -0
  28. data/docs/LoyaltyProgramBalance.md +10 -2
  29. data/docs/LoyaltyProgramLedgers.md +3 -1
  30. data/docs/LoyaltySubLedger.md +1 -1
  31. data/docs/ManagementApi.md +623 -169
  32. data/docs/NewApplication.md +2 -0
  33. data/docs/NewCoupons.md +5 -5
  34. data/docs/NewCouponsForMultipleRecipients.md +31 -0
  35. data/docs/ProfileAudiencesChanges.md +19 -0
  36. data/docs/RejectCouponEffectProps.md +7 -1
  37. data/docs/RejectReferralEffectProps.md +7 -1
  38. data/docs/RollbackAddedLoyaltyPointsEffectProps.md +25 -0
  39. data/docs/RollbackDeductedLoyaltyPointsEffectProps.md +29 -0
  40. data/docs/RollbackReferralEffectProps.md +17 -0
  41. data/docs/RuleFailureReason.md +39 -0
  42. data/docs/UpdateApplication.md +2 -0
  43. data/lib/talon_one.rb +6 -3
  44. data/lib/talon_one/api/integration_api.rb +30 -30
  45. data/lib/talon_one/api/management_api.rb +816 -242
  46. data/lib/talon_one/models/add_loyalty_points_effect_props.rb +19 -4
  47. data/lib/talon_one/models/application.rb +23 -1
  48. data/lib/talon_one/models/application_api_key.rb +2 -2
  49. data/lib/talon_one/models/application_event.rb +16 -4
  50. data/lib/talon_one/models/binding.rb +11 -1
  51. data/lib/talon_one/models/campaign.rb +52 -2
  52. data/lib/talon_one/models/cart_item.rb +4 -13
  53. data/lib/talon_one/models/change.rb +11 -1
  54. data/lib/talon_one/models/code_generator_settings.rb +9 -0
  55. data/lib/talon_one/models/create_application_api_key.rb +2 -2
  56. data/lib/talon_one/models/customer_profile_integration_request_v2.rb +11 -2
  57. data/lib/talon_one/models/customer_session.rb +38 -0
  58. data/lib/talon_one/models/customer_session_v2.rb +15 -0
  59. data/lib/talon_one/models/deduct_loyalty_points_effect_props.rb +19 -4
  60. data/lib/talon_one/models/effect.rb +11 -1
  61. data/lib/talon_one/models/effect_entity.rb +14 -4
  62. data/lib/talon_one/models/import.rb +1 -35
  63. data/lib/talon_one/models/inline_response20020.rb +1 -6
  64. data/lib/talon_one/models/inline_response20021.rb +1 -1
  65. data/lib/talon_one/models/inline_response20022.rb +1 -1
  66. data/lib/talon_one/models/inline_response20023.rb +1 -1
  67. data/lib/talon_one/models/inline_response20024.rb +1 -1
  68. data/lib/talon_one/models/inline_response20025.rb +1 -1
  69. data/lib/talon_one/models/inline_response20026.rb +1 -1
  70. data/lib/talon_one/models/inline_response20027.rb +7 -11
  71. data/lib/talon_one/models/inline_response20028.rb +11 -7
  72. data/lib/talon_one/models/inline_response20029.rb +1 -1
  73. data/lib/talon_one/models/integration_request.rb +1 -1
  74. data/lib/talon_one/models/integration_state_v2.rb +12 -1
  75. data/lib/talon_one/models/limit_config.rb +0 -12
  76. data/lib/talon_one/models/loyalty_points.rb +28 -0
  77. data/lib/talon_one/models/loyalty_program_balance.rb +65 -4
  78. data/lib/talon_one/models/loyalty_program_ledgers.rb +16 -1
  79. data/lib/talon_one/models/loyalty_sub_ledger.rb +1 -1
  80. data/lib/talon_one/models/new_application.rb +23 -1
  81. data/lib/talon_one/models/new_application_api_key.rb +2 -2
  82. data/lib/talon_one/models/new_coupons.rb +36 -41
  83. data/lib/talon_one/models/new_coupons_for_multiple_recipients.rb +368 -0
  84. data/lib/talon_one/models/new_customer_session.rb +30 -0
  85. data/lib/talon_one/models/new_customer_session_v2.rb +15 -0
  86. data/lib/talon_one/models/{new_import.rb → profile_audiences_changes.rb} +32 -48
  87. data/lib/talon_one/models/reject_coupon_effect_props.rb +34 -4
  88. data/lib/talon_one/models/reject_referral_effect_props.rb +34 -4
  89. data/lib/talon_one/models/{cart_item_adjustment.rb → rollback_added_loyalty_points_effect_props.rb} +63 -61
  90. data/lib/talon_one/models/rollback_deducted_loyalty_points_effect_props.rb +293 -0
  91. data/lib/talon_one/models/{import_coupons.rb → rollback_referral_effect_props.rb} +15 -13
  92. data/lib/talon_one/models/rule_failure_reason.rb +343 -0
  93. data/lib/talon_one/models/update_application.rb +23 -1
  94. data/lib/talon_one/version.rb +1 -1
  95. data/spec/api/integration_api_spec.rb +15 -15
  96. data/spec/api/management_api_spec.rb +183 -68
  97. data/spec/models/add_loyalty_points_effect_props_spec.rb +6 -0
  98. data/spec/models/application_api_key_spec.rb +1 -1
  99. data/spec/models/application_event_spec.rb +6 -0
  100. data/spec/models/application_spec.rb +10 -0
  101. data/spec/models/binding_spec.rb +6 -0
  102. data/spec/models/campaign_spec.rb +30 -0
  103. data/spec/models/cart_item_spec.rb +0 -6
  104. data/spec/models/change_spec.rb +6 -0
  105. data/spec/models/create_application_api_key_spec.rb +1 -1
  106. data/spec/models/customer_profile_integration_request_v2_spec.rb +7 -1
  107. data/spec/models/deduct_loyalty_points_effect_props_spec.rb +6 -0
  108. data/spec/models/effect_entity_spec.rb +6 -0
  109. data/spec/models/effect_spec.rb +6 -0
  110. data/spec/models/import_spec.rb +0 -4
  111. data/spec/models/inline_response20027_spec.rb +0 -6
  112. data/spec/models/inline_response20028_spec.rb +6 -0
  113. data/spec/models/integration_request_spec.rb +1 -1
  114. data/spec/models/integration_state_v2_spec.rb +6 -0
  115. data/spec/models/limit_config_spec.rb +0 -4
  116. data/spec/models/loyalty_program_balance_spec.rb +24 -0
  117. data/spec/models/loyalty_program_ledgers_spec.rb +6 -0
  118. data/spec/models/new_application_api_key_spec.rb +1 -1
  119. data/spec/models/new_application_spec.rb +10 -0
  120. data/spec/models/new_coupons_for_multiple_recipients_spec.rb +83 -0
  121. data/spec/models/new_coupons_spec.rb +6 -6
  122. data/spec/models/{cart_item_adjustment_spec.rb → profile_audiences_changes_spec.rb} +8 -14
  123. data/spec/models/reject_coupon_effect_props_spec.rb +18 -0
  124. data/spec/models/reject_referral_effect_props_spec.rb +18 -0
  125. data/spec/models/rollback_added_loyalty_points_effect_props_spec.rb +65 -0
  126. data/spec/models/rollback_deducted_loyalty_points_effect_props_spec.rb +77 -0
  127. data/spec/models/{import_coupons_spec.rb → rollback_referral_effect_props_spec.rb} +7 -7
  128. data/spec/models/rule_failure_reason_spec.rb +107 -0
  129. data/spec/models/update_application_spec.rb +10 -0
  130. metadata +26 -14
  131. data/docs/CartItemAdjustment.md +0 -21
  132. data/docs/ImportCoupons.md +0 -17
  133. data/docs/NewImport.md +0 -17
  134. data/spec/models/new_import_spec.rb +0 -45
@@ -0,0 +1,293 @@
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 \"rollbackDeductedLoyaltyPoints\" effect. This effect is triggered whenever a previously closed session is cancelled and a deductLoyaltyPoints effect was revoked.
17
+ class RollbackDeductedLoyaltyPointsEffectProps
18
+ # The ID of the loyalty program where these points were reimbursed
19
+ attr_accessor :program_id
20
+
21
+ # The ID of the subledger within the loyalty program where these points were reimbursed
22
+ attr_accessor :sub_ledger_id
23
+
24
+ # The amount of reimbursed points that were added
25
+ attr_accessor :value
26
+
27
+ # The user for whom these points were reimbursed
28
+ attr_accessor :recipient_integration_id
29
+
30
+ # Date after which the reimbursed points will be valid
31
+ attr_accessor :start_date
32
+
33
+ # Date after which the reimbursed points will expire
34
+ attr_accessor :expiry_date
35
+
36
+ # The identifier of 'addition' entries added to the ledger as the `deductLoyaltyPoints` effect is rolled back
37
+ attr_accessor :transaction_uuid
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ :'program_id' => :'programId',
43
+ :'sub_ledger_id' => :'subLedgerId',
44
+ :'value' => :'value',
45
+ :'recipient_integration_id' => :'recipientIntegrationId',
46
+ :'start_date' => :'startDate',
47
+ :'expiry_date' => :'expiryDate',
48
+ :'transaction_uuid' => :'transactionUUID'
49
+ }
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.openapi_types
54
+ {
55
+ :'program_id' => :'Integer',
56
+ :'sub_ledger_id' => :'String',
57
+ :'value' => :'Float',
58
+ :'recipient_integration_id' => :'String',
59
+ :'start_date' => :'DateTime',
60
+ :'expiry_date' => :'DateTime',
61
+ :'transaction_uuid' => :'String'
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::RollbackDeductedLoyaltyPointsEffectProps` 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::RollbackDeductedLoyaltyPointsEffectProps`. 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?(:'program_id')
87
+ self.program_id = attributes[:'program_id']
88
+ end
89
+
90
+ if attributes.key?(:'sub_ledger_id')
91
+ self.sub_ledger_id = attributes[:'sub_ledger_id']
92
+ end
93
+
94
+ if attributes.key?(:'value')
95
+ self.value = attributes[:'value']
96
+ end
97
+
98
+ if attributes.key?(:'recipient_integration_id')
99
+ self.recipient_integration_id = attributes[:'recipient_integration_id']
100
+ end
101
+
102
+ if attributes.key?(:'start_date')
103
+ self.start_date = attributes[:'start_date']
104
+ end
105
+
106
+ if attributes.key?(:'expiry_date')
107
+ self.expiry_date = attributes[:'expiry_date']
108
+ end
109
+
110
+ if attributes.key?(:'transaction_uuid')
111
+ self.transaction_uuid = attributes[:'transaction_uuid']
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ invalid_properties = Array.new
119
+ if @program_id.nil?
120
+ invalid_properties.push('invalid value for "program_id", program_id cannot be nil.')
121
+ end
122
+
123
+ if @sub_ledger_id.nil?
124
+ invalid_properties.push('invalid value for "sub_ledger_id", sub_ledger_id cannot be nil.')
125
+ end
126
+
127
+ if @value.nil?
128
+ invalid_properties.push('invalid value for "value", value cannot be nil.')
129
+ end
130
+
131
+ if @recipient_integration_id.nil?
132
+ invalid_properties.push('invalid value for "recipient_integration_id", recipient_integration_id cannot be nil.')
133
+ end
134
+
135
+ if @transaction_uuid.nil?
136
+ invalid_properties.push('invalid value for "transaction_uuid", transaction_uuid 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 @program_id.nil?
146
+ return false if @sub_ledger_id.nil?
147
+ return false if @value.nil?
148
+ return false if @recipient_integration_id.nil?
149
+ return false if @transaction_uuid.nil?
150
+ true
151
+ end
152
+
153
+ # Checks equality by comparing each attribute.
154
+ # @param [Object] Object to be compared
155
+ def ==(o)
156
+ return true if self.equal?(o)
157
+ self.class == o.class &&
158
+ program_id == o.program_id &&
159
+ sub_ledger_id == o.sub_ledger_id &&
160
+ value == o.value &&
161
+ recipient_integration_id == o.recipient_integration_id &&
162
+ start_date == o.start_date &&
163
+ expiry_date == o.expiry_date &&
164
+ transaction_uuid == o.transaction_uuid
165
+ end
166
+
167
+ # @see the `==` method
168
+ # @param [Object] Object to be compared
169
+ def eql?(o)
170
+ self == o
171
+ end
172
+
173
+ # Calculates hash code according to all attributes.
174
+ # @return [Integer] Hash code
175
+ def hash
176
+ [program_id, sub_ledger_id, value, recipient_integration_id, start_date, expiry_date, transaction_uuid].hash
177
+ end
178
+
179
+ # Builds the object from hash
180
+ # @param [Hash] attributes Model attributes in the form of hash
181
+ # @return [Object] Returns the model itself
182
+ def self.build_from_hash(attributes)
183
+ new.build_from_hash(attributes)
184
+ end
185
+
186
+ # Builds the object from hash
187
+ # @param [Hash] attributes Model attributes in the form of hash
188
+ # @return [Object] Returns the model itself
189
+ def build_from_hash(attributes)
190
+ return nil unless attributes.is_a?(Hash)
191
+ self.class.openapi_types.each_pair do |key, type|
192
+ if type =~ /\AArray<(.*)>/i
193
+ # check to ensure the input is an array given that the attribute
194
+ # is documented as an array but the input is not
195
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
196
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
197
+ end
198
+ elsif !attributes[self.class.attribute_map[key]].nil?
199
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
200
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
201
+ end
202
+
203
+ self
204
+ end
205
+
206
+ # Deserializes the data based on type
207
+ # @param string type Data type
208
+ # @param string value Value to be deserialized
209
+ # @return [Object] Deserialized data
210
+ def _deserialize(type, value)
211
+ case type.to_sym
212
+ when :DateTime
213
+ DateTime.parse(value)
214
+ when :Date
215
+ Date.parse(value)
216
+ when :String
217
+ value.to_s
218
+ when :Integer
219
+ value.to_i
220
+ when :Float
221
+ value.to_f
222
+ when :Boolean
223
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
224
+ true
225
+ else
226
+ false
227
+ end
228
+ when :Object
229
+ # generic object (usually a Hash), return directly
230
+ value
231
+ when /\AArray<(?<inner_type>.+)>\z/
232
+ inner_type = Regexp.last_match[:inner_type]
233
+ value.map { |v| _deserialize(inner_type, v) }
234
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
235
+ k_type = Regexp.last_match[:k_type]
236
+ v_type = Regexp.last_match[:v_type]
237
+ {}.tap do |hash|
238
+ value.each do |k, v|
239
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
240
+ end
241
+ end
242
+ else # model
243
+ TalonOne.const_get(type).build_from_hash(value)
244
+ end
245
+ end
246
+
247
+ # Returns the string representation of the object
248
+ # @return [String] String presentation of the object
249
+ def to_s
250
+ to_hash.to_s
251
+ end
252
+
253
+ # to_body is an alias to to_hash (backward compatibility)
254
+ # @return [Hash] Returns the object in the form of hash
255
+ def to_body
256
+ to_hash
257
+ end
258
+
259
+ # Returns the object in the form of hash
260
+ # @return [Hash] Returns the object in the form of hash
261
+ def to_hash
262
+ hash = {}
263
+ self.class.attribute_map.each_pair do |attr, param|
264
+ value = self.send(attr)
265
+ if value.nil?
266
+ is_nullable = self.class.openapi_nullable.include?(attr)
267
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
268
+ end
269
+
270
+ hash[param] = _to_hash(value)
271
+ end
272
+ hash
273
+ end
274
+
275
+ # Outputs non-array value in the form of hash
276
+ # For object, use to_hash. Otherwise, just return the value
277
+ # @param [Object] value Any valid value
278
+ # @return [Hash] Returns the value in the form of hash
279
+ def _to_hash(value)
280
+ if value.is_a?(Array)
281
+ value.compact.map { |v| _to_hash(v) }
282
+ elsif value.is_a?(Hash)
283
+ {}.tap do |hash|
284
+ value.each { |k, v| hash[k] = _to_hash(v) }
285
+ end
286
+ elsif value.respond_to? :to_hash
287
+ value.to_hash
288
+ else
289
+ value
290
+ end
291
+ end
292
+ end
293
+ end
@@ -13,20 +13,22 @@ OpenAPI Generator version: 4.3.1
13
13
  require 'date'
14
14
 
15
15
  module TalonOne
16
- class ImportCoupons
17
- attr_accessor :coupons
16
+ # The properties specific to the \"rollbackReferral\" effect. This gets triggered whenever previously closed session is now cancelled and a referral redemption was cancelled on our internal usage limit counters.
17
+ class RollbackReferralEffectProps
18
+ # The referral code whose usage has been rolled back
19
+ attr_accessor :value
18
20
 
19
21
  # Attribute mapping from ruby-style variable name to JSON key.
20
22
  def self.attribute_map
21
23
  {
22
- :'coupons' => :'coupons'
24
+ :'value' => :'value'
23
25
  }
24
26
  end
25
27
 
26
28
  # Attribute type mapping.
27
29
  def self.openapi_types
28
30
  {
29
- :'coupons' => :'String'
31
+ :'value' => :'String'
30
32
  }
31
33
  end
32
34
 
@@ -40,19 +42,19 @@ module TalonOne
40
42
  # @param [Hash] attributes Model attributes in the form of hash
41
43
  def initialize(attributes = {})
42
44
  if (!attributes.is_a?(Hash))
43
- fail ArgumentError, "The input argument (attributes) must be a hash in `TalonOne::ImportCoupons` initialize method"
45
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TalonOne::RollbackReferralEffectProps` initialize method"
44
46
  end
45
47
 
46
48
  # check to see if the attribute exists and convert string to symbol for hash key
47
49
  attributes = attributes.each_with_object({}) { |(k, v), h|
48
50
  if (!self.class.attribute_map.key?(k.to_sym))
49
- fail ArgumentError, "`#{k}` is not a valid attribute in `TalonOne::ImportCoupons`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
51
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TalonOne::RollbackReferralEffectProps`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
50
52
  end
51
53
  h[k.to_sym] = v
52
54
  }
53
55
 
54
- if attributes.key?(:'coupons')
55
- self.coupons = attributes[:'coupons']
56
+ if attributes.key?(:'value')
57
+ self.value = attributes[:'value']
56
58
  end
57
59
  end
58
60
 
@@ -60,8 +62,8 @@ module TalonOne
60
62
  # @return Array for valid properties with the reasons
61
63
  def list_invalid_properties
62
64
  invalid_properties = Array.new
63
- if @coupons.nil?
64
- invalid_properties.push('invalid value for "coupons", coupons cannot be nil.')
65
+ if @value.nil?
66
+ invalid_properties.push('invalid value for "value", value cannot be nil.')
65
67
  end
66
68
 
67
69
  invalid_properties
@@ -70,7 +72,7 @@ module TalonOne
70
72
  # Check to see if the all the properties in the model are valid
71
73
  # @return true if the model is valid
72
74
  def valid?
73
- return false if @coupons.nil?
75
+ return false if @value.nil?
74
76
  true
75
77
  end
76
78
 
@@ -79,7 +81,7 @@ module TalonOne
79
81
  def ==(o)
80
82
  return true if self.equal?(o)
81
83
  self.class == o.class &&
82
- coupons == o.coupons
84
+ value == o.value
83
85
  end
84
86
 
85
87
  # @see the `==` method
@@ -91,7 +93,7 @@ module TalonOne
91
93
  # Calculates hash code according to all attributes.
92
94
  # @return [Integer] Hash code
93
95
  def hash
94
- [coupons].hash
96
+ [value].hash
95
97
  end
96
98
 
97
99
  # Builds the object from hash
@@ -0,0 +1,343 @@
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
+ # Details about why a rule failed
17
+ class RuleFailureReason
18
+ # The ID of the campaign that contains the rule that failed
19
+ attr_accessor :campaign_id
20
+
21
+ # The name of the campaign that contains the rule that failed
22
+ attr_accessor :campaign_name
23
+
24
+ # The ID of the ruleset that contains the rule that failed
25
+ attr_accessor :ruleset_id
26
+
27
+ # The ID of the coupon that was being evaluated at the time of the rule failure
28
+ attr_accessor :coupon_id
29
+
30
+ # The value of the coupon that was being evaluated at the time of the rule failure
31
+ attr_accessor :coupon_value
32
+
33
+ # The ID of the referral that was being evaluated at the time of the rule failure
34
+ attr_accessor :referral_id
35
+
36
+ # The value of the referral that was being evaluated at the time of the rule failure
37
+ attr_accessor :referral_value
38
+
39
+ # The index of the rule that failed within the ruleset
40
+ attr_accessor :rule_index
41
+
42
+ # The name of the rule that failed within the ruleset
43
+ attr_accessor :rule_name
44
+
45
+ # The index of the condition that failed
46
+ attr_accessor :condition_index
47
+
48
+ # The index of the effect that failed
49
+ attr_accessor :effect_index
50
+
51
+ # More details about the failure
52
+ attr_accessor :details
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'campaign_id' => :'campaignID',
58
+ :'campaign_name' => :'campaignName',
59
+ :'ruleset_id' => :'rulesetID',
60
+ :'coupon_id' => :'couponID',
61
+ :'coupon_value' => :'couponValue',
62
+ :'referral_id' => :'referralID',
63
+ :'referral_value' => :'referralValue',
64
+ :'rule_index' => :'ruleIndex',
65
+ :'rule_name' => :'ruleName',
66
+ :'condition_index' => :'conditionIndex',
67
+ :'effect_index' => :'effectIndex',
68
+ :'details' => :'details'
69
+ }
70
+ end
71
+
72
+ # Attribute type mapping.
73
+ def self.openapi_types
74
+ {
75
+ :'campaign_id' => :'Integer',
76
+ :'campaign_name' => :'String',
77
+ :'ruleset_id' => :'Integer',
78
+ :'coupon_id' => :'Integer',
79
+ :'coupon_value' => :'String',
80
+ :'referral_id' => :'Integer',
81
+ :'referral_value' => :'String',
82
+ :'rule_index' => :'Integer',
83
+ :'rule_name' => :'String',
84
+ :'condition_index' => :'Integer',
85
+ :'effect_index' => :'Integer',
86
+ :'details' => :'String'
87
+ }
88
+ end
89
+
90
+ # List of attributes with nullable: true
91
+ def self.openapi_nullable
92
+ Set.new([
93
+ ])
94
+ end
95
+
96
+ # Initializes the object
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ def initialize(attributes = {})
99
+ if (!attributes.is_a?(Hash))
100
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TalonOne::RuleFailureReason` initialize method"
101
+ end
102
+
103
+ # check to see if the attribute exists and convert string to symbol for hash key
104
+ attributes = attributes.each_with_object({}) { |(k, v), h|
105
+ if (!self.class.attribute_map.key?(k.to_sym))
106
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TalonOne::RuleFailureReason`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
107
+ end
108
+ h[k.to_sym] = v
109
+ }
110
+
111
+ if attributes.key?(:'campaign_id')
112
+ self.campaign_id = attributes[:'campaign_id']
113
+ end
114
+
115
+ if attributes.key?(:'campaign_name')
116
+ self.campaign_name = attributes[:'campaign_name']
117
+ end
118
+
119
+ if attributes.key?(:'ruleset_id')
120
+ self.ruleset_id = attributes[:'ruleset_id']
121
+ end
122
+
123
+ if attributes.key?(:'coupon_id')
124
+ self.coupon_id = attributes[:'coupon_id']
125
+ end
126
+
127
+ if attributes.key?(:'coupon_value')
128
+ self.coupon_value = attributes[:'coupon_value']
129
+ end
130
+
131
+ if attributes.key?(:'referral_id')
132
+ self.referral_id = attributes[:'referral_id']
133
+ end
134
+
135
+ if attributes.key?(:'referral_value')
136
+ self.referral_value = attributes[:'referral_value']
137
+ end
138
+
139
+ if attributes.key?(:'rule_index')
140
+ self.rule_index = attributes[:'rule_index']
141
+ end
142
+
143
+ if attributes.key?(:'rule_name')
144
+ self.rule_name = attributes[:'rule_name']
145
+ end
146
+
147
+ if attributes.key?(:'condition_index')
148
+ self.condition_index = attributes[:'condition_index']
149
+ end
150
+
151
+ if attributes.key?(:'effect_index')
152
+ self.effect_index = attributes[:'effect_index']
153
+ end
154
+
155
+ if attributes.key?(:'details')
156
+ self.details = attributes[:'details']
157
+ end
158
+ end
159
+
160
+ # Show invalid properties with the reasons. Usually used together with valid?
161
+ # @return Array for valid properties with the reasons
162
+ def list_invalid_properties
163
+ invalid_properties = Array.new
164
+ if @campaign_id.nil?
165
+ invalid_properties.push('invalid value for "campaign_id", campaign_id cannot be nil.')
166
+ end
167
+
168
+ if @campaign_name.nil?
169
+ invalid_properties.push('invalid value for "campaign_name", campaign_name cannot be nil.')
170
+ end
171
+
172
+ if @ruleset_id.nil?
173
+ invalid_properties.push('invalid value for "ruleset_id", ruleset_id cannot be nil.')
174
+ end
175
+
176
+ if @rule_index.nil?
177
+ invalid_properties.push('invalid value for "rule_index", rule_index cannot be nil.')
178
+ end
179
+
180
+ if @rule_name.nil?
181
+ invalid_properties.push('invalid value for "rule_name", rule_name cannot be nil.')
182
+ end
183
+
184
+ invalid_properties
185
+ end
186
+
187
+ # Check to see if the all the properties in the model are valid
188
+ # @return true if the model is valid
189
+ def valid?
190
+ return false if @campaign_id.nil?
191
+ return false if @campaign_name.nil?
192
+ return false if @ruleset_id.nil?
193
+ return false if @rule_index.nil?
194
+ return false if @rule_name.nil?
195
+ true
196
+ end
197
+
198
+ # Checks equality by comparing each attribute.
199
+ # @param [Object] Object to be compared
200
+ def ==(o)
201
+ return true if self.equal?(o)
202
+ self.class == o.class &&
203
+ campaign_id == o.campaign_id &&
204
+ campaign_name == o.campaign_name &&
205
+ ruleset_id == o.ruleset_id &&
206
+ coupon_id == o.coupon_id &&
207
+ coupon_value == o.coupon_value &&
208
+ referral_id == o.referral_id &&
209
+ referral_value == o.referral_value &&
210
+ rule_index == o.rule_index &&
211
+ rule_name == o.rule_name &&
212
+ condition_index == o.condition_index &&
213
+ effect_index == o.effect_index &&
214
+ details == o.details
215
+ end
216
+
217
+ # @see the `==` method
218
+ # @param [Object] Object to be compared
219
+ def eql?(o)
220
+ self == o
221
+ end
222
+
223
+ # Calculates hash code according to all attributes.
224
+ # @return [Integer] Hash code
225
+ def hash
226
+ [campaign_id, campaign_name, ruleset_id, coupon_id, coupon_value, referral_id, referral_value, rule_index, rule_name, condition_index, effect_index, details].hash
227
+ end
228
+
229
+ # Builds the object from hash
230
+ # @param [Hash] attributes Model attributes in the form of hash
231
+ # @return [Object] Returns the model itself
232
+ def self.build_from_hash(attributes)
233
+ new.build_from_hash(attributes)
234
+ end
235
+
236
+ # Builds the object from hash
237
+ # @param [Hash] attributes Model attributes in the form of hash
238
+ # @return [Object] Returns the model itself
239
+ def build_from_hash(attributes)
240
+ return nil unless attributes.is_a?(Hash)
241
+ self.class.openapi_types.each_pair do |key, type|
242
+ if type =~ /\AArray<(.*)>/i
243
+ # check to ensure the input is an array given that the attribute
244
+ # is documented as an array but the input is not
245
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
246
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
247
+ end
248
+ elsif !attributes[self.class.attribute_map[key]].nil?
249
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
250
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
251
+ end
252
+
253
+ self
254
+ end
255
+
256
+ # Deserializes the data based on type
257
+ # @param string type Data type
258
+ # @param string value Value to be deserialized
259
+ # @return [Object] Deserialized data
260
+ def _deserialize(type, value)
261
+ case type.to_sym
262
+ when :DateTime
263
+ DateTime.parse(value)
264
+ when :Date
265
+ Date.parse(value)
266
+ when :String
267
+ value.to_s
268
+ when :Integer
269
+ value.to_i
270
+ when :Float
271
+ value.to_f
272
+ when :Boolean
273
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
274
+ true
275
+ else
276
+ false
277
+ end
278
+ when :Object
279
+ # generic object (usually a Hash), return directly
280
+ value
281
+ when /\AArray<(?<inner_type>.+)>\z/
282
+ inner_type = Regexp.last_match[:inner_type]
283
+ value.map { |v| _deserialize(inner_type, v) }
284
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
285
+ k_type = Regexp.last_match[:k_type]
286
+ v_type = Regexp.last_match[:v_type]
287
+ {}.tap do |hash|
288
+ value.each do |k, v|
289
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
290
+ end
291
+ end
292
+ else # model
293
+ TalonOne.const_get(type).build_from_hash(value)
294
+ end
295
+ end
296
+
297
+ # Returns the string representation of the object
298
+ # @return [String] String presentation of the object
299
+ def to_s
300
+ to_hash.to_s
301
+ end
302
+
303
+ # to_body is an alias to to_hash (backward compatibility)
304
+ # @return [Hash] Returns the object in the form of hash
305
+ def to_body
306
+ to_hash
307
+ end
308
+
309
+ # Returns the object in the form of hash
310
+ # @return [Hash] Returns the object in the form of hash
311
+ def to_hash
312
+ hash = {}
313
+ self.class.attribute_map.each_pair do |attr, param|
314
+ value = self.send(attr)
315
+ if value.nil?
316
+ is_nullable = self.class.openapi_nullable.include?(attr)
317
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
318
+ end
319
+
320
+ hash[param] = _to_hash(value)
321
+ end
322
+ hash
323
+ end
324
+
325
+ # Outputs non-array value in the form of hash
326
+ # For object, use to_hash. Otherwise, just return the value
327
+ # @param [Object] value Any valid value
328
+ # @return [Hash] Returns the value in the form of hash
329
+ def _to_hash(value)
330
+ if value.is_a?(Array)
331
+ value.compact.map { |v| _to_hash(v) }
332
+ elsif value.is_a?(Hash)
333
+ {}.tap do |hash|
334
+ value.each { |k, v| hash[k] = _to_hash(v) }
335
+ end
336
+ elsif value.respond_to? :to_hash
337
+ value.to_hash
338
+ else
339
+ value
340
+ end
341
+ end
342
+ end
343
+ end