tremendous_ruby 5.24.0 → 5.28.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 (89) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tremendous/api/tremendous_api.rb +163 -9
  3. data/lib/tremendous/api_client.rb +3 -2
  4. data/lib/tremendous/configuration.rb +10 -0
  5. data/lib/tremendous/models/campaign.rb +14 -6
  6. data/lib/tremendous/models/campaign_base.rb +14 -6
  7. data/lib/tremendous/models/connected_organization_member_member.rb +6 -4
  8. data/lib/tremendous/models/connected_organization_member_session.rb +27 -1
  9. data/lib/tremendous/models/connected_organization_organization.rb +3 -5
  10. data/lib/tremendous/models/{generate_reward_token200_response_reward.rb → create_api_key_request.rb} +51 -53
  11. data/lib/tremendous/models/create_campaign_request.rb +14 -6
  12. data/lib/tremendous/models/create_connected_organization_member_session200_response_connected_organization_member_session.rb +27 -1
  13. data/lib/tremendous/models/create_connected_organization_member_session_request.rb +33 -4
  14. data/lib/tremendous/models/create_connected_organization_request.rb +13 -4
  15. data/lib/tremendous/models/{create_report201_response_report.rb → create_connected_organization_request_kyb_prefill.rb} +102 -81
  16. data/lib/tremendous/models/create_field.rb +6 -4
  17. data/lib/tremendous/models/create_field_request.rb +6 -4
  18. data/lib/tremendous/models/create_invoice_request.rb +6 -10
  19. data/lib/tremendous/models/create_order200_response_order.rb +9 -9
  20. data/lib/tremendous/models/create_order200_response_order_rewards_inner_delivery.rb +13 -9
  21. data/lib/tremendous/models/create_report200_response_report.rb +3 -5
  22. data/lib/tremendous/models/create_report_request.rb +12 -8
  23. data/lib/tremendous/models/create_report_request_filters_digital_rewards.rb +6 -10
  24. data/lib/tremendous/models/delivery_details.rb +7 -11
  25. data/lib/tremendous/models/delivery_details_with_link.rb +13 -9
  26. data/lib/tremendous/models/field.rb +3 -5
  27. data/lib/tremendous/models/fraud_config_country.rb +6 -4
  28. data/lib/tremendous/models/fraud_config_redeemed_rewards_amount.rb +6 -4
  29. data/lib/tremendous/models/fraud_config_redeemed_rewards_count.rb +6 -4
  30. data/lib/tremendous/models/{create_campaign201_response.rb → fraud_config_review_vpn.rb} +21 -19
  31. data/lib/tremendous/models/fraud_review.rb +10 -16
  32. data/lib/tremendous/models/fraud_review_base.rb +7 -11
  33. data/lib/tremendous/models/fraud_review_list_item.rb +7 -11
  34. data/lib/tremendous/models/fraud_review_reason.rb +2 -1
  35. data/lib/tremendous/models/fraud_rule_request_config.rb +2 -1
  36. data/lib/tremendous/models/fraud_rules_list_item.rb +4 -6
  37. data/lib/tremendous/models/funding_source.rb +12 -14
  38. data/lib/tremendous/models/get_fraud_review200_response_fraud_review.rb +10 -16
  39. data/lib/tremendous/models/get_member200_response_member.rb +6 -4
  40. data/lib/tremendous/models/get_member200_response_member_events_inner.rb +3 -5
  41. data/lib/tremendous/models/invoice.rb +12 -14
  42. data/lib/tremendous/models/list_campaigns200_response_campaigns_inner.rb +14 -6
  43. data/lib/tremendous/models/list_campaigns200_response_campaigns_inner_auto_add_product_rule.rb +301 -0
  44. data/lib/tremendous/models/list_connected_organization_members200_response_connected_organization_members_inner_member.rb +6 -4
  45. data/lib/tremendous/models/list_connected_organizations200_response_connected_organizations_inner_organization.rb +3 -5
  46. data/lib/tremendous/models/list_fields200_response_fields_inner.rb +3 -5
  47. data/lib/tremendous/models/list_fraud_reviews200_response_fraud_reviews_inner.rb +7 -11
  48. data/lib/tremendous/models/list_fraud_rules200_response_fraud_rules_inner.rb +4 -6
  49. data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner.rb +12 -14
  50. data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb +6 -10
  51. data/lib/tremendous/models/list_invoices200_response_invoices_inner.rb +12 -14
  52. data/lib/tremendous/models/list_members200_response_members_inner.rb +6 -4
  53. data/lib/tremendous/models/list_orders200_response_orders_inner.rb +9 -9
  54. data/lib/tremendous/models/list_organizations200_response_organizations_inner.rb +3 -5
  55. data/lib/tremendous/models/list_products_response_products_inner.rb +11 -11
  56. data/lib/tremendous/models/list_products_response_products_inner_images_inner.rb +6 -4
  57. data/lib/tremendous/models/list_rewards200_response_rewards_inner_delivery.rb +7 -11
  58. data/lib/tremendous/models/list_rewards200_response_rewards_inner_value.rb +3 -5
  59. data/lib/tremendous/models/member.rb +6 -4
  60. data/lib/tremendous/models/member_base.rb +6 -4
  61. data/lib/tremendous/models/member_with_events.rb +6 -4
  62. data/lib/tremendous/models/member_without_events.rb +6 -4
  63. data/lib/tremendous/models/order.rb +9 -9
  64. data/lib/tremendous/models/order_base.rb +9 -9
  65. data/lib/tremendous/models/order_with_link.rb +9 -9
  66. data/lib/tremendous/models/order_without_link.rb +9 -9
  67. data/lib/tremendous/models/organization.rb +3 -5
  68. data/lib/tremendous/models/payout.rb +3 -5
  69. data/lib/tremendous/models/product.rb +11 -11
  70. data/lib/tremendous/models/report.rb +3 -5
  71. data/lib/tremendous/models/review_country.rb +6 -4
  72. data/lib/tremendous/models/review_redeemed_rewards_amount.rb +6 -4
  73. data/lib/tremendous/models/review_redeemed_rewards_count.rb +6 -4
  74. data/lib/tremendous/models/{generate_reward_token200_response.rb → review_vpn.rb} +22 -19
  75. data/lib/tremendous/models/reward_value.rb +3 -5
  76. data/lib/tremendous/models/reward_with_link_delivery.rb +13 -9
  77. data/lib/tremendous/models/reward_without_link_delivery.rb +7 -11
  78. data/lib/tremendous/models/single_reward_order_reward_delivery.rb +4 -6
  79. data/lib/tremendous/models/single_reward_order_with_link_order.rb +9 -9
  80. data/lib/tremendous/models/single_reward_order_without_link_order.rb +9 -9
  81. data/lib/tremendous/models/update_campaign.rb +14 -6
  82. data/lib/tremendous/models/update_campaign_request.rb +14 -6
  83. data/lib/tremendous/models/update_fraud_rule_list_request.rb +6 -4
  84. data/lib/tremendous/models/{get_fraud_review200_response_fraud_review_geo.rb → update_member.rb} +28 -32
  85. data/lib/tremendous/models/{create_report201_response.rb → update_member_request.rb} +34 -27
  86. data/lib/tremendous/version.rb +1 -1
  87. data/lib/tremendous.rb +7 -0
  88. metadata +22 -8
  89. data/lib/tremendous/models/create_order201_response.rb +0 -221
