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,292 @@
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
+ class CreateTopupRequest
18
+ # The ID of the funding source to top up.
19
+ attr_accessor :funding_source_id
20
+
21
+ # Unique key that ensures this request is only processed once.
22
+ attr_accessor :idempotency_key
23
+
24
+ # Amount in USD intended to be added to your organization’s balance.
25
+ attr_accessor :amount
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'funding_source_id' => :'funding_source_id',
31
+ :'idempotency_key' => :'idempotency_key',
32
+ :'amount' => :'amount'
33
+ }
34
+ end
35
+
36
+ # Returns attribute mapping this model knows about
37
+ def self.acceptable_attribute_map
38
+ attribute_map
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ acceptable_attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'funding_source_id' => :'String',
50
+ :'idempotency_key' => :'String',
51
+ :'amount' => :'Float'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::CreateTopupRequest` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ acceptable_attribute_map = self.class.acceptable_attribute_map
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!acceptable_attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::CreateTopupRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'funding_source_id')
78
+ self.funding_source_id = attributes[:'funding_source_id']
79
+ else
80
+ self.funding_source_id = nil
81
+ end
82
+
83
+ if attributes.key?(:'idempotency_key')
84
+ self.idempotency_key = attributes[:'idempotency_key']
85
+ else
86
+ self.idempotency_key = nil
87
+ end
88
+
89
+ if attributes.key?(:'amount')
90
+ self.amount = attributes[:'amount']
91
+ else
92
+ self.amount = nil
93
+ end
94
+ end
95
+
96
+ # Show invalid properties with the reasons. Usually used together with valid?
97
+ # @return Array for valid properties with the reasons
98
+ def list_invalid_properties
99
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
100
+ invalid_properties = Array.new
101
+ if @funding_source_id.nil?
102
+ invalid_properties.push('invalid value for "funding_source_id", funding_source_id cannot be nil.')
103
+ end
104
+
105
+ if @idempotency_key.nil?
106
+ invalid_properties.push('invalid value for "idempotency_key", idempotency_key cannot be nil.')
107
+ end
108
+
109
+ if @amount.nil?
110
+ invalid_properties.push('invalid value for "amount", amount cannot be nil.')
111
+ end
112
+
113
+ invalid_properties
114
+ end
115
+
116
+ # Check to see if the all the properties in the model are valid
117
+ # @return true if the model is valid
118
+ def valid?
119
+ warn '[DEPRECATED] the `valid?` method is obsolete'
120
+ return false if @funding_source_id.nil?
121
+ return false if @idempotency_key.nil?
122
+ return false if @amount.nil?
123
+ true
124
+ end
125
+
126
+ # Custom attribute writer method with validation
127
+ # @param [Object] funding_source_id Value to be assigned
128
+ def funding_source_id=(funding_source_id)
129
+ if funding_source_id.nil?
130
+ fail ArgumentError, 'funding_source_id cannot be nil'
131
+ end
132
+
133
+ @funding_source_id = funding_source_id
134
+ end
135
+
136
+ # Custom attribute writer method with validation
137
+ # @param [Object] idempotency_key Value to be assigned
138
+ def idempotency_key=(idempotency_key)
139
+ if idempotency_key.nil?
140
+ fail ArgumentError, 'idempotency_key cannot be nil'
141
+ end
142
+
143
+ @idempotency_key = idempotency_key
144
+ end
145
+
146
+ # Custom attribute writer method with validation
147
+ # @param [Object] amount Value to be assigned
148
+ def amount=(amount)
149
+ if amount.nil?
150
+ fail ArgumentError, 'amount cannot be nil'
151
+ end
152
+
153
+ @amount = amount
154
+ end
155
+
156
+ # Checks equality by comparing each attribute.
157
+ # @param [Object] Object to be compared
158
+ def ==(o)
159
+ return true if self.equal?(o)
160
+ self.class == o.class &&
161
+ funding_source_id == o.funding_source_id &&
162
+ idempotency_key == o.idempotency_key &&
163
+ amount == o.amount
164
+ end
165
+
166
+ # @see the `==` method
167
+ # @param [Object] Object to be compared
168
+ def eql?(o)
169
+ self == o
170
+ end
171
+
172
+ # Calculates hash code according to all attributes.
173
+ # @return [Integer] Hash code
174
+ def hash
175
+ [funding_source_id, idempotency_key, amount].hash
176
+ end
177
+
178
+ # Builds the object from hash
179
+ # @param [Hash] attributes Model attributes in the form of hash
180
+ # @return [Object] Returns the model itself
181
+ def self.build_from_hash(attributes)
182
+ return nil unless attributes.is_a?(Hash)
183
+ attributes = attributes.transform_keys(&:to_sym)
184
+ transformed_hash = {}
185
+ openapi_types.each_pair do |key, type|
186
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
187
+ transformed_hash["#{key}"] = nil
188
+ elsif type =~ /\AArray<(.*)>/i
189
+ # check to ensure the input is an array given that the attribute
190
+ # is documented as an array but the input is not
191
+ if attributes[attribute_map[key]].is_a?(Array)
192
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
193
+ end
194
+ elsif !attributes[attribute_map[key]].nil?
195
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
196
+ end
197
+ end
198
+ new(transformed_hash)
199
+ end
200
+
201
+ # Deserializes the data based on type
202
+ # @param string type Data type
203
+ # @param string value Value to be deserialized
204
+ # @return [Object] Deserialized data
205
+ def self._deserialize(type, value)
206
+ case type.to_sym
207
+ when :Time
208
+ Time.parse(value)
209
+ when :Date
210
+ Date.parse(value)
211
+ when :String
212
+ value.to_s
213
+ when :Integer
214
+ value.to_i
215
+ when :Float
216
+ value.to_f
217
+ when :Boolean
218
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
219
+ true
220
+ else
221
+ false
222
+ end
223
+ when :Object
224
+ # generic object (usually a Hash), return directly
225
+ value
226
+ when /\AArray<(?<inner_type>.+)>\z/
227
+ inner_type = Regexp.last_match[:inner_type]
228
+ value.map { |v| _deserialize(inner_type, v) }
229
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
230
+ k_type = Regexp.last_match[:k_type]
231
+ v_type = Regexp.last_match[:v_type]
232
+ {}.tap do |hash|
233
+ value.each do |k, v|
234
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
235
+ end
236
+ end
237
+ else # model
238
+ # models (e.g. Pet) or oneOf
239
+ klass = Tremendous.const_get(type)
240
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
241
+ end
242
+ end
243
+
244
+ # Returns the string representation of the object
245
+ # @return [String] String presentation of the object
246
+ def to_s
247
+ to_hash.to_s
248
+ end
249
+
250
+ # to_body is an alias to to_hash (backward compatibility)
251
+ # @return [Hash] Returns the object in the form of hash
252
+ def to_body
253
+ to_hash
254
+ end
255
+
256
+ # Returns the object in the form of hash
257
+ # @return [Hash] Returns the object in the form of hash
258
+ def to_hash
259
+ hash = {}
260
+ self.class.attribute_map.each_pair do |attr, param|
261
+ value = self.send(attr)
262
+ if value.nil?
263
+ is_nullable = self.class.openapi_nullable.include?(attr)
264
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
265
+ end
266
+
267
+ hash[param] = _to_hash(value)
268
+ end
269
+ hash
270
+ end
271
+
272
+ # Outputs non-array value in the form of hash
273
+ # For object, use to_hash. Otherwise, just return the value
274
+ # @param [Object] value Any valid value
275
+ # @return [Hash] Returns the value in the form of hash
276
+ def _to_hash(value)
277
+ if value.is_a?(Array)
278
+ value.compact.map { |v| _to_hash(v) }
279
+ elsif value.is_a?(Hash)
280
+ {}.tap do |hash|
281
+ value.each { |k, v| hash[k] = _to_hash(v) }
282
+ end
283
+ elsif value.respond_to? :to_hash
284
+ value.to_hash
285
+ else
286
+ value
287
+ end
288
+ end
289
+
290
+ end
291
+
292
+ end
@@ -19,20 +19,9 @@ module Tremendous
19
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
20
  attr_accessor :status
21
21
 
22
- # The fraud risk associated with the reward.
23
- attr_accessor :risk
24
-
25
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`
26
23
  attr_accessor :reasons
