tremendous_ruby 5.3.0 → 5.4.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 (79) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tremendous/api/tremendous_api.rb +571 -9
  3. data/lib/tremendous/models/allow_email.rb +225 -0
  4. data/lib/tremendous/models/allow_email1.rb +225 -0
  5. data/lib/tremendous/models/allow_ip.rb +225 -0
  6. data/lib/tremendous/models/allow_ip1.rb +225 -0
  7. data/lib/tremendous/models/base_order_for_create.rb +232 -0
  8. data/lib/tremendous/models/create_order200_response.rb +1 -1
  9. data/lib/tremendous/models/create_order_request.rb +73 -217
  10. data/lib/tremendous/models/delete_fraud_rule200_response.rb +222 -0
  11. data/lib/tremendous/models/fraud_config_allow_email.rb +224 -0
  12. data/lib/tremendous/models/fraud_config_country.rb +275 -0
  13. data/lib/tremendous/models/fraud_config_country_update_list.rb +224 -0
  14. data/lib/tremendous/models/fraud_config_ip.rb +224 -0
  15. data/lib/tremendous/models/fraud_config_redeemed_rewards_amount.rb +292 -0
  16. data/lib/tremendous/models/fraud_config_redeemed_rewards_count.rb +292 -0
  17. data/lib/tremendous/models/fraud_config_review_email.rb +229 -0
  18. data/lib/tremendous/models/fraud_generic_response.rb +222 -0
  19. data/lib/tremendous/models/fraud_review.rb +351 -0
  20. data/lib/tremendous/models/fraud_review_geo.rb +235 -0
  21. data/lib/tremendous/models/{reward_with_link_delivery.rb → fraud_review_list_item.rb} +26 -51
  22. data/lib/tremendous/models/fraud_review_reason.rb +58 -0
  23. data/lib/tremendous/models/fraud_review_redemption_method.rb +44 -0
  24. data/lib/tremendous/models/fraud_review_related_rewards.rb +304 -0
  25. data/lib/tremendous/models/fraud_review_status.rb +41 -0
  26. data/lib/tremendous/models/fraud_rule200_response.rb +222 -0
  27. data/lib/tremendous/models/fraud_rule400_response.rb +221 -0
  28. data/lib/tremendous/models/fraud_rule422_response.rb +221 -0
  29. data/lib/tremendous/models/fraud_rule_request.rb +214 -0
  30. data/lib/tremendous/models/fraud_rule_request_config.rb +110 -0
  31. data/lib/tremendous/models/fraud_rule_type.rb +49 -0
  32. data/lib/tremendous/models/fraud_rules_list_item.rb +261 -0
  33. data/lib/tremendous/models/get_fraud_review200_response.rb +221 -0
  34. data/lib/tremendous/models/get_fraud_review200_response_fraud_review.rb +351 -0
  35. data/lib/tremendous/models/get_fraud_review200_response_fraud_review_geo.rb +236 -0
  36. data/lib/tremendous/models/get_fraud_review200_response_fraud_review_related_rewards.rb +305 -0
  37. data/lib/tremendous/models/list_campaigns200_response_campaigns_inner_email_style.rb +2 -0
  38. data/lib/tremendous/models/list_campaigns200_response_campaigns_inner_webpage_style.rb +1 -0
  39. data/lib/tremendous/models/list_fraud_reviews200_response.rb +223 -0
  40. data/lib/tremendous/models/{delivery_details_with_link.rb → list_fraud_reviews200_response_fraud_reviews_inner.rb} +26 -51
  41. data/lib/tremendous/models/list_fraud_rules200_response.rb +223 -0
  42. data/lib/tremendous/models/{create_order200_response_order_rewards_inner_delivery.rb → list_fraud_rules200_response_fraud_rules_inner.rb} +28 -63
  43. data/lib/tremendous/models/list_rewards200_response_rewards_inner.rb +0 -21
  44. data/lib/tremendous/models/list_rewards200_response_rewards_inner_value.rb +1 -6
  45. data/lib/tremendous/models/order_without_link_reward.rb +0 -21
  46. data/lib/tremendous/models/public_key.rb +1 -1
  47. data/lib/tremendous/models/public_keys_response_public_keys_inner.rb +1 -1
  48. data/lib/tremendous/models/review_country.rb +276 -0
  49. data/lib/tremendous/models/review_country1.rb +225 -0
  50. data/lib/tremendous/models/review_email.rb +230 -0
  51. data/lib/tremendous/models/review_email1.rb +230 -0
  52. data/lib/tremendous/models/review_ip.rb +225 -0
  53. data/lib/tremendous/models/review_ip1.rb +225 -0
  54. data/lib/tremendous/models/review_redeemed_rewards_amount.rb +293 -0
  55. data/lib/tremendous/models/review_redeemed_rewards_count.rb +293 -0
  56. data/lib/tremendous/models/reward.rb +0 -21
  57. data/lib/tremendous/models/reward_base.rb +0 -21
  58. data/lib/tremendous/models/reward_for_order_create.rb +1 -22
  59. data/lib/tremendous/models/reward_value.rb +1 -6
  60. data/lib/tremendous/models/reward_without_link.rb +0 -21
  61. data/lib/tremendous/models/{order_for_create.rb → single_reward_order.rb} +6 -12
  62. data/lib/tremendous/models/single_reward_order1.rb +242 -0
  63. data/lib/tremendous/models/{create_order_request_payment.rb → single_reward_order1_payment.rb} +3 -3
  64. data/lib/tremendous/models/{create_order_request_reward.rb → single_reward_order1_reward.rb} +5 -26
  65. data/lib/tremendous/models/{create_order_request_reward_custom_fields_inner.rb → single_reward_order1_reward_custom_fields_inner.rb} +3 -3
  66. data/lib/tremendous/models/{create_order_request_reward_delivery.rb → single_reward_order1_reward_delivery.rb} +3 -3
  67. data/lib/tremendous/models/{order_for_create_reward.rb → single_reward_order_reward.rb} +4 -25
  68. data/lib/tremendous/models/{create_order201_response.rb → single_reward_order_without_link.rb} +4 -4
  69. data/lib/tremendous/models/{order_with_link.rb → single_reward_order_without_link_order.rb} +10 -31
  70. data/lib/tremendous/models/update_fraud_rule_list200_response.rb +222 -0
  71. data/lib/tremendous/models/update_fraud_rule_list_request.rb +272 -0
  72. data/lib/tremendous/models/update_fraud_rule_list_request_config.rb +108 -0
  73. data/lib/tremendous/version.rb +1 -1
  74. data/lib/tremendous.rb +56 -15
  75. metadata +59 -18
  76. data/lib/tremendous/models/create_order200_response_order.rb +0 -400
  77. data/lib/tremendous/models/create_order200_response_order_rewards_inner.rb +0 -347
  78. data/lib/tremendous/models/order_with_link_rewards_inner.rb +0 -406
  79. data/lib/tremendous/models/reward_with_link.rb +0 -406