@@ -258,33 +258,31 @@ module Tremendous
258
258
  @amount = amount
259
259
  end
260
260
 
261
- # Custom attribute writer method checking allowed values (enum).
261
+ # Custom attribute writer method for enum attributes. Any value is accepted
262
+ # so that enum values added to the API don't break deserialization on
263
+ # older versions of this gem.
262
264
  # @param [Object] currency_code Object to be assigned
263
265
  def currency_code=(currency_code)
264
- validator = EnumAttributeValidator.new('String', ["USD", "EUR", "GBP"])
265
- unless validator.valid?(currency_code)
266
- fail ArgumentError, "invalid value for \"currency_code\", must be one of #{validator.allowable_values}."
267
- end
268
266
  @currency_code = currency_code
269
267
  end
270
268
 
271
- # Custom attribute writer method checking allowed values (enum).
269
+ # Custom attribute writer method for enum attributes. Any value is accepted
270
+ # so that enum values added to the API don't break deserialization on
271
+ # older versions of this gem.
272
272
  # @param [Object] currency Object to be assigned
273
273
  def currency=(currency)
274
- validator = EnumAttributeValidator.new('String', ["USD", "EUR", "GBP"])
275
- unless validator.valid?(currency)
276
- fail ArgumentError, "invalid value for \"currency\", must be one of #{validator.allowable_values}."
277
- end
278
274
  @currency = currency