27
24
 
28
- # 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`.
29
- attr_accessor :reviewed_by
30
-
31
- # When the reward was blocked or released following fraud review. This field is only present if the status is not `flagged`.
32
- attr_accessor :reviewed_at
33
-
34
- attr_accessor :related_rewards
35
-
36
25
  # The device fingerprint, if known.
37
26
  attr_accessor :device_id
38
27
 
@@ -46,6 +35,20 @@ module Tremendous
46
35
 
47
36
  attr_accessor :reward
48
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
+ # The fraud risk associated with the reward.
48
+ attr_accessor :risk
49
+
50
+ attr_accessor :related_rewards
51
+
49
52
  class EnumAttributeValidator
50
53
  attr_reader :datatype
51
54
  attr_reader :allowable_values
@@ -72,16 +75,17 @@ module Tremendous
72
75
  def self.attribute_map
73
76
  {
74
77
  :'status' => :'status',
75
- :'risk' => :'risk',
76
78
  :'reasons' => :'reasons',
77
- :'reviewed_by' => :'reviewed_by',
78
- :'reviewed_at' => :'reviewed_at',
79
- :'related_rewards' => :'related_rewards',
80
79
  :'device_id' => :'device_id',
81
80
  :'redemption_method' => :'redemption_method',
82
81
  :'redeemed_at' => :'redeemed_at',
83
82
  :'geo' => :'geo',
84
- :'reward' => :'reward'
83
+ :'reward' => :'reward',
84
+ :'reviewed_by' => :'reviewed_by',
85
+ :'reviewed_at' => :'reviewed_at',
86
+ :'redemption_method_account_hash' => :'redemption_method_account_hash',
87
+ :'risk' => :'risk',
88
+ :'related_rewards' => :'related_rewards'
85
89
  }