@@ -80,7 +80,7 @@ module Tremendous
80
80
  :'deliver_at' => :'Date',
81
81
  :'custom_fields' => :'Array<RewardBaseCustomFieldsInner>',
82
82
  :'language' => :'String',
83
- :'delivery' => :'CreateOrderRequestRewardDelivery'
83
+ :'delivery' => :'SingleRewardOrder1RewardDelivery'
84
84
  }
85
85
  end
86
86
 
@@ -179,11 +179,6 @@ module Tremendous
179
179
  invalid_properties.push('invalid value for "products", number of items must be greater than or equal to 1.')
180
180
  end
181
181
 
182
- pattern = Regexp.new(/YYYY-MM-DD/)
183
- if !@deliver_at.nil? && @deliver_at !~ pattern
184
- invalid_properties.push("invalid value for \"deliver_at\", must conform to the pattern #{pattern}.")
185
- end
186
-
187
182
  invalid_properties
188
183
  end
189
184
 
@@ -195,7 +190,6 @@ module Tremendous
195
190
  return false if !@order_id.nil? && @order_id !~ Regexp.new(/[A-Z0-9]{4,20}/)
196
191
  return false if !@campaign_id.nil? && @campaign_id !~ Regexp.new(/[A-Z0-9]{4,20}/)
197
192
  return false if !@products.nil? && @products.length < 1
198
- return false if !@deliver_at.nil? && @deliver_at !~ Regexp.new(/YYYY-MM-DD/)
199
193
  true