279
275
  end
280
276
 
281
- # Custom attribute writer method checking allowed values (enum).
277
+ # Custom attribute writer method for enum attributes. Any value is accepted
278
+ # so that enum values added to the API don't break deserialization on
279
+ # older versions of this gem.
282
280
  # @param [Object] status Object to be assigned
283
281
  def status=(status)
284
- validator = EnumAttributeValidator.new('String', ["DELETED", "PAID", "OPEN", "MARKED_AS_PAID"])
285
- unless validator.valid?(status)
286
- fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
282
+ if status.nil?
283
+ fail ArgumentError, 'status cannot be nil'
287
284
  end
285
+
288
286
  @status = status
289
287
  end
290
288
 
@@ -30,6 +30,8 @@ module Tremendous
30
30
  # Determines whether fees for premium products are added to the order total (`SENDER`) or deducted from the recipient's reward amount (`RECIPIENT`). Campaigns with `RECIPIENT` must include at least one fee-free product.
31
31
  attr_accessor :fee_charged_to
32
32
 
33
+ attr_accessor :auto_add_product_rule
34
+
33
35
  attr_accessor :webpage_style
34
36
 
35
37
  attr_accessor :email_style
@@ -64,6 +66,7 @@ module Tremendous
64
66
  :'description' => :'description',
65
67
  :'products' => :'products',
66
68
  :'fee_charged_to' => :'fee_charged_to',
69
+ :'auto_add_product_rule' => :'auto_add_product_rule',
67
70
  :'webpage_style' => :'webpage_style',
68
71
  :'email_style' => :'email_style'
69
72
  }
@@ -87,6 +90,7 @@ module Tremendous
87
90
  :'description' => :'String',
88
91
  :'products' => :'Array<String>',
89
92
  :'fee_charged_to' => :'String',
93
+ :'auto_add_product_rule' => :'ListCampaigns200ResponseCampaignsInnerAutoAddProductRule',
90
94
  :'webpage_style' => :'ListCampaigns200ResponseCampaignsInnerWebpageStyle',
91
95
  :'email_style' => :'ListCampaigns200ResponseCampaignsInnerEmailStyle'
92
96
  }
@@ -97,6 +101,7 @@ module Tremendous
97
101
  Set.new([
98
102
  :'description',
99
103
  :'fee_charged_to',
104
+ :'auto_add_product_rule',
100
105
  ])
101
106
  end
102
107
 
@@ -144,6 +149,10 @@ module Tremendous
144
149
  self.fee_charged_to = attributes[:'fee_charged_to']
145
150
  end
146
151
 
152
+ if attributes.key?(:'auto_add_product_rule')
153
+ self.auto_add_product_rule = attributes[:'auto_add_product_rule']
154
+ end
155
+
147
156
  if attributes.key?(:'webpage_style')
148
157
  self.webpage_style = attributes[:'webpage_style']
149
158
  end
@@ -221,13 +230,11 @@ module Tremendous
221
230
  @products = products
222
231
  end
223
232
 
224
- # Custom attribute writer method checking allowed values (enum).
233
+ # Custom attribute writer method for enum attributes. Any value is accepted
234
+ # so that enum values added to the API don't break deserialization on
235
+ # older versions of this gem.
225
236
  # @param [Object] fee_charged_to Object to be assigned
226
237
  def fee_charged_to=(fee_charged_to)
227
- validator = EnumAttributeValidator.new('String', ["SENDER", "RECIPIENT"])
228
- unless validator.valid?(fee_charged_to)
229
- fail ArgumentError, "invalid value for \"fee_charged_to\", must be one of #{validator.allowable_values}."
230
- end
231
238
  @fee_charged_to = fee_charged_to
