tremendous_ruby 5.13.0 → 5.14.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.
@@ -0,0 +1,358 @@
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 its 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.12.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Tremendous
17
+ # The fraud review associated with a reward.
18
+ class FraudReviewBase
19
+ # The current status of the fraud review: * `flagged` - The reward has been flagged for and waiting manual review. * `blocked` - The reward was reviewed and blocked. * `released` - The reward was reviewed and released.
20
+ attr_accessor :status
21
+
22
+ # The array may contain multiple reasons, depending on which rule(s) flagged the reward for review. Reasons can be any of the following: * `Disallowed IP` * `Disallowed email` * `Disallowed country` * `Over reward dollar limit` * `Over reward count limit` * `VPN detected` * `Device related to multiple emails` * `Device or account related to multiple emails` * `IP on a Tremendous fraud list` * `Bank account on a Tremendous fraud list` * `Fingerprint on a Tremendous fraud list` * `Email on a Tremendous fraud list` * `Phone on a Tremendous fraud list` * `IP related to a blocked reward` * `Device related to a blocked reward` * `Bank account related to a blocked reward` * `Fingerprint related to a blocked reward` * `Email related to a blocked reward` * `Phone related to a blocked reward` * `Allowed IP` * `Allowed email`
23
+ attr_accessor :reasons
24
+
25
+ # The device fingerprint, if known.
26
+ attr_accessor :device_id
27
+
28
+ # The product selected to claim the reward
29
+ attr_accessor :redemption_method
30
+
31
+ # Date the reward was redeemed
32
+ attr_accessor :redeemed_at
33
+
34
+ attr_accessor :geo
35
+
36
+ attr_accessor :reward
37
+
38
+ # The name of the person who reviewed the reward, or `Automatic Review` if the reward was blocked automatically. Rewards can be automatically blocked if they remain in the flagged fraud queue for more than 30 days. This field is only present if the status is not `flagged`.
39
+ attr_accessor :reviewed_by
40
+
41
+ # When the reward was blocked or released following fraud review. This field is only present if the status is not `flagged`.
42
+ attr_accessor :reviewed_at
43
+
44
+ # A hash of the destination account for redemption methods that require providing 3rd party account details (e.g., PayPal, Venmo, ACH/CashApp, international bank transfers, etc.). The hash is globally unique by redemption method + account combination. This field is omitted for redemption methods that don't have a destination account (e.g., merchant cards, charities, etc.).
45
+ attr_accessor :redemption_method_account_hash
46
+
47
+ class EnumAttributeValidator
48
+ attr_reader :datatype
49
+ attr_reader :allowable_values
50
+
51
+ def initialize(datatype, allowable_values)
52
+ @allowable_values = allowable_values.map do |value|
53
+ case datatype.to_s
54
+ when /Integer/i
55
+ value.to_i
56
+ when /Float/i
57
+ value.to_f
58
+ else
59
+ value
60
+ end
61
+ end
62
+ end
63
+
64
+ def valid?(value)
65
+ !value || allowable_values.include?(value)
66
+ end
67
+ end
68
+
69
+ # Attribute mapping from ruby-style variable name to JSON key.
70
+ def self.attribute_map
71
+ {
72
+ :'status' => :'status',
73
+ :'reasons' => :'reasons',
74
+ :'device_id' => :'device_id',
75
+ :'redemption_method' => :'redemption_method',
76
+ :'redeemed_at' => :'redeemed_at',
77
+ :'geo' => :'geo',
78
+ :'reward' => :'reward',
79
+ :'reviewed_by' => :'reviewed_by',
80
+ :'reviewed_at' => :'reviewed_at',
81
+ :'redemption_method_account_hash' => :'redemption_method_account_hash'
82
+ }
83
+ end
84
+
85
+ # Returns attribute mapping this model knows about
86
+ def self.acceptable_attribute_map
87
+ attribute_map
88
+ end
89
+
90
+ # Returns all the JSON keys this model knows about
91
+ def self.acceptable_attributes
92
+ acceptable_attribute_map.values
93
+ end
94
+
95
+ # Attribute type mapping.
96
+ def self.openapi_types
97
+ {
98
+ :'status' => :'String',
99
+ :'reasons' => :'Array<String>',
100
+ :'device_id' => :'String',
101
+ :'redemption_method' => :'String',
102
+ :'redeemed_at' => :'Time',
103
+ :'geo' => :'ListFraudReviews200ResponseFraudReviewsInnerGeo',
104
+ :'reward' => :'OrderWithoutLinkRewardsInner',
105
+ :'reviewed_by' => :'String',
106
+ :'reviewed_at' => :'Time',
107
+ :'redemption_method_account_hash' => :'String'
108
+ }
109
+ end
110
+
111
+ # List of attributes with nullable: true
112
+ def self.openapi_nullable
113
+ Set.new([
114
+ ])
115
+ end
116
+
117
+ # Initializes the object
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ def initialize(attributes = {})
120
+ if (!attributes.is_a?(Hash))
121
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::FraudReviewBase` initialize method"
122
+ end
123
+
124
+ # check to see if the attribute exists and convert string to symbol for hash key
125
+ acceptable_attribute_map = self.class.acceptable_attribute_map
126
+ attributes = attributes.each_with_object({}) { |(k, v), h|
127
+ if (!acceptable_attribute_map.key?(k.to_sym))
128
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::FraudReviewBase`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
129
+ end
130
+ h[k.to_sym] = v
131
+ }
132
+
133
+ if attributes.key?(:'status')
134
+ self.status = attributes[:'status']
135
+ end
136
+
137
+ if attributes.key?(:'reasons')
138
+ if (value = attributes[:'reasons']).is_a?(Array)
139
+ self.reasons = value
140
+ end
141
+ end
142
+
143
+ if attributes.key?(:'device_id')
144
+ self.device_id = attributes[:'device_id']
145
+ end
146
+
147
+ if attributes.key?(:'redemption_method')
148
+ self.redemption_method = attributes[:'redemption_method']
149
+ end
150
+
151
+ if attributes.key?(:'redeemed_at')
152
+ self.redeemed_at = attributes[:'redeemed_at']
153
+ end
154
+
155
+ if attributes.key?(:'geo')
156
+ self.geo = attributes[:'geo']
157
+ end
158
+
159
+ if attributes.key?(:'reward')
160
+ self.reward = attributes[:'reward']
161
+ end
162
+
163
+ if attributes.key?(:'reviewed_by')
164
+ self.reviewed_by = attributes[:'reviewed_by']
165
+ end
166
+
167
+ if attributes.key?(:'reviewed_at')
168
+ self.reviewed_at = attributes[:'reviewed_at']
169
+ end
170
+
171
+ if attributes.key?(:'redemption_method_account_hash')
172
+ self.redemption_method_account_hash = attributes[:'redemption_method_account_hash']
173
+ end
174
+ end
175
+
176
+ # Show invalid properties with the reasons. Usually used together with valid?
177
+ # @return Array for valid properties with the reasons
178
+ def list_invalid_properties
179
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
180
+ invalid_properties = Array.new
181
+ invalid_properties
182
+ end
183
+
184
+ # Check to see if the all the properties in the model are valid
185
+ # @return true if the model is valid
186
+ def valid?
187
+ warn '[DEPRECATED] the `valid?` method is obsolete'
188
+ status_validator = EnumAttributeValidator.new('String', ["flagged", "blocked", "released"])
189
+ return false unless status_validator.valid?(@status)
190
+ redemption_method_validator = EnumAttributeValidator.new('String', ["bank transfer", "charity", "instant debit transfer", "international bank transfer", "merchant card", "paypal", "venmo", "visa card"])
191
+ return false unless redemption_method_validator.valid?(@redemption_method)
192
+ true
193
+ end
194
+
195
+ # Custom attribute writer method checking allowed values (enum).
196
+ # @param [Object] status Object to be assigned
197
+ def status=(status)
198
+ validator = EnumAttributeValidator.new('String', ["flagged", "blocked", "released"])
199
+ unless validator.valid?(status)
200
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
201
+ end
202
+ @status = status
203
+ end
204
+
205
+ # Custom attribute writer method checking allowed values (enum).
206
+ # @param [Object] redemption_method Object to be assigned
207
+ def redemption_method=(redemption_method)
208
+ validator = EnumAttributeValidator.new('String', ["bank transfer", "charity", "instant debit transfer", "international bank transfer", "merchant card", "paypal", "venmo", "visa card"])
209
+ unless validator.valid?(redemption_method)
210
+ fail ArgumentError, "invalid value for \"redemption_method\", must be one of #{validator.allowable_values}."
211
+ end
212
+ @redemption_method = redemption_method
213
+ end
214
+
215
+ # Checks equality by comparing each attribute.
216
+ # @param [Object] Object to be compared
217
+ def ==(o)
218
+ return true if self.equal?(o)
219
+ self.class == o.class &&
220
+ status == o.status &&
221
+ reasons == o.reasons &&
222
+ device_id == o.device_id &&
223
+ redemption_method == o.redemption_method &&
224
+ redeemed_at == o.redeemed_at &&
225
+ geo == o.geo &&
226
+ reward == o.reward &&
227
+ reviewed_by == o.reviewed_by &&
228
+ reviewed_at == o.reviewed_at &&
229
+ redemption_method_account_hash == o.redemption_method_account_hash
230
+ end
231
+
232
+ # @see the `==` method
233
+ # @param [Object] Object to be compared
234
+ def eql?(o)
235
+ self == o
236
+ end
237
+
238
+ # Calculates hash code according to all attributes.
239
+ # @return [Integer] Hash code
240
+ def hash
241
+ [status, reasons, device_id, redemption_method, redeemed_at, geo, reward, reviewed_by, reviewed_at, redemption_method_account_hash].hash
242
+ end
243
+
244
+ # Builds the object from hash
245
+ # @param [Hash] attributes Model attributes in the form of hash
246
+ # @return [Object] Returns the model itself
247
+ def self.build_from_hash(attributes)
248
+ return nil unless attributes.is_a?(Hash)
249
+ attributes = attributes.transform_keys(&:to_sym)
250
+ transformed_hash = {}
251
+ openapi_types.each_pair do |key, type|
252
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
253
+ transformed_hash["#{key}"] = nil
254
+ elsif type =~ /\AArray<(.*)>/i
255
+ # check to ensure the input is an array given that the attribute
256
+ # is documented as an array but the input is not
257
+ if attributes[attribute_map[key]].is_a?(Array)
258
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
259
+ end
260
+ elsif !attributes[attribute_map[key]].nil?
261
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
262
+ end
263
+ end
264
+ new(transformed_hash)
265
+ end
266
+
267
+ # Deserializes the data based on type
268
+ # @param string type Data type
269
+ # @param string value Value to be deserialized
270
+ # @return [Object] Deserialized data
271
+ def self._deserialize(type, value)
272
+ case type.to_sym
273
+ when :Time
274
+ Time.parse(value)
275
+ when :Date
276
+ Date.parse(value)
277
+ when :String
278
+ value.to_s
279
+ when :Integer
280
+ value.to_i
281
+ when :Float
282
+ value.to_f
283
+ when :Boolean
284
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
285
+ true
286
+ else
287
+ false
288
+ end
289
+ when :Object
290
+ # generic object (usually a Hash), return directly
291
+ value
292
+ when /\AArray<(?<inner_type>.+)>\z/
293
+ inner_type = Regexp.last_match[:inner_type]
294
+ value.map { |v| _deserialize(inner_type, v) }
295
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
296
+ k_type = Regexp.last_match[:k_type]
297
+ v_type = Regexp.last_match[:v_type]
298
+ {}.tap do |hash|
299
+ value.each do |k, v|
300
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
301
+ end
302
+ end
303
+ else # model
304
+ # models (e.g. Pet) or oneOf
305
+ klass = Tremendous.const_get(type)
306
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
307
+ end
308
+ end
309
+
310
+ # Returns the string representation of the object
311
+ # @return [String] String presentation of the object
312
+ def to_s
313
+ to_hash.to_s
314
+ end
315
+
316
+ # to_body is an alias to to_hash (backward compatibility)
317
+ # @return [Hash] Returns the object in the form of hash
318
+ def to_body
319
+ to_hash
320
+ end
321
+
322
+ # Returns the object in the form of hash
323
+ # @return [Hash] Returns the object in the form of hash
324
+ def to_hash
325
+ hash = {}
326
+ self.class.attribute_map.each_pair do |attr, param|
327
+ value = self.send(attr)
328
+ if value.nil?
329
+ is_nullable = self.class.openapi_nullable.include?(attr)
330
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
331
+ end
332
+
333
+ hash[param] = _to_hash(value)
334
+ end
335
+ hash
336
+ end
337
+
338
+ # Outputs non-array value in the form of hash
339
+ # For object, use to_hash. Otherwise, just return the value
340
+ # @param [Object] value Any valid value
341
+ # @return [Hash] Returns the value in the form of hash
342
+ def _to_hash(value)
343
+ if value.is_a?(Array)
344
+ value.compact.map { |v| _to_hash(v) }
345
+ elsif value.is_a?(Hash)
346
+ {}.tap do |hash|
347
+ value.each { |k, v| hash[k] = _to_hash(v) }
348
+ end
349
+ elsif value.respond_to? :to_hash
350
+ value.to_hash
351
+ else
352
+ value
353
+ end
354
+ end
355
+
356
+ end
357
+
358
+ end
@@ -22,8 +22,28 @@ module Tremendous
22
22
  # The array may contain multiple reasons, depending on which rule(s) flagged the reward for review. Reasons can be any of the following: * `Disallowed IP` * `Disallowed email` * `Disallowed country` * `Over reward dollar limit` * `Over reward count limit` * `VPN detected` * `Device related to multiple emails` * `Device or account related to multiple emails` * `IP on a Tremendous fraud list` * `Bank account on a Tremendous fraud list` * `Fingerprint on a Tremendous fraud list` * `Email on a Tremendous fraud list` * `Phone on a Tremendous fraud list` * `IP related to a blocked reward` * `Device related to a blocked reward` * `Bank account related to a blocked reward` * `Fingerprint related to a blocked reward` * `Email related to a blocked reward` * `Phone related to a blocked reward` * `Allowed IP` * `Allowed email`