200
194
  end
201
195
 
@@ -254,21 +248,6 @@ module Tremendous
254
248
  @products = products
255
249
  end
256
250
 
257
- # Custom attribute writer method with validation
258
- # @param [Object] deliver_at Value to be assigned
259
- def deliver_at=(deliver_at)
260
- if deliver_at.nil?
261
- fail ArgumentError, 'deliver_at cannot be nil'
262
- end
263
-
264
- pattern = Regexp.new(/YYYY-MM-DD/)
265
- if deliver_at !~ pattern
266
- fail ArgumentError, "invalid value for \"deliver_at\", must conform to the pattern #{pattern}."
267
- end
268
-
269
- @deliver_at = deliver_at
270
- end
271
-
272
251
  # Checks equality by comparing each attribute.
273
252
  # @param [Object] Object to be compared
274
253
  def ==(o)
@@ -94,7 +94,7 @@ module Tremendous
94
94
  if attributes.key?(:'currency_code')
95
95
  self.currency_code = attributes[:'currency_code']
96
96
  else
97
- self.currency_code = nil
97
+ self.currency_code = 'USD'
98
98
  end
99
99
  end
100
100
 
@@ -107,10 +107,6 @@ module Tremendous
107
107
  invalid_properties.push('invalid value for "denomination", denomination cannot be nil.')
108
108
  end
109
109
 
110
- if @currency_code.nil?
111
- invalid_properties.push('invalid value for "currency_code", currency_code cannot be nil.')
112
- end
113
-
114
110
  invalid_properties
115
111
  end
116
112
 
@@ -119,7 +115,6 @@ module Tremendous
119
115
  def valid?
120
116
  warn '[DEPRECATED] the `valid?` method is obsolete'
121
117
  return false if @denomination.nil?
122
- return false if @currency_code.nil?
123
118
  currency_code_validator = EnumAttributeValidator.new('String', ["USD", "CAD", "EUR", "AED", "AFN", "ALL", "AMD", "ARS", "AUD", "AZN", "BAM", "BDT", "BGN", "BHD", "BIF", "BND", "BOB", "BRL", "BWP", "BYR", "BZD", "CDF", "CHF", "CLP", "CNY", "COP", "CRC", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EEK", "EGP", "ERN", "ETB", "GBP", "GEL", "GHS", "GNF", "GTQ", "HKD", "HNL", "HRK", "HUF", "IDR", "ILS", "INR", "IQD", "IRR", "ISK", "JMD", "JOD", "JPY", "KES", "KHR", "KRW", "KWD", "KZT", "LBP", "LKR", "LTL", "LVL", "MAD", "MDL", "MGA", "MKD", "MMK", "MOP", "MUR", "MXN", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SDG", "SEK", "SGD", "SOS", "SYP", "THB", "TND", "TOP", "TRY", "TTD", "TWD", "TZS", "UAH", "UGX", "UYU", "UZS", "VEF", "VND", "XAF", "XOF", "YER", "ZAR", "ZMK"])
124
119
  return false unless currency_code_validator.valid?(@currency_code)
125
120
  true
@@ -170,11 +170,6 @@ module Tremendous
170
170
  invalid_properties.push('invalid value for "products", number of items must be greater than or equal to 1.')
171
171
  end
172
172
 
173
- pattern = Regexp.new(/YYYY-MM-DD/)
174
- if !@deliver_at.nil? && @deliver_at !~ pattern
175
- invalid_properties.push("invalid value for \"deliver_at\", must conform to the pattern #{pattern}.")
176
- end
177
-
178
173
  invalid_properties
179
174
  end
180
175
 
@@ -186,7 +181,6 @@ module Tremendous
186
181
  return false if !@order_id.nil? && @order_id !~ Regexp.new(/[A-Z0-9]{4,20}/)
187
182
  return false if !@campaign_id.nil? && @campaign_id !~ Regexp.new(/[A-Z0-9]{4,20}/)
188
183
  return false if !@products.nil? && @products.length < 1
189
- return false if !@deliver_at.nil? && @deliver_at !~ Regexp.new(/YYYY-MM-DD/)
190
184
  true
191
185
  end
192
186
 
@@ -245,21 +239,6 @@ module Tremendous
245
239
  @products = products