232
239
  end
233
240
 
@@ -241,6 +248,7 @@ module Tremendous
241
248
  description == o.description &&
242
249
  products == o.products &&
243
250
  fee_charged_to == o.fee_charged_to &&
251
+ auto_add_product_rule == o.auto_add_product_rule &&
244
252
  webpage_style == o.webpage_style &&
245
253
  email_style == o.email_style
246
254
  end
@@ -254,7 +262,7 @@ module Tremendous
254
262
  # Calculates hash code according to all attributes.
255
263
  # @return [Integer] Hash code
256
264
  def hash
257
- [id, name, description, products, fee_charged_to, webpage_style, email_style].hash
265
+ [id, name, description, products, fee_charged_to, auto_add_product_rule, webpage_style, email_style].hash
258
266
  end
259
267
 
260
268
  # Builds the object from hash
@@ -0,0 +1,301 @@
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
+ # When enabled, newly activated gift card products that match the optional country and currency filters are added to this campaign automatically. Applies to gift cards only — premium options, prepaid cards, and merchant cards with vendor fees are excluded. Affects future rewards only and does not retroactively add products to unredeemed rewards. On read, `enabled` is `true` whenever a rule is configured; `countries` and `currencies` are only present when the rule actually filters on them — an absent filter matches all values. On write: * Omit the field on `PUT` to leave the existing rule unchanged. * Send `null` or `{ \"enabled\": false }` to clear any existing rule. * Send `{ \"enabled\": true, ... }` to upsert. `countries` and `currencies` are optional; when present they must contain at least one entry. To match all countries (or all currencies), simply omit the key. * An empty object (`{}`) is rejected because `enabled` is required — use `{ \"enabled\": false }` or `null` to clear the rule.
18
+ class ListCampaigns200ResponseCampaignsInnerAutoAddProductRule
19
+ # Whether the auto-add rule is active.
20
+ attr_accessor :enabled
21
+
22
+ # ISO 3166-1 alpha-2 country codes (uppercase). When omitted, the rule matches all countries; when present, must contain at least one entry. Each code must be covered by at least one active Tremendous product — requests filtering on a country we don't currently sell into are rejected with a 422.
23
+ attr_accessor :countries
24
+
25
+ # ISO 4217 currency codes (uppercase). When omitted, the rule matches all currencies; when present, must contain at least one entry. Each code must be covered by at least one active Tremendous product — requests filtering on a currency we don't currently sell are rejected with a 422.
26
+ attr_accessor :currencies
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'enabled' => :'enabled',
32
+ :'countries' => :'countries',
33
+ :'currencies' => :'currencies'
34
+ }
35
+ end
36
+
37
+ # Returns attribute mapping this model knows about
38
+ def self.acceptable_attribute_map
39
+ attribute_map
40
+ end
41
+
42
+ # Returns all the JSON keys this model knows about
43
+ def self.acceptable_attributes
44
+ acceptable_attribute_map.values
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'enabled' => :'Boolean',
51
+ :'countries' => :'Array<String>',
52
+ :'currencies' => :'Array<String>'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
59
+ ])
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ListCampaigns200ResponseCampaignsInnerAutoAddProductRule` initialize method"
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ acceptable_attribute_map = self.class.acceptable_attribute_map
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ if (!acceptable_attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::ListCampaigns200ResponseCampaignsInnerAutoAddProductRule`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'enabled')
79
+ self.enabled = attributes[:'enabled']
80
+ else
81
+ self.enabled = nil
82
+ end
83
+
84
+ if attributes.key?(:'countries')
85
+ if (value = attributes[:'countries']).is_a?(Array)
86
+ self.countries = value
87
+ end
88
+ end
89
+
90
+ if attributes.key?(:'currencies')
91
+ if (value = attributes[:'currencies']).is_a?(Array)
92
+ self.currencies = value
93
+ end
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
101
+ invalid_properties = Array.new
102
+ if @enabled.nil?
103
+ invalid_properties.push('invalid value for "enabled", enabled cannot be nil.')
104
+ end
105
+
106
+ if !@countries.nil? && @countries.length < 1
107
+ invalid_properties.push('invalid value for "countries", number of items must be greater than or equal to 1.')
108
+ end
109
+
110
+ if !@currencies.nil? && @currencies.length < 1
111
+ invalid_properties.push('invalid value for "currencies", number of items must be greater than or equal to 1.')
112
+ end
113
+
114
+ invalid_properties
115
+ end
116
+
117
+ # Check to see if the all the properties in the model are valid
118
+ # @return true if the model is valid
119
+ def valid?
120
+ warn '[DEPRECATED] the `valid?` method is obsolete'
121
+ return false if @enabled.nil?
122
+ return false if !@countries.nil? && @countries.length < 1
123
+ return false if !@currencies.nil? && @currencies.length < 1
124
+ true
125
+ end
126
+
127
+ # Custom attribute writer method with validation
128
+ # @param [Object] enabled Value to be assigned
129
+ def enabled=(enabled)
130
+ if enabled.nil?
131
+ fail ArgumentError, 'enabled cannot be nil'
132
+ end
133
+
134
+ @enabled = enabled
135
+ end
136
+
137
+ # Custom attribute writer method with validation
138
+ # @param [Object] countries Value to be assigned
139
+ def countries=(countries)
140
+ if countries.nil?
141
+ fail ArgumentError, 'countries cannot be nil'
142
+ end
143
+
144
+ if countries.length < 1
145
+ fail ArgumentError, 'invalid value for "countries", number of items must be greater than or equal to 1.'
146
+ end
147
+
148
+ @countries = countries
149
+ end
150
+
151
+ # Custom attribute writer method with validation
152
+ # @param [Object] currencies Value to be assigned
153
+ def currencies=(currencies)
154
+ if currencies.nil?
155
+ fail ArgumentError, 'currencies cannot be nil'
156
+ end
157
+
158
+ if currencies.length < 1
159
+ fail ArgumentError, 'invalid value for "currencies", number of items must be greater than or equal to 1.'
160
+ end
161
+
162
+ @currencies = currencies
163
+ end
164
+
165
+ # Checks equality by comparing each attribute.
166
+ # @param [Object] Object to be compared
167
+ def ==(o)
168
+ return true if self.equal?(o)
169
+ self.class == o.class &&
170
+ enabled == o.enabled &&
171
+ countries == o.countries &&
172
+ currencies == o.currencies
173
+ end
174
+
175
+ # @see the `==` method
176
+ # @param [Object] Object to be compared
177
+ def eql?(o)
178
+ self == o
179
+ end
180
+
181
+ # Calculates hash code according to all attributes.
182
+ # @return [Integer] Hash code
183
+ def hash
184
+ [enabled, countries, currencies].hash
185
+ end
186
+
187
+ # Builds the object from hash
188
+ # @param [Hash] attributes Model attributes in the form of hash
189
+ # @return [Object] Returns the model itself
190
+ def self.build_from_hash(attributes)
191
+ return nil unless attributes.is_a?(Hash)
192
+ attributes = attributes.transform_keys(&:to_sym)
193
+ transformed_hash = {}
194
+ openapi_types.each_pair do |key, type|
195
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
196
+ transformed_hash["#{key}"] = nil
197
+ elsif type =~ /\AArray<(.*)>/i
198
+ # check to ensure the input is an array given that the attribute
199
+ # is documented as an array but the input is not
200
+ if attributes[attribute_map[key]].is_a?(Array)
201
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
202
+ end
203
+ elsif !attributes[attribute_map[key]].nil?
204
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
205
+ end
206
+ end
207
+ new(transformed_hash)
208
+ end
209
+
210
+ # Deserializes the data based on type
211
+ # @param string type Data type
212
+ # @param string value Value to be deserialized
213
+ # @return [Object] Deserialized data
214
+ def self._deserialize(type, value)
215
+ case type.to_sym
216
+ when :Time
217
+ Time.parse(value)
218
+ when :Date
219
+ Date.parse(value)
220
+ when :String
221
+ value.to_s
222
+ when :Integer
223
+ value.to_i
224
+ when :Float
225
+ value.to_f
226
+ when :Boolean
227
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
228
+ true
229
+ else
230
+ false
231
+ end
232
+ when :Object
233
+ # generic object (usually a Hash), return directly
234
+ value
235
+ when /\AArray<(?<inner_type>.+)>\z/
236
+ inner_type = Regexp.last_match[:inner_type]
237
+ value.map { |v| _deserialize(inner_type, v) }
238
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
239
+ k_type = Regexp.last_match[:k_type]
240
+ v_type = Regexp.last_match[:v_type]
241
+ {}.tap do |hash|
242
+ value.each do |k, v|
243
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
244
+ end
245
+ end
246
+ else # model
247
+ # models (e.g. Pet) or oneOf
248
+ klass = Tremendous.const_get(type)
249
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
250
+ end
251
+ end
252
+
253
+ # Returns the string representation of the object
254
+ # @return [String] String presentation of the object
255
+ def to_s
256
+ to_hash.to_s
257
+ end
258
+
259
+ # to_body is an alias to to_hash (backward compatibility)
260
+ # @return [Hash] Returns the object in the form of hash
261
+ def to_body
262
+ to_hash
263
+ end
264
+
265
+ # Returns the object in the form of hash
266
+ # @return [Hash] Returns the object in the form of hash
267
+ def to_hash
268
+ hash = {}
269
+ self.class.attribute_map.each_pair do |attr, param|
270
+ value = self.send(attr)
271
+ if value.nil?
272
+ is_nullable = self.class.openapi_nullable.include?(attr)
273
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
274
+ end
275
+
276
+ hash[param] = _to_hash(value)
277
+ end
278
+ hash
279
+ end
280
+
281
+ # Outputs non-array value in the form of hash
282
+ # For object, use to_hash. Otherwise, just return the value
283
+ # @param [Object] value Any valid value
284
+ # @return [Hash] Returns the value in the form of hash
285
+ def _to_hash(value)
286
+ if value.is_a?(Array)
287
+ value.compact.map { |v| _to_hash(v) }
288
+ elsif value.is_a?(Hash)
289
+ {}.tap do |hash|
290
+ value.each { |k, v| hash[k] = _to_hash(v) }
291
+ end
292
+ elsif value.respond_to? :to_hash
293
+ value.to_hash
294
+ else
295
+ value
296
+ end
297
+ end
298
+
299
+ end
300
+
301
+ end
@@ -228,13 +228,15 @@ module Tremendous
228
228
  @email = email