23
23
  attr_accessor :reasons
24
24
 
25
+ # The device fingerprint, if known.
26
+ attr_accessor :device_id
27
+
28
+ # The product selected to claim the reward
29
+ attr_accessor :redemption_method
30
+
31
+ # Date the reward was redeemed
32
+ attr_accessor :redeemed_at
33
+
34
+ attr_accessor :geo
35
+
25
36
  attr_accessor :reward
26
37
 
38
+ # The name of the person who reviewed the reward, or `Automatic Review` if the reward was blocked automatically. Rewards can be automatically blocked if they remain in the flagged fraud queue for more than 30 days. This field is only present if the status is not `flagged`.
39
+ attr_accessor :reviewed_by
40
+
41
+ # When the reward was blocked or released following fraud review. This field is only present if the status is not `flagged`.
42
+ attr_accessor :reviewed_at
43
+
44
+ # A hash of the destination account for redemption methods that require providing 3rd party account details (e.g., PayPal, Venmo, ACH/CashApp, international bank transfers, etc.). The hash is globally unique by redemption method + account combination. This field is omitted for redemption methods that don't have a destination account (e.g., merchant cards, charities, etc.).
45
+ attr_accessor :redemption_method_account_hash
46
+
27
47
  class EnumAttributeValidator
28
48
  attr_reader :datatype