246
240
  end
247
241
 
248
- # Custom attribute writer method with validation
249
- # @param [Object] deliver_at Value to be assigned
250
- def deliver_at=(deliver_at)
251
- if deliver_at.nil?
252
- fail ArgumentError, 'deliver_at cannot be nil'
253
- end
254
-
255
- pattern = Regexp.new(/YYYY-MM-DD/)
256
- if deliver_at !~ pattern
257
- fail ArgumentError, "invalid value for \"deliver_at\", must conform to the pattern #{pattern}."
258
- end
259
-
260
- @deliver_at = deliver_at
261
- end
262
-
263
242
  # Checks equality by comparing each attribute.
264
243
  # @param [Object] Object to be compared
265
244
  def ==(o)
@@ -14,7 +14,8 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Tremendous
17
- class OrderForCreate
17
+ # An order that contains a single reward. The reward is sent to a single recipient.
18
+ class SingleRewardOrder
18
19
  # Reference for this order, supplied by the customer. When set, `external_id` makes order idempotent. All requests that use the same `external_id` after the initial order creation, will result in a response that returns the data of the initially created order. The response will have a `201` response code. These responses **fail** to create any further orders. It also allows for retrieving by `external_id` instead of `id` only.
19
20
  attr_accessor :external_id
20
21
 
@@ -40,8 +41,8 @@ module Tremendous
40
41
  def self.openapi_types
41
42
  {
42
43
  :'external_id' => :'String',
43
- :'payment' => :'CreateOrderRequestPayment',
44
- :'reward' => :'OrderForCreateReward'
44
+ :'payment' => :'SingleRewardOrder1Payment',
45
+ :'reward' => :'SingleRewardOrderReward'
45
46
  }
46
47
  end
47
48
 
@@ -56,13 +57,13 @@ module Tremendous
56
57
  # @param [Hash] attributes Model attributes in the form of hash
57
58
  def initialize(attributes = {})
58
59
  if (!attributes.is_a?(Hash))
59
- fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::OrderForCreate` initialize method"
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::SingleRewardOrder` initialize method"
60
61
  end
61
62
 
62
63
  # check to see if the attribute exists and convert string to symbol for hash key
63
64
  attributes = attributes.each_with_object({}) { |(k, v), h|
64
65
  if (!self.class.attribute_map.key?(k.to_sym))
65
- fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::OrderForCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::SingleRewardOrder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
67
  end
67
68
  h[k.to_sym] = v
68
69
  }
@@ -73,8 +74,6 @@ module Tremendous
73
74
 
74
75
  if attributes.key?(:'payment')
75
76
  self.payment = attributes[:'payment']
76
- else
77
- self.payment = nil
78
77
  end
79
78
 
80
79
  if attributes.key?(:'reward')
@@ -89,10 +88,6 @@ module Tremendous
89
88
  def list_invalid_properties
90
89
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
91
90
  invalid_properties = Array.new
92
- if @payment.nil?
93
- invalid_properties.push('invalid value for "payment", payment cannot be nil.')
94
- end
95
-
96
91
  if @reward.nil?
97
92
  invalid_properties.push('invalid value for "reward", reward cannot be nil.')
98
93
  end
@@ -104,7 +99,6 @@ module Tremendous
104
99
  # @return true if the model is valid
105
100
  def valid?
106
101
  warn '[DEPRECATED] the `valid?` method is obsolete'
107
- return false if @payment.nil?
108
102
  return false if @reward.nil?
109
103
  true
110
104
  end