229
229
  end
230
230
 
231
- # Custom attribute writer method checking allowed values (enum).
231
+ # Custom attribute writer method for enum attributes. Any value is accepted
232
+ # so that enum values added to the API don't break deserialization on
233
+ # older versions of this gem.
232
234
  # @param [Object] status Object to be assigned
233
235
  def status=(status)
234
- validator = EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"])
235
- unless validator.valid?(status)
236
- fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
236
+ if status.nil?
237
+ fail ArgumentError, 'status cannot be nil'
237
238
  end
239
+
238
240
  @status = status
239
241
  end
240
242
 
@@ -208,13 +208,11 @@ module Tremendous
208
208
  @website = website
209
209
  end
210
210
 
211
- # Custom attribute writer method checking allowed values (enum).
211
+ # Custom attribute writer method for enum attributes. Any value is accepted
212
+ # so that enum values added to the API don't break deserialization on
213
+ # older versions of this gem.
212
214
  # @param [Object] status Object to be assigned
213
215
  def status=(status)
214
- validator = EnumAttributeValidator.new('String', ["PENDING", "APPROVED", "REJECTED"])
215
- unless validator.valid?(status)
216
- fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
217
- end
218
216
  @status = status
219
217
  end
220
218
 
@@ -172,13 +172,11 @@ module Tremendous
172
172
  @id = id
