tremendous_ruby 5.5.0 → 5.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tremendous/api/tremendous_api.rb +54 -256
  3. data/lib/tremendous/models/base_order_for_create.rb +1 -1
  4. data/lib/tremendous/models/create_order200_response.rb +1 -1
  5. data/lib/tremendous/models/create_order200_response_order.rb +403 -0
  6. data/lib/tremendous/models/create_order200_response_order_rewards_inner.rb +326 -0
  7. data/lib/tremendous/models/create_order200_response_order_rewards_inner_delivery.rb +296 -0
  8. data/lib/tremendous/models/{create_public_key_request.rb → create_order201_response.rb} +14 -15
  9. data/lib/tremendous/models/create_order_request.rb +1 -1
  10. data/lib/tremendous/models/create_organization.rb +51 -4
  11. data/lib/tremendous/models/create_organization200_response_organization.rb +20 -45
  12. data/lib/tremendous/models/{public_keys_response_public_keys_inner.rb → create_organization_for_response.rb} +72 -20
  13. data/lib/tremendous/models/{public_key.rb → create_organization_properties.rb} +57 -20
  14. data/lib/tremendous/models/create_organization_request.rb +7 -0
  15. data/lib/tremendous/models/create_report201_response.rb +231 -0
  16. data/lib/tremendous/models/create_report201_response_report.rb +291 -0
  17. data/lib/tremendous/models/create_report_request.rb +295 -0
  18. data/lib/tremendous/models/{create_public_key200_response.rb → create_report_request_filters.rb} +12 -17
  19. data/lib/tremendous/models/{create_invoice.rb → create_report_request_filters_digital_rewards.rb} +128 -32
  20. data/lib/tremendous/models/{create_public_key.rb → create_report_request_filters_digital_rewards_amount.rb} +22 -18
  21. data/lib/tremendous/models/{public_keys_response.rb → create_report_request_filters_digital_rewards_created_at.rb} +22 -19
  22. data/lib/tremendous/models/delivery_details.rb +0 -14
  23. data/lib/tremendous/models/delivery_details_with_link.rb +296 -0
  24. data/lib/tremendous/models/error_model.rb +11 -1
  25. data/lib/tremendous/models/fraud_rule400_response.rb +11 -1
  26. data/lib/tremendous/models/fraud_rule422_response.rb +11 -1
  27. data/lib/tremendous/models/fraud_rules_list_item.rb +4 -2
  28. data/lib/tremendous/models/generate_reward_link403_response.rb +11 -1
  29. data/lib/tremendous/models/invoice.rb +10 -1
  30. data/lib/tremendous/models/list_fraud_reviews200_response.rb +21 -4
  31. data/lib/tremendous/models/list_fraud_rules200_response_fraud_rules_inner.rb +4 -2
  32. data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb +37 -7
  33. data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta_failure_details.rb +225 -0
  34. data/lib/tremendous/models/list_invoices200_response_invoices_inner.rb +10 -1
  35. data/lib/tremendous/models/list_orders200_response_orders_inner_payment.rb +4 -48
  36. data/lib/tremendous/models/list_rewards200_response_rewards_inner_delivery.rb +0 -14
  37. data/lib/tremendous/models/list_rewards401_response.rb +11 -1
  38. data/lib/tremendous/models/list_rewards401_response_errors.rb +4 -2
  39. data/lib/tremendous/models/list_rewards429_response.rb +11 -1
  40. data/lib/tremendous/models/order_base_payment.rb +4 -48
  41. data/lib/tremendous/models/order_with_link.rb +403 -0
  42. data/lib/tremendous/models/order_with_link_rewards_inner.rb +385 -0
  43. data/lib/tremendous/models/payment_details.rb +4 -48
  44. data/lib/tremendous/models/payout.rb +352 -0
  45. data/lib/tremendous/models/report.rb +291 -0
  46. data/lib/tremendous/models/resend_reward422_response.rb +11 -1
  47. data/lib/tremendous/models/resend_reward_request.rb +225 -0
  48. data/lib/tremendous/models/reward_for_order_create.rb +1 -1
  49. data/lib/tremendous/models/{single_reward_order1_reward.rb → reward_with_link.rb} +78 -16
  50. data/lib/tremendous/models/reward_with_link_delivery.rb +296 -0
  51. data/lib/tremendous/models/reward_without_link_delivery.rb +0 -14
  52. data/lib/tremendous/models/single_reward_order.rb +1 -1
  53. data/lib/tremendous/models/{single_reward_order1_payment.rb → single_reward_order_payment.rb} +3 -3
  54. data/lib/tremendous/models/single_reward_order_reward.rb +3 -75
  55. data/lib/tremendous/models/{single_reward_order1_reward_custom_fields_inner.rb → single_reward_order_reward_custom_fields_inner.rb} +3 -3
  56. data/lib/tremendous/models/{single_reward_order1_reward_delivery.rb → single_reward_order_reward_delivery.rb} +3 -3
  57. data/lib/tremendous/models/{test_public_key.rb → single_reward_order_with_link.rb} +14 -15
  58. data/lib/tremendous/models/single_reward_order_with_link_order.rb +403 -0
  59. data/lib/tremendous/version.rb +1 -1
  60. data/lib/tremendous.rb +27 -14
  61. metadata +29 -16
  62. data/lib/tremendous/models/single_reward_order1.rb +0 -242
  63. data/lib/tremendous/models/test_public_key_request.rb +0 -222