29
49
  attr_reader :allowable_values
@@ -51,7 +71,14 @@ module Tremendous
51
71
  {
52
72
  :'status' => :'status',
53
73
  :'reasons' => :'reasons',
54
- :'reward' => :'reward'
74
+ :'device_id' => :'device_id',
75
+ :'redemption_method' => :'redemption_method',
76
+ :'redeemed_at' => :'redeemed_at',
77
+ :'geo' => :'geo',
78
+ :'reward' => :'reward',
79
+ :'reviewed_by' => :'reviewed_by',
80
+ :'reviewed_at' => :'reviewed_at',
81
+ :'redemption_method_account_hash' => :'redemption_method_account_hash'
55
82
  }
56
83
  end
57
84
 
@@ -70,7 +97,14 @@ module Tremendous
70
97
  {
71
98
  :'status' => :'String',
72
99
  :'reasons' => :'Array<String>',
73
- :'reward' => :'OrderWithoutLinkRewardsInner'
100
+ :'device_id' => :'String',
101
+ :'redemption_method' => :'String',
102
+ :'redeemed_at' => :'Time',
103
+ :'geo' => :'ListFraudReviews200ResponseFraudReviewsInnerGeo',
104
+ :'reward' => :'OrderWithoutLinkRewardsInner',
105
+ :'reviewed_by' => :'String',
106
+ :'reviewed_at' => :'Time',
107
+ :'redemption_method_account_hash' => :'String'
74
108
  }