173
173
  end
174
174
 
175
- # Custom attribute writer method checking allowed values (enum).
175
+ # Custom attribute writer method for enum attributes. Any value is accepted
176
+ # so that enum values added to the API don't break deserialization on
177
+ # older versions of this gem.
176
178
  # @param [Object] data_type Object to be assigned
177
179
  def data_type=(data_type)
178
- validator = EnumAttributeValidator.new('String', ["Checkbox", "Currency", "Date", "Dropdown", "Email", "List", "Number", "Phone", "Text", "TextArea"])
179
- unless validator.valid?(data_type)
180
- fail ArgumentError, "invalid value for \"data_type\", must be one of #{validator.allowable_values}."
181
- end
182
180
  @data_type = data_type
183
181
  end
184
182
 
@@ -19,7 +19,7 @@ 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 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 amount 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` * `Device 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` * `Allowed country`
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 amount limit` * `Over reward count limit` * `VPN detected` * `Apple Private Relay` * `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` * `Device 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` * `Allowed country`
23
23
  attr_accessor :reasons
24
24
 
25
25
  # The device fingerprint, if known.
@@ -192,23 +192,19 @@ module Tremendous
192
192
  true
193
193
  end
194
194
 
195
- # Custom attribute writer method checking allowed values (enum).
195
+ # Custom attribute writer method for enum attributes. Any value is accepted
196
+ # so that enum values added to the API don't break deserialization on
197
+ # older versions of this gem.
196
198
  # @param [Object] status Object to be assigned