@@ -0,0 +1,242 @@
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
+ OpenAPI Generator version: 7.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Tremendous
17
+ # An order that contains a single reward. The reward is sent to a single recipient.
18
+ class SingleRewardOrder1
19
+ # Reference for this order, supplied by the customer. When set, `external_id` makes order idempotent. All requests that use the same `external_id` after the initial order creation, will result in a response that returns the data of the initially created order. The response will have a `201` response code. These responses **fail** to create any further orders. It also allows for retrieving by `external_id` instead of `id` only.
20
+ attr_accessor :external_id
21
+
22
+ attr_accessor :payment
23
+
24
+ attr_accessor :reward
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'external_id' => :'external_id',
30
+ :'payment' => :'payment',
31
+ :'reward' => :'reward'
32
+ }
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'external_id' => :'String',
44
+ :'payment' => :'SingleRewardOrder1Payment',
45
+ :'reward' => :'SingleRewardOrder1Reward'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ :'external_id',
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::SingleRewardOrder1` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!self.class.attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::SingleRewardOrder1`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'external_id')
72
+ self.external_id = attributes[:'external_id']
73
+ end
74
+
75
+ if attributes.key?(:'payment')
76
+ self.payment = attributes[:'payment']
77
+ end
78
+
79
+ if attributes.key?(:'reward')
80
+ self.reward = attributes[:'reward']
81
+ else
82
+ self.reward = nil
83
+ end
84
+ end
85
+
86
+ # Show invalid properties with the reasons. Usually used together with valid?
87
+ # @return Array for valid properties with the reasons
88
+ def list_invalid_properties
89
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
90
+ invalid_properties = Array.new
91
+ if @reward.nil?
92
+ invalid_properties.push('invalid value for "reward", reward cannot be nil.')
93
+ end
94
+
95
+ invalid_properties
96
+ end
97
+
98
+ # Check to see if the all the properties in the model are valid
99
+ # @return true if the model is valid
100
+ def valid?
101
+ warn '[DEPRECATED] the `valid?` method is obsolete'
102
+ return false if @reward.nil?
103
+ true
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(o)
109
+ return true if self.equal?(o)
110
+ self.class == o.class &&
111
+ external_id == o.external_id &&
112
+ payment == o.payment &&
113
+ reward == o.reward
114
+ end
115
+
116
+ # @see the `==` method
117
+ # @param [Object] Object to be compared
118
+ def eql?(o)
119
+ self == o
120
+ end
121
+
122
+ # Calculates hash code according to all attributes.
123
+ # @return [Integer] Hash code
124
+ def hash
125
+ [external_id, payment, reward].hash
126
+ end
127
+
128
+ # Builds the object from hash
129
+ # @param [Hash] attributes Model attributes in the form of hash
130
+ # @return [Object] Returns the model itself
131
+ def self.build_from_hash(attributes)
132
+ return nil unless attributes.is_a?(Hash)
133
+ attributes = attributes.transform_keys(&:to_sym)
134
+ transformed_hash = {}
135
+ openapi_types.each_pair do |key, type|
136
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
137
+ transformed_hash["#{key}"] = nil
138
+ elsif type =~ /\AArray<(.*)>/i
139
+ # check to ensure the input is an array given that the attribute
140
+ # is documented as an array but the input is not
141
+ if attributes[attribute_map[key]].is_a?(Array)
142
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
143
+ end
144
+ elsif !attributes[attribute_map[key]].nil?
145
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
146
+ end
147
+ end
148
+ new(transformed_hash)
149
+ end
150
+
151
+ # Deserializes the data based on type
152
+ # @param string type Data type
153
+ # @param string value Value to be deserialized
154
+ # @return [Object] Deserialized data
155
+ def self._deserialize(type, value)
156
+ case type.to_sym
157
+ when :Time
158
+ Time.parse(value)
159
+ when :Date
160
+ Date.parse(value)
161
+ when :String
162
+ value.to_s
163
+ when :Integer
164
+ value.to_i
165
+ when :Float
166
+ value.to_f
167
+ when :Boolean
168
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
169
+ true
170
+ else
171
+ false
172
+ end
173
+ when :Object
174
+ # generic object (usually a Hash), return directly
175
+ value
176
+ when /\AArray<(?<inner_type>.+)>\z/
177
+ inner_type = Regexp.last_match[:inner_type]
178
+ value.map { |v| _deserialize(inner_type, v) }
179
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
180
+ k_type = Regexp.last_match[:k_type]
181
+ v_type = Regexp.last_match[:v_type]
182
+ {}.tap do |hash|
183
+ value.each do |k, v|
184
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
185
+ end
186
+ end
187
+ else # model
188
+ # models (e.g. Pet) or oneOf
189
+ klass = Tremendous.const_get(type)
190
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
191
+ end
192
+ end
193
+
194
+ # Returns the string representation of the object
195
+ # @return [String] String presentation of the object
196
+ def to_s
197
+ to_hash.to_s
198
+ end
199
+
200
+ # to_body is an alias to to_hash (backward compatibility)
201
+ # @return [Hash] Returns the object in the form of hash
202
+ def to_body
203
+ to_hash
204
+ end
205
+
206
+ # Returns the object in the form of hash
207
+ # @return [Hash] Returns the object in the form of hash
208
+ def to_hash
209
+ hash = {}
210
+ self.class.attribute_map.each_pair do |attr, param|
211
+ value = self.send(attr)
212
+ if value.nil?
213
+ is_nullable = self.class.openapi_nullable.include?(attr)
214
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
215
+ end
216
+
217
+ hash[param] = _to_hash(value)
218
+ end
219
+ hash
220
+ end
221
+
222
+ # Outputs non-array value in the form of hash
223
+ # For object, use to_hash. Otherwise, just return the value
224
+ # @param [Object] value Any valid value
225
+ # @return [Hash] Returns the value in the form of hash
226
+ def _to_hash(value)
227
+ if value.is_a?(Array)
228
+ value.compact.map { |v| _to_hash(v) }
229
+ elsif value.is_a?(Hash)
230
+ {}.tap do |hash|
231
+ value.each { |k, v| hash[k] = _to_hash(v) }
232
+ end
233
+ elsif value.respond_to? :to_hash
234
+ value.to_hash
235
+ else
236
+ value
237
+ end
238
+ end
239
+
240
+ end
241
+
242
+ end
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Tremendous
17
- class CreateOrderRequestPayment
17
+ class SingleRewardOrder1Payment
18
18
  # Tremendous ID of the funding source that will be used to pay for the order. Use `balance` to use your Tremendous's balance.