75
109
  end
76
110
 
@@ -106,9 +140,37 @@ module Tremendous
106
140
  end
107
141
  end
108
142
 
143
+ if attributes.key?(:'device_id')
144
+ self.device_id = attributes[:'device_id']
145
+ end
146
+
147
+ if attributes.key?(:'redemption_method')
148
+ self.redemption_method = attributes[:'redemption_method']
149
+ end
150
+
151
+ if attributes.key?(:'redeemed_at')
152
+ self.redeemed_at = attributes[:'redeemed_at']
153
+ end
154
+
155
+ if attributes.key?(:'geo')
156
+ self.geo = attributes[:'geo']
157
+ end
158
+
109
159
  if attributes.key?(:'reward')
110
160
  self.reward = attributes[:'reward']
111
161
  end
162
+
163
+ if attributes.key?(:'reviewed_by')
164
+ self.reviewed_by = attributes[:'reviewed_by']
165
+ end
166
+
167
+ if attributes.key?(:'reviewed_at')
168
+ self.reviewed_at = attributes[:'reviewed_at']
169
+ end
170
+
171
+ if attributes.key?(:'redemption_method_account_hash')
172
+ self.redemption_method_account_hash = attributes[:'redemption_method_account_hash']
173
+ end
112
174
  end
113
175
 