86
90
  end
87
91
 
@@ -99,16 +103,17 @@ module Tremendous
99
103
  def self.openapi_types
100
104
  {
101
105
  :'status' => :'String',
102
- :'risk' => :'String',
103
106
  :'reasons' => :'Array<String>',
104
- :'reviewed_by' => :'String',
105
- :'reviewed_at' => :'Time',
106
- :'related_rewards' => :'GetFraudReview200ResponseFraudReviewRelatedRewards',
107
107
  :'device_id' => :'String',
108
108
  :'redemption_method' => :'String',
109
109
  :'redeemed_at' => :'Time',
110
- :'geo' => :'GetFraudReview200ResponseFraudReviewGeo',
111
- :'reward' => :'OrderWithoutLinkRewardsInner'
110
+ :'geo' => :'ListFraudReviews200ResponseFraudReviewsInnerGeo',
111
+ :'reward' => :'OrderWithoutLinkRewardsInner',
112
+ :'reviewed_by' => :'String',
113
+ :'reviewed_at' => :'Time',
114
+ :'redemption_method_account_hash' => :'String',
115
+ :'risk' => :'String',
116
+ :'related_rewards' => :'GetFraudReview200ResponseFraudReviewRelatedRewards'
112
117
  }
113
118
  end
114
119
 
@@ -138,28 +143,12 @@ module Tremendous
138
143
  self.status = attributes[:'status']
139
144
  end
140
145
 
141
- if attributes.key?(:'risk')
142
- self.risk = attributes[:'risk']
143
- end
144
-
145
146
  if attributes.key?(:'reasons')
146
147
  if (value = attributes[:'reasons']).is_a?(Array)
147
148
  self.reasons = value
148
149
  end
149
150
  end
150
151
 
151
- if attributes.key?(:'reviewed_by')
152
- self.reviewed_by = attributes[:'reviewed_by']
153
- end
154
-
155
- if attributes.key?(:'reviewed_at')
156
- self.reviewed_at = attributes[:'reviewed_at']
157
- end
158
-
159
- if attributes.key?(:'related_rewards')
160
- self.related_rewards = attributes[:'related_rewards']
161
- end
162
-
163
152
  if attributes.key?(:'device_id')
164
153
  self.device_id = attributes[:'device_id']
165
154
  end
@@ -179,6 +168,26 @@ module Tremendous
179
168
  if attributes.key?(:'reward')
180
169
  self.reward = attributes[:'reward']
181
170
  end
171
+
172
+ if attributes.key?(:'reviewed_by')
173
+ self.reviewed_by = attributes[:'reviewed_by']
174
+ end
175
+
176
+ if attributes.key?(:'reviewed_at')
177
+ self.reviewed_at = attributes[:'reviewed_at']
178
+ end
179
+
180
+ if attributes.key?(:'redemption_method_account_hash')
181
+ self.redemption_method_account_hash = attributes[:'redemption_method_account_hash']
182
+ end
183
+
184
+ if attributes.key?(:'risk')
185
+ self.risk = attributes[:'risk']
186
+ end
187
+
188
+ if attributes.key?(:'related_rewards')
189
+ self.related_rewards = attributes[:'related_rewards']
190
+ end
182
191
  end
