tremendous_ruby 5.1.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 (101) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tremendous/api/tremendous_api.rb +1125 -38
  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/campaign_base.rb +287 -0
  9. data/lib/tremendous/models/create_member.rb +1 -35
  10. data/lib/tremendous/models/create_member_request.rb +1 -35
  11. data/lib/tremendous/models/create_order200_response.rb +1 -1
  12. data/lib/tremendous/models/create_order_request.rb +73 -217
  13. data/lib/tremendous/models/create_organization_request_copy_settings.rb +14 -2
  14. data/lib/tremendous/models/create_public_key.rb +222 -0
  15. data/lib/tremendous/models/create_public_key200_response.rb +221 -0
  16. data/lib/tremendous/models/create_public_key_request.rb +222 -0
  17. data/lib/tremendous/models/delete_fraud_rule200_response.rb +222 -0
  18. data/lib/tremendous/models/fraud_config_allow_email.rb +224 -0
  19. data/lib/tremendous/models/fraud_config_country.rb +275 -0
  20. data/lib/tremendous/models/fraud_config_country_update_list.rb +224 -0
  21. data/lib/tremendous/models/fraud_config_ip.rb +224 -0
  22. data/lib/tremendous/models/fraud_config_redeemed_rewards_amount.rb +292 -0
  23. data/lib/tremendous/models/fraud_config_redeemed_rewards_count.rb +292 -0
  24. data/lib/tremendous/models/fraud_config_review_email.rb +229 -0
  25. data/lib/tremendous/models/fraud_generic_response.rb +222 -0
  26. data/lib/tremendous/models/fraud_review.rb +351 -0
  27. data/lib/tremendous/models/fraud_review_geo.rb +235 -0
  28. data/lib/tremendous/models/{reward_with_link_delivery.rb → fraud_review_list_item.rb} +26 -51
  29. data/lib/tremendous/models/fraud_review_reason.rb +58 -0
  30. data/lib/tremendous/models/fraud_review_redemption_method.rb +44 -0
  31. data/lib/tremendous/models/fraud_review_related_rewards.rb +304 -0
  32. data/lib/tremendous/models/fraud_review_status.rb +41 -0
  33. data/lib/tremendous/models/fraud_rule200_response.rb +222 -0
  34. data/lib/tremendous/models/fraud_rule400_response.rb +221 -0
  35. data/lib/tremendous/models/fraud_rule422_response.rb +221 -0
  36. data/lib/tremendous/models/fraud_rule_request.rb +214 -0
  37. data/lib/tremendous/models/fraud_rule_request_config.rb +110 -0
  38. data/lib/tremendous/models/fraud_rule_type.rb +49 -0
  39. data/lib/tremendous/models/fraud_rules_list_item.rb +261 -0
  40. data/lib/tremendous/models/get_fraud_review200_response.rb +221 -0
  41. data/lib/tremendous/models/get_fraud_review200_response_fraud_review.rb +351 -0
  42. data/lib/tremendous/models/get_fraud_review200_response_fraud_review_geo.rb +236 -0
  43. data/lib/tremendous/models/get_fraud_review200_response_fraud_review_related_rewards.rb +305 -0
  44. data/lib/tremendous/models/get_member200_response_member.rb +2 -20
  45. data/lib/tremendous/models/list_campaigns200_response_campaigns_inner_email_style.rb +2 -0
  46. data/lib/tremendous/models/list_campaigns200_response_campaigns_inner_webpage_style.rb +1 -0
  47. data/lib/tremendous/models/list_forex_response.rb +223 -0
  48. data/lib/tremendous/models/list_fraud_reviews200_response.rb +223 -0
  49. data/lib/tremendous/models/{delivery_details_with_link.rb → list_fraud_reviews200_response_fraud_reviews_inner.rb} +26 -51
  50. data/lib/tremendous/models/list_fraud_rules200_response.rb +223 -0
  51. data/lib/tremendous/models/{create_order200_response_order_rewards_inner_delivery.rb → list_fraud_rules200_response_fraud_rules_inner.rb} +28 -63
  52. data/lib/tremendous/models/list_members200_response_members_inner.rb +2 -20
  53. data/lib/tremendous/models/list_rewards200_response_rewards_inner.rb +0 -21
  54. data/lib/tremendous/models/list_rewards200_response_rewards_inner_value.rb +1 -6
  55. data/lib/tremendous/models/list_roles200_response.rb +223 -0
  56. data/lib/tremendous/models/list_roles200_response_roles_inner.rb +275 -0
  57. data/lib/tremendous/models/member.rb +2 -20
  58. data/lib/tremendous/models/member_base.rb +2 -20
  59. data/lib/tremendous/models/member_with_events.rb +2 -20
  60. data/lib/tremendous/models/member_without_events.rb +2 -20
  61. data/lib/tremendous/models/order_without_link_reward.rb +0 -21
  62. data/lib/tremendous/models/public_key.rb +257 -0
  63. data/lib/tremendous/models/public_keys_response.rb +223 -0
  64. data/lib/tremendous/models/public_keys_response_public_keys_inner.rb +257 -0
  65. data/lib/tremendous/models/review_country.rb +276 -0
  66. data/lib/tremendous/models/review_country1.rb +225 -0
  67. data/lib/tremendous/models/review_email.rb +230 -0
  68. data/lib/tremendous/models/review_email1.rb +230 -0
  69. data/lib/tremendous/models/review_ip.rb +225 -0
  70. data/lib/tremendous/models/review_ip1.rb +225 -0
  71. data/lib/tremendous/models/review_redeemed_rewards_amount.rb +293 -0
  72. data/lib/tremendous/models/review_redeemed_rewards_count.rb +293 -0
  73. data/lib/tremendous/models/reward.rb +0 -21
  74. data/lib/tremendous/models/reward_base.rb +0 -21
  75. data/lib/tremendous/models/reward_for_order_create.rb +1 -22
  76. data/lib/tremendous/models/reward_value.rb +1 -6
  77. data/lib/tremendous/models/reward_without_link.rb +0 -21
  78. data/lib/tremendous/models/role.rb +275 -0
  79. data/lib/tremendous/models/{order_for_create.rb → single_reward_order.rb} +6 -12
  80. data/lib/tremendous/models/single_reward_order1.rb +242 -0
  81. data/lib/tremendous/models/{create_order_request_payment.rb → single_reward_order1_payment.rb} +3 -3
  82. data/lib/tremendous/models/{create_order_request_reward.rb → single_reward_order1_reward.rb} +5 -26
  83. data/lib/tremendous/models/{create_order_request_reward_custom_fields_inner.rb → single_reward_order1_reward_custom_fields_inner.rb} +3 -3
  84. data/lib/tremendous/models/{create_order_request_reward_delivery.rb → single_reward_order1_reward_delivery.rb} +3 -3
  85. data/lib/tremendous/models/{order_for_create_reward.rb → single_reward_order_reward.rb} +4 -25
  86. data/lib/tremendous/models/{create_order201_response.rb → single_reward_order_without_link.rb} +4 -4
  87. data/lib/tremendous/models/{order_with_link.rb → single_reward_order_without_link_order.rb} +10 -31
  88. data/lib/tremendous/models/test_public_key.rb +222 -0
  89. data/lib/tremendous/models/test_public_key_request.rb +222 -0
  90. data/lib/tremendous/models/update_campaign.rb +287 -0
  91. data/lib/tremendous/models/update_campaign_request.rb +257 -0
  92. data/lib/tremendous/models/update_fraud_rule_list200_response.rb +222 -0
  93. data/lib/tremendous/models/update_fraud_rule_list_request.rb +272 -0
  94. data/lib/tremendous/models/update_fraud_rule_list_request_config.rb +108 -0
  95. data/lib/tremendous/version.rb +1 -1
  96. data/lib/tremendous.rb +71 -15
  97. metadata +74 -18
  98. data/lib/tremendous/models/create_order200_response_order.rb +0 -400
  99. data/lib/tremendous/models/create_order200_response_order_rewards_inner.rb +0 -347
  100. data/lib/tremendous/models/order_with_link_rewards_inner.rb +0 -406
  101. 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)