19
19
  attr_accessor :funding_source_id
20
20
 
@@ -47,13 +47,13 @@ module Tremendous
47
47
  # @param [Hash] attributes Model attributes in the form of hash
48
48
  def initialize(attributes = {})
49
49
  if (!attributes.is_a?(Hash))
50
- fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::CreateOrderRequestPayment` initialize method"
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::SingleRewardOrder1Payment` initialize method"
51
51
  end
52
52
 
53
53
  # check to see if the attribute exists and convert string to symbol for hash key
54
54
  attributes = attributes.each_with_object({}) { |(k, v), h|
55
55
  if (!self.class.attribute_map.key?(k.to_sym))
56
- fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::CreateOrderRequestPayment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::SingleRewardOrder1Payment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
57
  end
58
58
  h[k.to_sym] = v
59
59
  }
@@ -15,7 +15,7 @@ require 'time'
15
15
 
16
16
  module Tremendous
17
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 CreateOrderRequestReward
18
+ class SingleRewardOrder1Reward
19
19
  # ID of the campaign in your account, that defines the available products (different gift cards, charity, etc.) that the recipient can choose from.
20
20
  attr_accessor :campaign_id
21
21
 
@@ -63,9 +63,9 @@ module Tremendous
63
63
  :'value' => :'ListRewards200ResponseRewardsInnerValue',
64
64
  :'recipient' => :'ListRewards200ResponseRewardsInnerRecipient',
65
65
  :'deliver_at' => :'Date',
66
- :'custom_fields' => :'Array<CreateOrderRequestRewardCustomFieldsInner>',
66
+ :'custom_fields' => :'Array<SingleRewardOrder1RewardCustomFieldsInner>',
67
67
  :'language' => :'String',
68
- :'delivery' => :'CreateOrderRequestRewardDelivery'
68
+ :'delivery' => :'SingleRewardOrder1RewardDelivery'
69
69
  }
70
70
  end
71
71
 
@@ -80,13 +80,13 @@ module Tremendous
80
80
  # @param [Hash] attributes Model attributes in the form of hash
81
81
  def initialize(attributes = {})
82
82
  if (!attributes.is_a?(Hash))
83
- fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::CreateOrderRequestReward` initialize method"
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::SingleRewardOrder1Reward` initialize method"
84
84
  end
85
85
 
86
86
  # check to see if the attribute exists and convert string to symbol for hash key
87
87
  attributes = attributes.each_with_object({}) { |(k, v), h|
88
88
  if (!self.class.attribute_map.key?(k.to_sym))
89
- fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::CreateOrderRequestReward`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::SingleRewardOrder1Reward`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
90
90
  end
91
91
  h[k.to_sym] = v
92
92
  }