183
192
 
184
193
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -195,10 +204,10 @@ module Tremendous
195
204
  warn '[DEPRECATED] the `valid?` method is obsolete'
196
205
  status_validator = EnumAttributeValidator.new('String', ["flagged", "blocked", "released"])
197
206
  return false unless status_validator.valid?(@status)
207
+ redemption_method_validator = EnumAttributeValidator.new('String', ["bank transfer", "charity", "instant debit transfer", "international bank transfer", "merchant card", "paypal", "venmo", "visa card"])
208
+ return false unless redemption_method_validator.valid?(@redemption_method)
198
209
  risk_validator = EnumAttributeValidator.new('String', ["high", "medium", "low"])
199
210
  return false unless risk_validator.valid?(@risk)
200
- redemption_method_validator = EnumAttributeValidator.new('String', ["paypal", "bank", "merchant card", "visa card", "charity", "venmo"])
201
- return false unless redemption_method_validator.valid?(@redemption_method)
202
211
  true
203
212
  end
204
213
 
@@ -212,6 +221,16 @@ module Tremendous
212
221
  @status = status
213
222
  end
214
223
 
224
+ # Custom attribute writer method checking allowed values (enum).
225
+ # @param [Object] redemption_method Object to be assigned
226
+ def redemption_method=(redemption_method)
227
+ validator = EnumAttributeValidator.new('String', ["bank transfer", "charity", "instant debit transfer", "international bank transfer", "merchant card", "paypal", "venmo", "visa card"])
228
+ unless validator.valid?(redemption_method)
229
+ fail ArgumentError, "invalid value for \"redemption_method\", must be one of #{validator.allowable_values}."
230
+ end
231
+ @redemption_method = redemption_method
232
+ end
233
+
215
234
  # Custom attribute writer method checking allowed values (enum).
216
235
  # @param [Object] risk Object to be assigned
217
236
  def risk=(risk)
@@ -222,32 +241,23 @@ module Tremendous
222
241
  @risk = risk
223
242
  end
224
243
 
225
- # Custom attribute writer method checking allowed values (enum).
226
- # @param [Object] redemption_method Object to be assigned
227
- def redemption_method=(redemption_method)
228
- validator = EnumAttributeValidator.new('String', ["paypal", "bank", "merchant card", "visa card", "charity", "venmo"])
229
- unless validator.valid?(redemption_method)
230
- fail ArgumentError, "invalid value for \"redemption_method\", must be one of #{validator.allowable_values}."
231
- end
232
- @redemption_method = redemption_method
233
- end
234
-
235
244
  # Checks equality by comparing each attribute.
236
245
  # @param [Object] Object to be compared
237
246
  def ==(o)
238
247
  return true if self.equal?(o)
239
248
  self.class == o.class &&
240
249
  status == o.status &&
241
- risk == o.risk &&
242
250
  reasons == o.reasons &&
243
- reviewed_by == o.reviewed_by &&
244
- reviewed_at == o.reviewed_at &&
245
- related_rewards == o.related_rewards &&
246
251
  device_id == o.device_id &&
247
252
  redemption_method == o.redemption_method &&
248
253
  redeemed_at == o.redeemed_at &&
249
254
  geo == o.geo &&
250
- reward == o.reward
255
+ reward == o.reward &&
256
+ reviewed_by == o.reviewed_by &&
257
+ reviewed_at == o.reviewed_at &&
258
+ redemption_method_account_hash == o.redemption_method_account_hash &&
259
+ risk == o.risk &&
260
+ related_rewards == o.related_rewards
251
261
  end
252
262
 
253
263
  # @see the `==` method
@@ -259,7 +269,7 @@ module Tremendous
259
269
  # Calculates hash code according to all attributes.
260
270
  # @return [Integer] Hash code
261
271
  def hash
262
- [status, risk, reasons, reviewed_by, reviewed_at, related_rewards, device_id, redemption_method, redeemed_at, geo, reward].hash
272
+ [status, reasons, device_id, redemption_method, redeemed_at, geo, reward, reviewed_by, reviewed_at, redemption_method_account_hash, risk, related_rewards].hash
263
273
  end
264
274
 
265
275
  # Builds the object from hash