114
176
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -125,6 +187,8 @@ module Tremendous
125
187
  warn '[DEPRECATED] the `valid?` method is obsolete'
126
188
  status_validator = EnumAttributeValidator.new('String', ["flagged", "blocked", "released"])
127
189
  return false unless status_validator.valid?(@status)
190
+ redemption_method_validator = EnumAttributeValidator.new('String', ["bank transfer", "charity", "instant debit transfer", "international bank transfer", "merchant card", "paypal", "venmo", "visa card"])
191
+ return false unless redemption_method_validator.valid?(@redemption_method)
128
192
  true
129
193
  end
130
194
 
@@ -138,6 +202,16 @@ module Tremendous
138
202
  @status = status
139
203
  end
140
204
 
205
+ # Custom attribute writer method checking allowed values (enum).
206
+ # @param [Object] redemption_method Object to be assigned
207
+ def redemption_method=(redemption_method)
208
+ validator = EnumAttributeValidator.new('String', ["bank transfer", "charity", "instant debit transfer", "international bank transfer", "merchant card", "paypal", "venmo", "visa card"])
209
+ unless validator.valid?(redemption_method)
210
+ fail ArgumentError, "invalid value for \"redemption_method\", must be one of #{validator.allowable_values}."
211
+ end
212
+ @redemption_method = redemption_method
213
+ end
214
+
141
215
  # Checks equality by comparing each attribute.
142
216
  # @param [Object] Object to be compared
143
217
  def ==(o)
@@ -145,7 +219,14 @@ module Tremendous
145
219
  self.class == o.class &&
146
220
  status == o.status &&
147
221
  reasons == o.reasons &&
148
- reward == o.reward
222
+ device_id == o.device_id &&
223
+ redemption_method == o.redemption_method &&
224
+ redeemed_at == o.redeemed_at &&
225
+ geo == o.geo &&
226
+ reward == o.reward &&
227
+ reviewed_by == o.reviewed_by &&
228
+ reviewed_at == o.reviewed_at &&
229
+ redemption_method_account_hash == o.redemption_method_account_hash
149
230
  end
150
231
 
151
232
  # @see the `==` method
@@ -157,7 +238,7 @@ module Tremendous
157
238
  # Calculates hash code according to all attributes.
158
239
  # @return [Integer] Hash code
159
240
  def hash
160
- [status, reasons, reward].hash
241
+ [status, reasons, device_id, redemption_method, redeemed_at, geo, reward, reviewed_by, reviewed_at, redemption_method_account_hash].hash
161
242
  end
162
243
 
163
244
  # Builds the object from hash
@@ -15,15 +15,17 @@ require 'time'
15
15
 
16
16
  module Tremendous
17
17
  class FraudReviewRedemptionMethod
18
- PAYPAL = "paypal".freeze
19
- BANK = "bank".freeze
20
- MERCHANT_CARD = "merchant card".freeze
21
- VISA_CARD = "visa card".freeze
18
+ BANK_TRANSFER = "bank transfer".freeze
22
19
  CHARITY = "charity".freeze
20
+ INSTANT_DEBIT_TRANSFER = "instant debit transfer".freeze
21
+ INTERNATIONAL_BANK_TRANSFER = "international bank transfer".freeze
22
+ MERCHANT_CARD = "merchant card".freeze
23
+ PAYPAL = "paypal".freeze
23
24
  VENMO = "venmo".freeze
25
+ VISA_CARD = "visa card".freeze
24
26
 
25
27
  def self.all_vars
26
- @all_vars ||= [PAYPAL, BANK, MERCHANT_CARD, VISA_CARD, CHARITY, VENMO].freeze
28
+ @all_vars ||= [BANK_TRANSFER, CHARITY, INSTANT_DEBIT_TRANSFER, INTERNATIONAL_BANK_TRANSFER, MERCHANT_CARD, PAYPAL, VENMO, VISA_CARD].freeze
27
29
  end
28
30
 
29
31
  # Builds the enum from string