@@ -142,11 +142,6 @@ module Tremendous
142
142
  invalid_properties.push('invalid value for "products", number of items must be greater than or equal to 1.')
143
143
  end
144
144
 
145
- pattern = Regexp.new(/YYYY-MM-DD/)
146
- if !@deliver_at.nil? && @deliver_at !~ pattern
147
- invalid_properties.push("invalid value for \"deliver_at\", must conform to the pattern #{pattern}.")
148
- end
149
-
150
145
  invalid_properties
151
146
  end
152
147
 
@@ -156,7 +151,6 @@ module Tremendous
156
151
  warn '[DEPRECATED] the `valid?` method is obsolete'
157
152
  return false if !@campaign_id.nil? && @campaign_id !~ Regexp.new(/[A-Z0-9]{4,20}/)
158
153
  return false if !@products.nil? && @products.length < 1
159
- return false if !@deliver_at.nil? && @deliver_at !~ Regexp.new(/YYYY-MM-DD/)
160
154
  true
161
155
  end
162
156
 
@@ -185,21 +179,6 @@ module Tremendous
185
179
  @products = products
186
180
  end
187
181
 
188
- # Custom attribute writer method with validation
189
- # @param [Object] deliver_at Value to be assigned
190
- def deliver_at=(deliver_at)
191
- if deliver_at.nil?
192
- fail ArgumentError, 'deliver_at cannot be nil'
193
- end
194
-
195
- pattern = Regexp.new(/YYYY-MM-DD/)
196
- if deliver_at !~ pattern
197
- fail ArgumentError, "invalid value for \"deliver_at\", must conform to the pattern #{pattern}."
198
- end
199
-
200
- @deliver_at = deliver_at
201
- end
202
-
203
182
  # Checks equality by comparing each attribute.
204
183
  # @param [Object] Object to be compared
205
184
  def ==(o)
@@ -15,7 +15,7 @@ require 'time'
15
15
 
16
16
  module Tremendous
17
17
  # Reward custom data for searching, tracking or copy (see [Adding custom fields to orders](https://developers.tremendous.com/reference/using-custom-fields-to-add-custom-data-to-rewards).)
18
- class CreateOrderRequestRewardCustomFieldsInner
18
+ class SingleRewardOrder1RewardCustomFieldsInner
19
19
  # Tremendous ID of the custom field
20
20
  attr_accessor :id
21
21
 
@@ -54,13 +54,13 @@ module Tremendous
54
54
  # @param [Hash] attributes Model attributes in the form of hash
55
55
  def initialize(attributes = {})
56
56
  if (!attributes.is_a?(Hash))
57
- fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::CreateOrderRequestRewardCustomFieldsInner` initialize method"
57
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::SingleRewardOrder1RewardCustomFieldsInner` initialize method"
58
58
  end
59
59
 
60
60
  # check to see if the attribute exists and convert string to symbol for hash key
61
61
  attributes = attributes.each_with_object({}) { |(k, v), h|
62
62
  if (!self.class.attribute_map.key?(k.to_sym))
63
- fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::CreateOrderRequestRewardCustomFieldsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::SingleRewardOrder1RewardCustomFieldsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
64
64
  end
65
65
  h[k.to_sym] = v
66
66
  }
@@ -15,7 +15,7 @@ require 'time'
15
15
 
16
16
  module Tremendous
17
17
  # Details on how the reward is delivered to the recipient.
18
- class CreateOrderRequestRewardDelivery
18
+ class SingleRewardOrder1RewardDelivery
19
19
  # How to deliver the reward to the recipient. <table> <thead> <tr> <th>Delivery Method</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>EMAIL</code></td> <td>Deliver the reward to the recipient by email</td> </tr> <tr> <td><code>LINK</code></td> <td> <p>Deliver the reward to the recipient via a link.</p> <p>The link can be retrieved on a successfully ordered reward via the <code>/rewards</code> or <code>/rewards/{id}</code> endpoint. That link must then be delivered to the recipient out-of-band.</p> </td> </tr> <tr> <td><code>PHONE</code></td> <td>Deliver the reward to the recipient by SMS</td> </tr> </tbody> </table>