@@ -0,0 +1,403 @@
1
+ =begin
2
+ #API Endpoints
3
+
4
+ #Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API.
5
+
6
+ The version of the OpenAPI document: 2
7
+ Contact: developers@tremendous.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Tremendous
17
+ # An order wraps around the fulfilment of one or more rewards.
18
+ class CreateOrder200ResponseOrder
19
+ # Tremendous ID of the order
20
+ attr_accessor :id
21
+
22
+ # Reference for this order, supplied by the customer. When set, `external_id` makes order idempotent. All requests that use the same `external_id` after the initial order creation, will result in a response that returns the data of the initially created order. The response will have a `201` response code. These responses **fail** to create any further orders. It also allows for retrieving by `external_id` instead of `id` only.
23
+ attr_accessor :external_id
24
+
25
+ # ID of the campaign in your account, that defines the available products (different gift cards, charity, etc.) that the recipient can choose from.
26
+ attr_accessor :campaign_id
27
+
28
+ # Date the order has been created
29
+ attr_accessor :created_at
30
+
31
+ # Execution status of a given order <table> <thead> <tr> <th> Status </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <code> CANCELED </code> </td> <td> The order and all of its rewards were canceled. </td> </tr> <tr> <td> <code> CART </code> </td> <td> The order has been created, but hasn't yet been processed. </td> </tr> <tr> <td> <code> EXECUTED </code> </td> <td> The order has been executed. Payment has been handled and rewards are being delivered (if applicable). </td> </tr> <tr> <td> <code> FAILED </code> </td> <td> The order could not be processed due to an error. E.g. due to insufficient funds in the account. </td> </tr> <tr> <td> <code> PENDING APPROVAL </code> </td> <td> The order has been created but needs approval to be executed. </td> </tr> <tr> <td> <code> PENDING INTERNAL PAYMENT APPROVAL </code> </td> <td> The order has been created but it is under review and requires approval from our team. </td> </tr> </tbody> </table>
32
+ attr_accessor :status
33
+
34
+ # Name of the channel in which the order was created
35
+ attr_accessor :channel
36
+
37
+ attr_accessor :payment
38
+
39
+ # The ID for the invoice associated with this order
40
+ attr_accessor :invoice_id
41
+
42
+ attr_accessor :rewards
43
+
44
+ class EnumAttributeValidator
45
+ attr_reader :datatype
46
+ attr_reader :allowable_values
47
+
48
+ def initialize(datatype, allowable_values)
49
+ @allowable_values = allowable_values.map do |value|
50
+ case datatype.to_s
51
+ when /Integer/i
52
+ value.to_i
53
+ when /Float/i
54
+ value.to_f
55
+ else
56
+ value
57
+ end
58
+ end
59
+ end
60
+
61
+ def valid?(value)
62
+ !value || allowable_values.include?(value)
63
+ end
64
+ end
65
+
66
+ # Attribute mapping from ruby-style variable name to JSON key.
67
+ def self.attribute_map
68
+ {
69
+ :'id' => :'id',
70
+ :'external_id' => :'external_id',
71
+ :'campaign_id' => :'campaign_id',
72
+ :'created_at' => :'created_at',
73
+ :'status' => :'status',
74
+ :'channel' => :'channel',
75
+ :'payment' => :'payment',
76
+ :'invoice_id' => :'invoice_id',
77
+ :'rewards' => :'rewards'
78
+ }
79
+ end
80
+
81
+ # Returns all the JSON keys this model knows about
82
+ def self.acceptable_attributes
83
+ attribute_map.values
84
+ end
85
+
86
+ # Attribute type mapping.
87
+ def self.openapi_types
88
+ {
89
+ :'id' => :'String',
90
+ :'external_id' => :'String',
91
+ :'campaign_id' => :'String',
92
+ :'created_at' => :'Time',
93
+ :'status' => :'String',
94
+ :'channel' => :'String',
95
+ :'payment' => :'ListOrders200ResponseOrdersInnerPayment',
96
+ :'invoice_id' => :'String',
97
+ :'rewards' => :'Array<CreateOrder200ResponseOrderRewardsInner>'
98
+ }
99
+ end
100
+
101
+ # List of attributes with nullable: true
102
+ def self.openapi_nullable
103
+ Set.new([
104
+ :'external_id',
105
+ :'campaign_id',
106
+ ])
107
+ end
108
+
109
+ # Initializes the object
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ def initialize(attributes = {})
112
+ if (!attributes.is_a?(Hash))
113
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::CreateOrder200ResponseOrder` initialize method"
114
+ end
115
+
116
+ # check to see if the attribute exists and convert string to symbol for hash key
117
+ attributes = attributes.each_with_object({}) { |(k, v), h|
118
+ if (!self.class.attribute_map.key?(k.to_sym))
119
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::CreateOrder200ResponseOrder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
120
+ end
121
+ h[k.to_sym] = v
122
+ }
123
+
124
+ if attributes.key?(:'id')
125
+ self.id = attributes[:'id']
126
+ else
127
+ self.id = nil
128
+ end
129
+
130
+ if attributes.key?(:'external_id')
131
+ self.external_id = attributes[:'external_id']
132
+ end
133
+
134
+ if attributes.key?(:'campaign_id')
135
+ self.campaign_id = attributes[:'campaign_id']
136
+ end
137
+
138
+ if attributes.key?(:'created_at')
139
+ self.created_at = attributes[:'created_at']
140
+ else
141
+ self.created_at = nil
142
+ end
143
+
144
+ if attributes.key?(:'status')
145
+ self.status = attributes[:'status']
146
+ else
147
+ self.status = nil
148
+ end
149
+
150
+ if attributes.key?(:'channel')
151
+ self.channel = attributes[:'channel']
152
+ end
153
+
154
+ if attributes.key?(:'payment')
155
+ self.payment = attributes[:'payment']
156
+ end
157
+
158
+ if attributes.key?(:'invoice_id')
159
+ self.invoice_id = attributes[:'invoice_id']
160
+ end
161
+
162
+ if attributes.key?(:'rewards')
163
+ if (value = attributes[:'rewards']).is_a?(Array)
164
+ self.rewards = value
165
+ end
166
+ end
167
+ end
168
+
169
+ # Show invalid properties with the reasons. Usually used together with valid?
170
+ # @return Array for valid properties with the reasons
171
+ def list_invalid_properties
172
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
173
+ invalid_properties = Array.new
174
+ if @id.nil?
175
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
176
+ end
177
+
178
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
179
+ if @id !~ pattern
180
+ invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
181
+ end
182
+
183
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
184
+ if !@campaign_id.nil? && @campaign_id !~ pattern
185
+ invalid_properties.push("invalid value for \"campaign_id\", must conform to the pattern #{pattern}.")
186
+ end
187
+
188
+ if @created_at.nil?
189
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
190
+ end
191
+
192
+ if @status.nil?
193
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
194
+ end
195
+
196
+ invalid_properties
197
+ end
198
+
199
+ # Check to see if the all the properties in the model are valid
200
+ # @return true if the model is valid
201
+ def valid?
202
+ warn '[DEPRECATED] the `valid?` method is obsolete'
203
+ return false if @id.nil?
204
+ return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/)
205
+ return false if !@campaign_id.nil? && @campaign_id !~ Regexp.new(/[A-Z0-9]{4,20}/)
206
+ return false if @created_at.nil?
207
+ return false if @status.nil?
208
+ status_validator = EnumAttributeValidator.new('String', ["CANCELED", "CART", "EXECUTED", "FAILED", "PENDING APPROVAL", "PENDING INTERNAL PAYMENT APPROVAL"])
209
+ return false unless status_validator.valid?(@status)
210
+ channel_validator = EnumAttributeValidator.new('String', ["UI", "API", "EMBED", "DECIPHER", "QUALTRICS", "TYPEFORM", "SURVEY MONKEY"])
211
+ return false unless channel_validator.valid?(@channel)
212
+ true
213
+ end
214
+
215
+ # Custom attribute writer method with validation
216
+ # @param [Object] id Value to be assigned
217
+ def id=(id)
218
+ if id.nil?
219
+ fail ArgumentError, 'id cannot be nil'
220
+ end
221
+
222
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
223
+ if id !~ pattern
224
+ fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
225
+ end
226
+
227
+ @id = id
228
+ end
229
+
230
+ # Custom attribute writer method with validation
231
+ # @param [Object] campaign_id Value to be assigned
232
+ def campaign_id=(campaign_id)
233
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
234
+ if !campaign_id.nil? && campaign_id !~ pattern
235
+ fail ArgumentError, "invalid value for \"campaign_id\", must conform to the pattern #{pattern}."
236
+ end
237
+
238
+ @campaign_id = campaign_id
239
+ end
240
+
241
+ # Custom attribute writer method checking allowed values (enum).
242
+ # @param [Object] status Object to be assigned
243
+ def status=(status)
244
+ validator = EnumAttributeValidator.new('String', ["CANCELED", "CART", "EXECUTED", "FAILED", "PENDING APPROVAL", "PENDING INTERNAL PAYMENT APPROVAL"])
245
+ unless validator.valid?(status)
246
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
247
+ end
248
+ @status = status
249
+ end
250
+
251
+ # Custom attribute writer method checking allowed values (enum).
252
+ # @param [Object] channel Object to be assigned
253
+ def channel=(channel)
254
+ validator = EnumAttributeValidator.new('String', ["UI", "API", "EMBED", "DECIPHER", "QUALTRICS", "TYPEFORM", "SURVEY MONKEY"])
255
+ unless validator.valid?(channel)
256
+ fail ArgumentError, "invalid value for \"channel\", must be one of #{validator.allowable_values}."
257
+ end
258
+ @channel = channel
259
+ end
260
+
261
+ # Checks equality by comparing each attribute.
262
+ # @param [Object] Object to be compared
263
+ def ==(o)
264
+ return true if self.equal?(o)
265
+ self.class == o.class &&
266
+ id == o.id &&
267
+ external_id == o.external_id &&
268
+ campaign_id == o.campaign_id &&
269
+ created_at == o.created_at &&
270
+ status == o.status &&
271
+ channel == o.channel &&
272
+ payment == o.payment &&
273
+ invoice_id == o.invoice_id &&
274
+ rewards == o.rewards
275
+ end
276
+
277
+ # @see the `==` method
278
+ # @param [Object] Object to be compared
279
+ def eql?(o)
280
+ self == o
281
+ end
282
+
283
+ # Calculates hash code according to all attributes.
284
+ # @return [Integer] Hash code
285
+ def hash
286
+ [id, external_id, campaign_id, created_at, status, channel, payment, invoice_id, rewards].hash
287
+ end
288
+
289
+ # Builds the object from hash
290
+ # @param [Hash] attributes Model attributes in the form of hash
291
+ # @return [Object] Returns the model itself
292
+ def self.build_from_hash(attributes)
293
+ return nil unless attributes.is_a?(Hash)
294
+ attributes = attributes.transform_keys(&:to_sym)
295
+ transformed_hash = {}
296
+ openapi_types.each_pair do |key, type|
297
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
298
+ transformed_hash["#{key}"] = nil
299
+ elsif type =~ /\AArray<(.*)>/i
300
+ # check to ensure the input is an array given that the attribute
301
+ # is documented as an array but the input is not
302
+ if attributes[attribute_map[key]].is_a?(Array)
303
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
304
+ end
305
+ elsif !attributes[attribute_map[key]].nil?
306
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
307
+ end
308
+ end
309
+ new(transformed_hash)
310
+ end
311
+
312
+ # Deserializes the data based on type
313
+ # @param string type Data type
314
+ # @param string value Value to be deserialized
315
+ # @return [Object] Deserialized data
316
+ def self._deserialize(type, value)
317
+ case type.to_sym
318
+ when :Time
319
+ Time.parse(value)
320
+ when :Date
321
+ Date.parse(value)
322
+ when :String
323
+ value.to_s
324
+ when :Integer
325
+ value.to_i
326
+ when :Float
327
+ value.to_f
328
+ when :Boolean
329
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
330
+ true
331
+ else
332
+ false
333
+ end
334
+ when :Object
335
+ # generic object (usually a Hash), return directly
336
+ value
337
+ when /\AArray<(?<inner_type>.+)>\z/
338
+ inner_type = Regexp.last_match[:inner_type]
339
+ value.map { |v| _deserialize(inner_type, v) }
340
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
341
+ k_type = Regexp.last_match[:k_type]
342
+ v_type = Regexp.last_match[:v_type]
343
+ {}.tap do |hash|
344
+ value.each do |k, v|
345
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
346
+ end
347
+ end
348
+ else # model
349
+ # models (e.g. Pet) or oneOf
350
+ klass = Tremendous.const_get(type)
351
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
352
+ end
353
+ end
354
+
355
+ # Returns the string representation of the object
356
+ # @return [String] String presentation of the object
357
+ def to_s
358
+ to_hash.to_s
359
+ end
360
+
361
+ # to_body is an alias to to_hash (backward compatibility)
362
+ # @return [Hash] Returns the object in the form of hash
363
+ def to_body
364
+ to_hash
365
+ end
366
+
367
+ # Returns the object in the form of hash
368
+ # @return [Hash] Returns the object in the form of hash
369
+ def to_hash
370
+ hash = {}
371
+ self.class.attribute_map.each_pair do |attr, param|
372
+ value = self.send(attr)
373
+ if value.nil?
374
+ is_nullable = self.class.openapi_nullable.include?(attr)
375
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
376
+ end
377
+
378
+ hash[param] = _to_hash(value)
379
+ end
380
+ hash
381
+ end
382
+
383
+ # Outputs non-array value in the form of hash
384
+ # For object, use to_hash. Otherwise, just return the value
385
+ # @param [Object] value Any valid value
386
+ # @return [Hash] Returns the value in the form of hash
387
+ def _to_hash(value)
388
+ if value.is_a?(Array)
389
+ value.compact.map { |v| _to_hash(v) }
390
+ elsif value.is_a?(Hash)
391
+ {}.tap do |hash|
392
+ value.each { |k, v| hash[k] = _to_hash(v) }
393
+ end
394
+ elsif value.respond_to? :to_hash
395
+ value.to_hash
396
+ else
397
+ value
398
+ end
399
+ end
400
+
401
+ end
402
+
403
+ end