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,385 @@
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
+ # A single reward, sent to a recipient. A reward is always part of an order. Either `products` or `campaign_id` must be specified.
18
+ class OrderWithLinkRewardsInner
19
+ # Tremendous ID of the reward
20
+ attr_accessor :id
21
+
22
+ # Tremendous ID of the order this reward is part of.
23
+ attr_accessor :order_id
24
+
25
+ # Date the reward was created
26
+ attr_accessor :created_at
27
+
28
+ # ID of the campaign in your account, that defines the available products (different gift cards, charity, etc.) that the recipient can choose from.
29
+ attr_accessor :campaign_id
30
+
31
+ # List of IDs of product (different gift cards, charity, etc.) that will be available to the recipient to choose from. Providing a `products` array will override the products made available by the campaign specified using the `campaign_id` property unless the `products` array is empty. It will _not_ override other campaign attributes, like the message and customization of the look and feel.
32
+ attr_accessor :products
33
+
34
+ attr_accessor :value
35
+
36
+ attr_accessor :recipient
37
+
38
+ # Timestamp of reward delivery within the next year. Note that if date-time is provided, the time values will be ignored.
39
+ attr_accessor :deliver_at
40
+
41
+ attr_accessor :custom_fields
42
+
43
+ attr_accessor :delivery
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'id' => :'id',
49
+ :'order_id' => :'order_id',
50
+ :'created_at' => :'created_at',
51
+ :'campaign_id' => :'campaign_id',
52
+ :'products' => :'products',
53
+ :'value' => :'value',
54
+ :'recipient' => :'recipient',
55
+ :'deliver_at' => :'deliver_at',
56
+ :'custom_fields' => :'custom_fields',
57
+ :'delivery' => :'delivery'
58
+ }
59
+ end
60
+
61
+ # Returns all the JSON keys this model knows about
62
+ def self.acceptable_attributes
63
+ attribute_map.values
64
+ end
65
+
66
+ # Attribute type mapping.
67
+ def self.openapi_types
68
+ {
69
+ :'id' => :'String',
70
+ :'order_id' => :'String',
71
+ :'created_at' => :'Time',
72
+ :'campaign_id' => :'String',
73
+ :'products' => :'Array<String>',
74
+ :'value' => :'ListRewards200ResponseRewardsInnerValue',
75
+ :'recipient' => :'ListRewards200ResponseRewardsInnerRecipient',
76
+ :'deliver_at' => :'Date',
77
+ :'custom_fields' => :'Array<RewardBaseCustomFieldsInner>',
78
+ :'delivery' => :'RewardWithLinkDelivery'
79
+ }
80
+ end
81
+
82
+ # List of attributes with nullable: true
83
+ def self.openapi_nullable
84
+ Set.new([
85
+ :'campaign_id',
86
+ ])
87
+ end
88
+
89
+ # Initializes the object
90
+ # @param [Hash] attributes Model attributes in the form of hash
91
+ def initialize(attributes = {})
92
+ if (!attributes.is_a?(Hash))
93
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::OrderWithLinkRewardsInner` initialize method"
94
+ end
95
+
96
+ # check to see if the attribute exists and convert string to symbol for hash key
97
+ attributes = attributes.each_with_object({}) { |(k, v), h|
98
+ if (!self.class.attribute_map.key?(k.to_sym))
99
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::OrderWithLinkRewardsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
100
+ end
101
+ h[k.to_sym] = v
102
+ }
103
+
104
+ if attributes.key?(:'id')
105
+ self.id = attributes[:'id']
106
+ end
107
+
108
+ if attributes.key?(:'order_id')
109
+ self.order_id = attributes[:'order_id']
110
+ end
111
+
112
+ if attributes.key?(:'created_at')
113
+ self.created_at = attributes[:'created_at']
114
+ end
115
+
116
+ if attributes.key?(:'campaign_id')
117
+ self.campaign_id = attributes[:'campaign_id']
118
+ end
119
+
120
+ if attributes.key?(:'products')
121
+ if (value = attributes[:'products']).is_a?(Array)
122
+ self.products = value
123
+ end
124
+ end
125
+
126
+ if attributes.key?(:'value')
127
+ self.value = attributes[:'value']
128
+ end
129
+
130
+ if attributes.key?(:'recipient')
131
+ self.recipient = attributes[:'recipient']
132
+ end
133
+
134
+ if attributes.key?(:'deliver_at')
135
+ self.deliver_at = attributes[:'deliver_at']
136
+ end
137
+
138
+ if attributes.key?(:'custom_fields')
139
+ if (value = attributes[:'custom_fields']).is_a?(Array)
140
+ self.custom_fields = value
141
+ end
142
+ end
143
+
144
+ if attributes.key?(:'delivery')
145
+ self.delivery = attributes[:'delivery']
146
+ end
147
+ end
148
+
149
+ # Show invalid properties with the reasons. Usually used together with valid?
150
+ # @return Array for valid properties with the reasons
151
+ def list_invalid_properties
152
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
153
+ invalid_properties = Array.new
154
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
155
+ if !@id.nil? && @id !~ pattern
156
+ invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
157
+ end
158
+
159
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
160
+ if !@order_id.nil? && @order_id !~ pattern
161
+ invalid_properties.push("invalid value for \"order_id\", must conform to the pattern #{pattern}.")
162
+ end
163
+
164
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
165
+ if !@campaign_id.nil? && @campaign_id !~ pattern
166
+ invalid_properties.push("invalid value for \"campaign_id\", must conform to the pattern #{pattern}.")
167
+ end
168
+
169
+ if !@products.nil? && @products.length < 1
170
+ invalid_properties.push('invalid value for "products", number of items must be greater than or equal to 1.')
171
+ end
172
+
173
+ invalid_properties
174
+ end
175
+
176
+ # Check to see if the all the properties in the model are valid
177
+ # @return true if the model is valid
178
+ def valid?
179
+ warn '[DEPRECATED] the `valid?` method is obsolete'
180
+ return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/)
181
+ return false if !@order_id.nil? && @order_id !~ Regexp.new(/[A-Z0-9]{4,20}/)
182
+ return false if !@campaign_id.nil? && @campaign_id !~ Regexp.new(/[A-Z0-9]{4,20}/)
183
+ return false if !@products.nil? && @products.length < 1
184
+ true
185
+ end
186
+
187
+ # Custom attribute writer method with validation
188
+ # @param [Object] id Value to be assigned
189
+ def id=(id)
190
+ if id.nil?
191
+ fail ArgumentError, 'id cannot be nil'
192
+ end
193
+
194
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
195
+ if id !~ pattern
196
+ fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
197
+ end
198
+
199
+ @id = id
200
+ end
201
+
202
+ # Custom attribute writer method with validation
203
+ # @param [Object] order_id Value to be assigned
204
+ def order_id=(order_id)
205
+ if order_id.nil?
206
+ fail ArgumentError, 'order_id cannot be nil'
207
+ end
208
+
209
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
210
+ if order_id !~ pattern
211
+ fail ArgumentError, "invalid value for \"order_id\", must conform to the pattern #{pattern}."
212
+ end
213
+
214
+ @order_id = order_id
215
+ end
216
+
217
+ # Custom attribute writer method with validation
218
+ # @param [Object] campaign_id Value to be assigned
219
+ def campaign_id=(campaign_id)
220
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
221
+ if !campaign_id.nil? && campaign_id !~ pattern
222
+ fail ArgumentError, "invalid value for \"campaign_id\", must conform to the pattern #{pattern}."
223
+ end
224
+
225
+ @campaign_id = campaign_id
226
+ end
227
+
228
+ # Custom attribute writer method with validation
229
+ # @param [Object] products Value to be assigned
230
+ def products=(products)
231
+ if products.nil?
232
+ fail ArgumentError, 'products cannot be nil'
233
+ end
234
+
235
+ if products.length < 1
236
+ fail ArgumentError, 'invalid value for "products", number of items must be greater than or equal to 1.'
237
+ end
238
+
239
+ @products = products
240
+ end
241
+
242
+ # Checks equality by comparing each attribute.
243
+ # @param [Object] Object to be compared
244
+ def ==(o)
245
+ return true if self.equal?(o)
246
+ self.class == o.class &&
247
+ id == o.id &&
248
+ order_id == o.order_id &&
249
+ created_at == o.created_at &&
250
+ campaign_id == o.campaign_id &&
251
+ products == o.products &&
252
+ value == o.value &&
253
+ recipient == o.recipient &&
254
+ deliver_at == o.deliver_at &&
255
+ custom_fields == o.custom_fields &&
256
+ delivery == o.delivery
257
+ end
258
+
259
+ # @see the `==` method
260
+ # @param [Object] Object to be compared
261
+ def eql?(o)
262
+ self == o
263
+ end
264
+
265
+ # Calculates hash code according to all attributes.
266
+ # @return [Integer] Hash code
267
+ def hash
268
+ [id, order_id, created_at, campaign_id, products, value, recipient, deliver_at, custom_fields, delivery].hash
269
+ end
270
+
271
+ # Builds the object from hash
272
+ # @param [Hash] attributes Model attributes in the form of hash
273
+ # @return [Object] Returns the model itself
274
+ def self.build_from_hash(attributes)
275
+ return nil unless attributes.is_a?(Hash)
276
+ attributes = attributes.transform_keys(&:to_sym)
277
+ transformed_hash = {}
278
+ openapi_types.each_pair do |key, type|
279
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
280
+ transformed_hash["#{key}"] = nil
281
+ elsif type =~ /\AArray<(.*)>/i
282
+ # check to ensure the input is an array given that the attribute
283
+ # is documented as an array but the input is not
284
+ if attributes[attribute_map[key]].is_a?(Array)
285
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
286
+ end
287
+ elsif !attributes[attribute_map[key]].nil?
288
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
289
+ end
290
+ end
291
+ new(transformed_hash)
292
+ end
293
+
294
+ # Deserializes the data based on type
295
+ # @param string type Data type
296
+ # @param string value Value to be deserialized
297
+ # @return [Object] Deserialized data
298
+ def self._deserialize(type, value)
299
+ case type.to_sym
300
+ when :Time
301
+ Time.parse(value)
302
+ when :Date
303
+ Date.parse(value)
304
+ when :String
305
+ value.to_s
306
+ when :Integer
307
+ value.to_i
308
+ when :Float
309
+ value.to_f
310
+ when :Boolean
311
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
312
+ true
313
+ else
314
+ false
315
+ end
316
+ when :Object
317
+ # generic object (usually a Hash), return directly
318
+ value
319
+ when /\AArray<(?<inner_type>.+)>\z/
320
+ inner_type = Regexp.last_match[:inner_type]
321
+ value.map { |v| _deserialize(inner_type, v) }
322
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
323
+ k_type = Regexp.last_match[:k_type]
324
+ v_type = Regexp.last_match[:v_type]
325
+ {}.tap do |hash|
326
+ value.each do |k, v|
327
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
328
+ end
329
+ end
330
+ else # model
331
+ # models (e.g. Pet) or oneOf
332
+ klass = Tremendous.const_get(type)
333
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
334
+ end
335
+ end
336
+
337
+ # Returns the string representation of the object
338
+ # @return [String] String presentation of the object
339
+ def to_s
340
+ to_hash.to_s
341
+ end
342
+
343
+ # to_body is an alias to to_hash (backward compatibility)
344
+ # @return [Hash] Returns the object in the form of hash
345
+ def to_body
346
+ to_hash
347
+ end
348
+
349
+ # Returns the object in the form of hash
350
+ # @return [Hash] Returns the object in the form of hash
351
+ def to_hash
352
+ hash = {}
353
+ self.class.attribute_map.each_pair do |attr, param|
354
+ value = self.send(attr)
355
+ if value.nil?
356
+ is_nullable = self.class.openapi_nullable.include?(attr)
357
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
358
+ end
359
+
360
+ hash[param] = _to_hash(value)
361
+ end
362
+ hash
363
+ end
364
+
365
+ # Outputs non-array value in the form of hash
366
+ # For object, use to_hash. Otherwise, just return the value
367
+ # @param [Object] value Any valid value
368
+ # @return [Hash] Returns the value in the form of hash
369
+ def _to_hash(value)
370
+ if value.is_a?(Array)
371
+ value.compact.map { |v| _to_hash(v) }
372
+ elsif value.is_a?(Hash)
373
+ {}.tap do |hash|
374
+ value.each { |k, v| hash[k] = _to_hash(v) }
375
+ end
376
+ elsif value.respond_to? :to_hash
377
+ value.to_hash
378
+ else
379
+ value
380
+ end
381
+ end
382
+
383
+ end
384
+
385
+ end
@@ -26,39 +26,13 @@ module Tremendous
26
26
 
27
27
  attr_accessor :refund
28
28
 
29
- # Name of the channel in which the order was created
30
- attr_accessor :channel
31
-
32
- class EnumAttributeValidator
33
- attr_reader :datatype
34
- attr_reader :allowable_values
35
-
36
- def initialize(datatype, allowable_values)
37
- @allowable_values = allowable_values.map do |value|
38
- case datatype.to_s
39
- when /Integer/i
40
- value.to_i
41
- when /Float/i
42
- value.to_f
43
- else
44
- value
45
- end
46
- end
47
- end
48
-
49
- def valid?(value)
50
- !value || allowable_values.include?(value)
51
- end
52
- end
53
-
54
29
  # Attribute mapping from ruby-style variable name to JSON key.
55
30
  def self.attribute_map
56
31
  {
57
32
  :'subtotal' => :'subtotal',
58
33
  :'total' => :'total',
59
34
  :'fees' => :'fees',
60
- :'refund' => :'refund',
61
- :'channel' => :'channel'
35
+ :'refund' => :'refund'
62
36
  }
63
37
  end
64
38
 
@@ -73,8 +47,7 @@ module Tremendous
73
47
  :'subtotal' => :'Float',
74
48
  :'total' => :'Float',
75
49
  :'fees' => :'Float',
76
- :'refund' => :'PaymentDetailsRefund',
77
- :'channel' => :'String'
50
+ :'refund' => :'PaymentDetailsRefund'
78
51
  }
79
52
  end
80
53
 
@@ -114,10 +87,6 @@ module Tremendous
114
87
  if attributes.key?(:'refund')
115
88
  self.refund = attributes[:'refund']
116
89
  end
117
-
118
- if attributes.key?(:'channel')
119
- self.channel = attributes[:'channel']
120
- end
121
90
  end
122
91
 
123
92
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -147,8 +116,6 @@ module Tremendous
147
116
  return false if !@subtotal.nil? && @subtotal < 0
148
117
  return false if !@total.nil? && @total < 0
149
118
  return false if !@fees.nil? && @fees < 0
150
- channel_validator = EnumAttributeValidator.new('String', ["UI", "API", "EMBED", "DECIPHER", "QUALTRICS", "TYPEFORM", "SURVEY MONKEY"])
151
- return false unless channel_validator.valid?(@channel)
152
119
  true
153
120
  end
154
121
 
@@ -194,16 +161,6 @@ module Tremendous
194
161
  @fees = fees
195
162
  end
196
163
 
197
- # Custom attribute writer method checking allowed values (enum).
198
- # @param [Object] channel Object to be assigned
199
- def channel=(channel)
200
- validator = EnumAttributeValidator.new('String', ["UI", "API", "EMBED", "DECIPHER", "QUALTRICS", "TYPEFORM", "SURVEY MONKEY"])
201
- unless validator.valid?(channel)
202
- fail ArgumentError, "invalid value for \"channel\", must be one of #{validator.allowable_values}."
203
- end
204
- @channel = channel
205
- end
206
-
207
164
  # Checks equality by comparing each attribute.
208
165
  # @param [Object] Object to be compared
209
166
  def ==(o)
@@ -212,8 +169,7 @@ module Tremendous
212
169
  subtotal == o.subtotal &&
213
170
  total == o.total &&
214
171
  fees == o.fees &&
215
- refund == o.refund &&
216
- channel == o.channel
172
+ refund == o.refund
217
173
  end
218
174
 
219
175
  # @see the `==` method
@@ -225,7 +181,7 @@ module Tremendous
225
181
  # Calculates hash code according to all attributes.
226
182
  # @return [Integer] Hash code
227
183
  def hash
228
- [subtotal, total, fees, refund, channel].hash
184
+ [subtotal, total, fees, refund].hash
229
185
  end
230
186
 
231
187
  # Builds the object from hash