197
199
  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
200
  @status = status
203
201
  end
204
202
 
205
- # Custom attribute writer method checking allowed values (enum).
203
+ # Custom attribute writer method for enum attributes. Any value is accepted
204
+ # so that enum values added to the API don't break deserialization on
205
+ # older versions of this gem.
206
206
  # @param [Object] redemption_method Object to be assigned
207
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
208
  @redemption_method = redemption_method
213
209
  end
214
210
 
@@ -16,7 +16,7 @@ require 'time'
16
16
  module Tremendous
17
17
  # An active fraud rule
18
18
  class ListFraudRules200ResponseFraudRulesInner
19
- # * `review_country` - Flags when the recipient's IP country matches the criteria in the rule * `review_ip` - Flags when recipient's IP matches one in the list * `review_email` - Flags when the recipient's email matches one in the list * `review_redeemed_rewards_count` - Flags when the recipient redeemed more than the number of rewards specified in the config * `review_redeemed_rewards_amount` - Flags when the recipient redeemed more than the total amount specified in the config. The amount is denominated in the organization's currency. * `review_multiple_emails` - Flags when recipient's device or account has multiple emails associated * `review_vpn` - Flags when VPN is suspected * `review_tremendous_flag_list` - Flags rewards when redemption attributes match at least one criteria defined by the Tremendous flag list * `review_previously_blocked_recipients` - Flags rewards when the recipient has been blocked before * `allow_ip` - Releases a reward when a recipient's IP matches one in the list * `allow_email` - Releases a reward when the recipient's email matches one in the list
19
+ # * `review_country` - Flags when the recipient's IP country matches the criteria in the rule * `review_ip` - Flags when recipient's IP matches one in the list * `review_email` - Flags when the recipient's email matches one in the list * `review_redeemed_rewards_count` - Flags when the recipient redeemed more than the number of rewards specified in the config * `review_redeemed_rewards_amount` - Flags when the recipient redeemed more than the total amount specified in the config. The amount is denominated in the organization's currency. * `review_multiple_emails` - Flags when recipient's device or account has multiple emails associated * `review_vpn` - Flags when VPN or proxy use is suspected. Can be configured to exclude Apple Private Relay. * `review_tremendous_flag_list` - Flags rewards when redemption attributes match at least one criteria defined by the Tremendous flag list * `review_previously_blocked_recipients` - Flags rewards when the recipient has been blocked before * `allow_ip` - Releases a reward when a recipient's IP matches one in the list * `allow_email` - Releases a reward when the recipient's email matches one in the list
20
20
  attr_accessor :rule_type
21
21
 
22
22
  # The configuration associated with the rule. The properties allowed depend on the type of rule. This property is only present for rules that require configuration.
@@ -121,13 +121,11 @@ module Tremendous
121
121
  true
122
122
  end
123
123
 
124
- # Custom attribute writer method checking allowed values (enum).
124
+ # Custom attribute writer method for enum attributes. Any value is accepted
125
+ # so that enum values added to the API don't break deserialization on
126
+ # older versions of this gem.
125
127
  # @param [Object] rule_type Object to be assigned