20
20
  attr_accessor :method
21
21
 
@@ -70,13 +70,13 @@ module Tremendous
70
70
  # @param [Hash] attributes Model attributes in the form of hash
71
71
  def initialize(attributes = {})
72
72
  if (!attributes.is_a?(Hash))
73
- fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::CreateOrderRequestRewardDelivery` initialize method"
73
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::SingleRewardOrder1RewardDelivery` initialize method"
74
74
  end
75
75
 
76
76
  # check to see if the attribute exists and convert string to symbol for hash key
77
77
  attributes = attributes.each_with_object({}) { |(k, v), h|
78
78
  if (!self.class.attribute_map.key?(k.to_sym))
79
- fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::CreateOrderRequestRewardDelivery`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
79
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::SingleRewardOrder1RewardDelivery`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
80
80
  end
81
81
  h[k.to_sym] = v
82
82
  }
@@ -15,7 +15,7 @@ require 'time'
15
15
 
16
16
  module Tremendous
17
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 OrderForCreateReward
18
+ class SingleRewardOrderReward
19
19
  # Tremendous ID of the reward
20
20
  attr_accessor :id
21
21
 
@@ -80,7 +80,7 @@ module Tremendous
80
80
  :'deliver_at' => :'Date',
81
81
  :'custom_fields' => :'Array<RewardBaseCustomFieldsInner>',
82
82
  :'language' => :'String',
83
- :'delivery' => :'CreateOrderRequestRewardDelivery'
83
+ :'delivery' => :'SingleRewardOrder1RewardDelivery'
84
84
  }
85
85
  end
86
86
 
@@ -95,13 +95,13 @@ module Tremendous
95
95
  # @param [Hash] attributes Model attributes in the form of hash
96
96
  def initialize(attributes = {})
97
97
  if (!attributes.is_a?(Hash))
98
- fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::OrderForCreateReward` initialize method"
98
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::SingleRewardOrderReward` initialize method"
99
99
  end
100
100
 
101
101
  # check to see if the attribute exists and convert string to symbol for hash key
102
102
  attributes = attributes.each_with_object({}) { |(k, v), h|
103
103
  if (!self.class.attribute_map.key?(k.to_sym))
104
- fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::OrderForCreateReward`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
104
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::SingleRewardOrderReward`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
105
105
  end
106
106
  h[k.to_sym] = v
107
107
  }
@@ -179,11 +179,6 @@ module Tremendous
179
179
  invalid_properties.push('invalid value for "products", number of items must be greater than or equal to 1.')
180
180
  end
181
181
 
182
- pattern = Regexp.new(/YYYY-MM-DD/)
183
- if !@deliver_at.nil? && @deliver_at !~ pattern
184
- invalid_properties.push("invalid value for \"deliver_at\", must conform to the pattern #{pattern}.")
185
- end
186
-
187
182
  invalid_properties
188
183
  end
189
184
 
@@ -195,7 +190,6 @@ module Tremendous
195
190
  return false if !@order_id.nil? && @order_id !~ Regexp.new(/[A-Z0-9]{4,20}/)
196
191
  return false if !@campaign_id.nil? && @campaign_id !~ Regexp.new(/[A-Z0-9]{4,20}/)
197
192
  return false if !@products.nil? && @products.length < 1
198
- return false if !@deliver_at.nil? && @deliver_at !~ Regexp.new(/YYYY-MM-DD/)
199
193
  true
200
194
  end
201
195
 
@@ -254,21 +248,6 @@ module Tremendous
254
248
  @products = products
255
249
  end
256
250
 
257
- # Custom attribute writer method with validation
258
- # @param [Object] deliver_at Value to be assigned
259
- def deliver_at=(deliver_at)
260
- if deliver_at.nil?
261
- fail ArgumentError, 'deliver_at cannot be nil'
262
- end
263
-
264
- pattern = Regexp.new(/YYYY-MM-DD/)
265
- if deliver_at !~ pattern
266
- fail ArgumentError, "invalid value for \"deliver_at\", must conform to the pattern #{pattern}."
267
- end
268
-
269
- @deliver_at = deliver_at
270
- end
271
-
272
251
  # Checks equality by comparing each attribute.
273
252
  # @param [Object] Object to be compared
274
253
  def ==(o)