@@ -0,0 +1,275 @@
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
+ # Each organization member is assigned a role that defines the permissions they have within the organization.
18
+ class Role
19
+ attr_accessor :id
20
+
21
+ attr_accessor :title
22
+
23
+ attr_accessor :description
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'id' => :'id',
29
+ :'title' => :'title',
30
+ :'description' => :'description'
31
+ }
32
+ end
33
+
34
+ # Returns all the JSON keys this model knows about
35
+ def self.acceptable_attributes
36
+ attribute_map.values
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'id' => :'String',
43
+ :'title' => :'String',
44
+ :'description' => :'String'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::Role` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) { |(k, v), h|
63
+ if (!self.class.attribute_map.key?(k.to_sym))
64
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::Role`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ end
66
+ h[k.to_sym] = v
67
+ }
68
+
69
+ if attributes.key?(:'id')
70
+ self.id = attributes[:'id']
71
+ else
72
+ self.id = nil
73
+ end
74
+
75
+ if attributes.key?(:'title')
76
+ self.title = attributes[:'title']
77
+ else
78
+ self.title = nil
79
+ end
80
+
81
+ if attributes.key?(:'description')
82
+ self.description = attributes[:'description']
83
+ else
84
+ self.description = nil
85
+ end
86
+ end
87
+
88
+ # Show invalid properties with the reasons. Usually used together with valid?
89
+ # @return Array for valid properties with the reasons
90
+ def list_invalid_properties
91
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
92
+ invalid_properties = Array.new
93
+ if @id.nil?
94
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
95
+ end
96
+
97
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
98
+ if @id !~ pattern
99
+ invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
100
+ end
101
+
102
+ if @title.nil?
103
+ invalid_properties.push('invalid value for "title", title cannot be nil.')
104
+ end
105
+
106
+ if @description.nil?
107
+ invalid_properties.push('invalid value for "description", description cannot be nil.')
108
+ end
109
+
110
+ invalid_properties
111
+ end
112
+
113
+ # Check to see if the all the properties in the model are valid
114
+ # @return true if the model is valid
115
+ def valid?
116
+ warn '[DEPRECATED] the `valid?` method is obsolete'
117
+ return false if @id.nil?
118
+ return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/)
119
+ return false if @title.nil?
120
+ return false if @description.nil?
121
+ true
122
+ end
123
+
124
+ # Custom attribute writer method with validation
125
+ # @param [Object] id Value to be assigned
126
+ def id=(id)
127
+ if id.nil?
128
+ fail ArgumentError, 'id cannot be nil'
129
+ end
130
+
131
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
132
+ if id !~ pattern
133
+ fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
134
+ end
135
+
136
+ @id = id
137
+ end
138
+
139
+ # Checks equality by comparing each attribute.
140
+ # @param [Object] Object to be compared
141
+ def ==(o)
142
+ return true if self.equal?(o)
143
+ self.class == o.class &&
144
+ id == o.id &&
145
+ title == o.title &&
146
+ description == o.description
147
+ end
148
+
149
+ # @see the `==` method
150
+ # @param [Object] Object to be compared
151
+ def eql?(o)
152
+ self == o
153
+ end
154
+
155
+ # Calculates hash code according to all attributes.
156
+ # @return [Integer] Hash code
157
+ def hash
158
+ [id, title, description].hash
159
+ end
160
+
161
+ # Builds the object from hash
162
+ # @param [Hash] attributes Model attributes in the form of hash
163
+ # @return [Object] Returns the model itself
164
+ def self.build_from_hash(attributes)
165
+ return nil unless attributes.is_a?(Hash)
166
+ attributes = attributes.transform_keys(&:to_sym)
167
+ transformed_hash = {}
168
+ openapi_types.each_pair do |key, type|
169
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
170
+ transformed_hash["#{key}"] = nil
171
+ elsif type =~ /\AArray<(.*)>/i
172
+ # check to ensure the input is an array given that the attribute
173
+ # is documented as an array but the input is not
174
+ if attributes[attribute_map[key]].is_a?(Array)
175
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
176
+ end
177
+ elsif !attributes[attribute_map[key]].nil?
178
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
179
+ end
180
+ end
181
+ new(transformed_hash)
182
+ end
183
+
184
+ # Deserializes the data based on type
185
+ # @param string type Data type
186
+ # @param string value Value to be deserialized
187
+ # @return [Object] Deserialized data
188
+ def self._deserialize(type, value)
189
+ case type.to_sym
190
+ when :Time
191
+ Time.parse(value)
192
+ when :Date
193
+ Date.parse(value)
194
+ when :String
195
+ value.to_s
196
+ when :Integer
197
+ value.to_i
198
+ when :Float
199
+ value.to_f
200
+ when :Boolean
201
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
202
+ true
203
+ else
204
+ false
205
+ end
206
+ when :Object
207
+ # generic object (usually a Hash), return directly
208
+ value
209
+ when /\AArray<(?<inner_type>.+)>\z/
210
+ inner_type = Regexp.last_match[:inner_type]
211
+ value.map { |v| _deserialize(inner_type, v) }
212
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
213
+ k_type = Regexp.last_match[:k_type]
214
+ v_type = Regexp.last_match[:v_type]
215
+ {}.tap do |hash|
216
+ value.each do |k, v|
217
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
218
+ end
219
+ end
220
+ else # model
221
+ # models (e.g. Pet) or oneOf
222
+ klass = Tremendous.const_get(type)
223
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
224
+ end
225
+ end
226
+
227
+ # Returns the string representation of the object
228
+ # @return [String] String presentation of the object
229
+ def to_s
230
+ to_hash.to_s
231
+ end
232
+
233
+ # to_body is an alias to to_hash (backward compatibility)
234
+ # @return [Hash] Returns the object in the form of hash
235
+ def to_body
236
+ to_hash
237
+ end
238
+
239
+ # Returns the object in the form of hash
240
+ # @return [Hash] Returns the object in the form of hash
241
+ def to_hash
242
+ hash = {}
243
+ self.class.attribute_map.each_pair do |attr, param|
244
+ value = self.send(attr)
245
+ if value.nil?
246
+ is_nullable = self.class.openapi_nullable.include?(attr)
247
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
248
+ end
249
+
250
+ hash[param] = _to_hash(value)
251
+ end
252
+ hash
253
+ end
254
+
255
+ # Outputs non-array value in the form of hash
256
+ # For object, use to_hash. Otherwise, just return the value
257
+ # @param [Object] value Any valid value
258
+ # @return [Hash] Returns the value in the form of hash
259
+ def _to_hash(value)
260
+ if value.is_a?(Array)
261
+ value.compact.map { |v| _to_hash(v) }
262
+ elsif value.is_a?(Hash)
263
+ {}.tap do |hash|
264
+ value.each { |k, v| hash[k] = _to_hash(v) }
265
+ end
266
+ elsif value.respond_to? :to_hash
267
+ value.to_hash
268
+ else
269
+ value
270
+ end
271
+ end
272
+
273
+ end
274
+
275
+ end
@@ -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