126
128
  def rule_type=(rule_type)
127
- validator = EnumAttributeValidator.new('String', ["review_country", "review_ip", "review_email", "review_redeemed_rewards_count", "review_redeemed_rewards_amount", "review_multiple_emails", "review_vpn", "review_tremendous_flag_list", "review_previously_blocked_recipients", "allow_ip", "allow_email"])
128
- unless validator.valid?(rule_type)
129
- fail ArgumentError, "invalid value for \"rule_type\", must be one of #{validator.allowable_values}."
130
- end
131
129
  @rule_type = rule_type
132
130
  end
133
131
 
@@ -200,33 +200,31 @@ module Tremendous
200
200
  @id = id
201
201
  end
202
202
 
203
- # Custom attribute writer method checking allowed values (enum).
203
+ # Custom attribute writer method for enum attributes. Any value is accepted
204
+ # so that enum values added to the API don't break deserialization on
205
+ # older versions of this gem.
204
206
  # @param [Object] method Object to be assigned
205
207
  def method=(method)
206
- validator = EnumAttributeValidator.new('String', ["balance", "bank_account", "credit_card", "invoice"])
207
- unless validator.valid?(method)
208
- fail ArgumentError, "invalid value for \"method\", must be one of #{validator.allowable_values}."
208
+ if method.nil?
209
+ fail ArgumentError, 'method cannot be nil'
209
210
  end
211
+
210
212
  @method = method
211
213
  end
212
214
 
213
- # Custom attribute writer method checking allowed values (enum).
215
+ # Custom attribute writer method for enum attributes. Any value is accepted
216
+ # so that enum values added to the API don't break deserialization on
217
+ # older versions of this gem.
214
218
  # @param [Object] status Object to be assigned
215
219
  def status=(status)
216
- validator = EnumAttributeValidator.new('String', ["active", "deleted", "failed"])
217
- unless validator.valid?(status)
218
- fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
219
- end
220
220
  @status = status
221
221
  end
222
222
 
223
- # Custom attribute writer method checking allowed values (enum).
223
+ # Custom attribute writer method for enum attributes. Any value is accepted
224
+ # so that enum values added to the API don't break deserialization on
225
+ # older versions of this gem.
224
226
  # @param [Object] type Object to be assigned
225
227
  def type=(type)
226
- validator = EnumAttributeValidator.new('String', ["COMMERCIAL", "PRO_FORMA", "PREFUNDING_ONLY"])
227
- unless validator.valid?(type)
228
- fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
229
- end
230
228
  @type = type
231
229
  end
232
230
 
@@ -418,13 +418,11 @@ module Tremendous
418
418
  true
419
419
  end
420
420
 
421
- # Custom attribute writer method checking allowed values (enum).
421
+ # Custom attribute writer method for enum attributes. Any value is accepted
422
+ # so that enum values added to the API don't break deserialization on
423
+ # older versions of this gem.
422
424
  # @param [Object] account_type Object to be assigned
423
425
  def account_type=(account_type)
424
- validator = EnumAttributeValidator.new('String', ["checking", "savings"])
425
- unless validator.valid?(account_type)
426
- fail ArgumentError, "invalid value for \"account_type\", must be one of #{validator.allowable_values}."
427
- end
428
426
  @account_type = account_type
429
427
  end
430
428
 
@@ -458,13 +456,11 @@ module Tremendous
458
456
  @account_routing_mask = account_routing_mask
459
457
  end
460
458
 
461
- # Custom attribute writer method checking allowed values (enum).
459
+ # Custom attribute writer method for enum attributes. Any value is accepted
460
+ # so that enum values added to the API don't break deserialization on
461
+ # older versions of this gem.
462
462
  # @param [Object] network Object to be assigned
463
463
  def network=(network)
464
- validator = EnumAttributeValidator.new('String', ["MasterCard", "Amex", "JCB", "Diner's Club", "Visa", "Discover", "Laser", "Elo", "Maestro", "Solo"])
465
- unless validator.valid?(network)
466
- fail ArgumentError, "invalid value for \"network\", must be one of #{validator.allowable_values}."
467
- end
468
464
  @network = network
469
465
  end
470
466