tremendous_ruby 5.0.0 → 5.0.1

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 (141) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tremendous/api/tremendous_api.rb +2365 -0
  3. data/lib/tremendous/api_client.rb +431 -0
  4. data/lib/tremendous/api_error.rb +58 -0
  5. data/lib/tremendous/configuration.rb +389 -0
  6. data/lib/tremendous/models/balance_transaction.rb +256 -0
  7. data/lib/tremendous/models/campaign.rb +292 -0
  8. data/lib/tremendous/models/create_api_key200_response.rb +215 -0
  9. data/lib/tremendous/models/create_invoice.rb +244 -0
  10. data/lib/tremendous/models/create_invoice200_response.rb +221 -0
  11. data/lib/tremendous/models/create_invoice_request.rb +244 -0
  12. data/lib/tremendous/models/create_member.rb +290 -0
  13. data/lib/tremendous/models/create_member200_response.rb +221 -0
  14. data/lib/tremendous/models/create_member_request.rb +290 -0
  15. data/lib/tremendous/models/create_order200_response.rb +221 -0
  16. data/lib/tremendous/models/create_order200_response_order.rb +400 -0
  17. data/lib/tremendous/models/create_order200_response_order_rewards_inner.rb +347 -0
  18. data/lib/tremendous/models/create_order200_response_order_rewards_inner_delivery.rb +296 -0
  19. data/lib/tremendous/models/create_order201_response.rb +221 -0
  20. data/lib/tremendous/models/create_order_request.rb +248 -0
  21. data/lib/tremendous/models/create_order_request_payment.rb +222 -0
  22. data/lib/tremendous/models/create_order_request_reward.rb +344 -0
  23. data/lib/tremendous/models/create_order_request_reward_delivery.rb +250 -0
  24. data/lib/tremendous/models/create_organization.rb +268 -0
  25. data/lib/tremendous/models/create_organization200_response.rb +214 -0
  26. data/lib/tremendous/models/create_organization200_response_organization.rb +334 -0
  27. data/lib/tremendous/models/create_organization_request.rb +268 -0
  28. data/lib/tremendous/models/create_organization_request_copy_settings.rb +278 -0
  29. data/lib/tremendous/models/create_webhook200_response.rb +214 -0
  30. data/lib/tremendous/models/create_webhook_request.rb +222 -0
  31. data/lib/tremendous/models/currency_codes.rb +154 -0
  32. data/lib/tremendous/models/custom_field.rb +248 -0
  33. data/lib/tremendous/models/delivery_details.rb +286 -0
  34. data/lib/tremendous/models/delivery_details_with_link.rb +296 -0
  35. data/lib/tremendous/models/delivery_method.rb +41 -0
  36. data/lib/tremendous/models/delivery_status.rb +42 -0
  37. data/lib/tremendous/models/error_model.rb +221 -0
  38. data/lib/tremendous/models/field.rb +286 -0
  39. data/lib/tremendous/models/funding_source.rb +332 -0
  40. data/lib/tremendous/models/generate_reward_link200_response.rb +221 -0
  41. data/lib/tremendous/models/generate_reward_link200_response_reward.rb +247 -0
  42. data/lib/tremendous/models/generate_reward_link403_response.rb +221 -0
  43. data/lib/tremendous/models/generate_reward_token200_response.rb +221 -0
  44. data/lib/tremendous/models/generate_reward_token200_response_reward.rb +257 -0
  45. data/lib/tremendous/models/get_campaign200_response.rb +221 -0
  46. data/lib/tremendous/models/get_funding_source200_response.rb +221 -0
  47. data/lib/tremendous/models/get_member200_response.rb +221 -0
  48. data/lib/tremendous/models/get_member200_response_member.rb +365 -0
  49. data/lib/tremendous/models/get_member200_response_member_events_inner.rb +260 -0
  50. data/lib/tremendous/models/get_organization200_response.rb +214 -0
  51. data/lib/tremendous/models/get_product200_response.rb +221 -0
  52. data/lib/tremendous/models/get_product_response.rb +221 -0
  53. data/lib/tremendous/models/get_reward200_response.rb +221 -0
  54. data/lib/tremendous/models/invoice.rb +356 -0
  55. data/lib/tremendous/models/list_balance_transactions200_response.rb +216 -0
  56. data/lib/tremendous/models/list_balance_transactions200_response_invoices_inner.rb +256 -0
  57. data/lib/tremendous/models/list_campaigns200_response.rb +223 -0
  58. data/lib/tremendous/models/list_campaigns200_response_campaigns_inner.rb +292 -0
  59. data/lib/tremendous/models/list_fields200_response.rb +216 -0
  60. data/lib/tremendous/models/list_fields200_response_fields_inner.rb +286 -0
  61. data/lib/tremendous/models/list_funding_sources200_response.rb +223 -0
  62. data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner.rb +332 -0
  63. data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb +436 -0
  64. data/lib/tremendous/models/list_invoices200_response.rb +240 -0
  65. data/lib/tremendous/models/list_invoices200_response_invoices_inner.rb +356 -0
  66. data/lib/tremendous/models/list_members200_response.rb +223 -0
  67. data/lib/tremendous/models/list_members200_response_members_inner.rb +374 -0
  68. data/lib/tremendous/models/list_orders200_response.rb +240 -0
  69. data/lib/tremendous/models/list_orders200_response_orders_inner.rb +379 -0
  70. data/lib/tremendous/models/list_orders200_response_orders_inner_payment.rb +346 -0
  71. data/lib/tremendous/models/list_orders200_response_orders_inner_payment_refund.rb +242 -0
  72. data/lib/tremendous/models/list_organizations200_response.rb +216 -0
  73. data/lib/tremendous/models/list_organizations200_response_organizations_inner.rb +324 -0
  74. data/lib/tremendous/models/list_products200_response.rb +223 -0
  75. data/lib/tremendous/models/list_products200_response_products_inner.rb +457 -0
  76. data/lib/tremendous/models/list_products200_response_products_inner_countries_inner.rb +222 -0
  77. data/lib/tremendous/models/list_products200_response_products_inner_images_inner.rb +273 -0
  78. data/lib/tremendous/models/list_products200_response_products_inner_skus_inner.rb +277 -0
  79. data/lib/tremendous/models/list_products_response.rb +223 -0
  80. data/lib/tremendous/models/list_products_response_products_inner.rb +457 -0
  81. data/lib/tremendous/models/list_products_response_products_inner_countries_inner.rb +222 -0
  82. data/lib/tremendous/models/list_products_response_products_inner_images_inner.rb +273 -0
  83. data/lib/tremendous/models/list_products_response_products_inner_skus_inner.rb +277 -0
  84. data/lib/tremendous/models/list_rewards200_response.rb +226 -0
  85. data/lib/tremendous/models/list_rewards200_response_rewards_inner.rb +347 -0
  86. data/lib/tremendous/models/list_rewards200_response_rewards_inner_custom_fields_inner.rb +248 -0
  87. data/lib/tremendous/models/list_rewards200_response_rewards_inner_delivery.rb +286 -0
  88. data/lib/tremendous/models/list_rewards200_response_rewards_inner_recipient.rb +236 -0
  89. data/lib/tremendous/models/list_rewards200_response_rewards_inner_value.rb +273 -0
  90. data/lib/tremendous/models/list_rewards401_response.rb +221 -0
  91. data/lib/tremendous/models/list_rewards401_response_errors.rb +225 -0
  92. data/lib/tremendous/models/list_rewards429_response.rb +221 -0
  93. data/lib/tremendous/models/list_webhook_events200_response.rb +216 -0
  94. data/lib/tremendous/models/list_webhooks200_response.rb +216 -0
  95. data/lib/tremendous/models/list_webhooks200_response_webhooks_inner.rb +258 -0
  96. data/lib/tremendous/models/member.rb +374 -0
  97. data/lib/tremendous/models/member_base.rb +353 -0
  98. data/lib/tremendous/models/member_with_events.rb +365 -0
  99. data/lib/tremendous/models/member_without_events.rb +374 -0
  100. data/lib/tremendous/models/order.rb +379 -0
  101. data/lib/tremendous/models/order_base.rb +370 -0
  102. data/lib/tremendous/models/order_base_payment.rb +346 -0
  103. data/lib/tremendous/models/order_for_create.rb +248 -0
  104. data/lib/tremendous/models/order_for_create_reward.rb +416 -0
  105. data/lib/tremendous/models/order_status.rb +44 -0
  106. data/lib/tremendous/models/order_with_link.rb +400 -0
  107. data/lib/tremendous/models/order_with_link_rewards_inner.rb +406 -0
  108. data/lib/tremendous/models/order_without_link.rb +379 -0
  109. data/lib/tremendous/models/order_without_link_reward.rb +406 -0
  110. data/lib/tremendous/models/organization.rb +324 -0
  111. data/lib/tremendous/models/payment_details.rb +345 -0
  112. data/lib/tremendous/models/payment_details_refund.rb +242 -0
  113. data/lib/tremendous/models/product.rb +457 -0
  114. data/lib/tremendous/models/recipient.rb +236 -0
  115. data/lib/tremendous/models/refund_details.rb +241 -0
  116. data/lib/tremendous/models/resend_reward422_response.rb +221 -0
  117. data/lib/tremendous/models/reward.rb +406 -0
  118. data/lib/tremendous/models/reward_base.rb +397 -0
  119. data/lib/tremendous/models/reward_base_custom_fields_inner.rb +248 -0
  120. data/lib/tremendous/models/reward_for_order_create.rb +416 -0
  121. data/lib/tremendous/models/reward_link.rb +247 -0
  122. data/lib/tremendous/models/reward_token.rb +257 -0
  123. data/lib/tremendous/models/reward_value.rb +273 -0
  124. data/lib/tremendous/models/reward_with_link.rb +406 -0
  125. data/lib/tremendous/models/reward_with_link_delivery.rb +296 -0
  126. data/lib/tremendous/models/reward_without_link.rb +406 -0
  127. data/lib/tremendous/models/reward_without_link_delivery.rb +286 -0
  128. data/lib/tremendous/models/simulate_webhook_request.rb +222 -0
  129. data/lib/tremendous/models/webhook.rb +258 -0
  130. data/lib/tremendous/models/webhook_post.rb +222 -0
  131. data/lib/tremendous/version.rb +3 -0
  132. data/lib/tremendous.rb +159 -0
  133. metadata +133 -10
  134. data/spec/integration/campaigns_spec.rb +0 -27
  135. data/spec/integration/funding_sources_spec.rb +0 -18
  136. data/spec/integration/invoices_spec.rb +0 -19
  137. data/spec/integration/members_spec.rb +0 -19
  138. data/spec/integration/orders_spec.rb +0 -53
  139. data/spec/integration/products_spec.rb +0 -26
  140. data/spec/spec_helper.rb +0 -111
  141. data/spec/support/setup.rb +0 -10
@@ -0,0 +1,296 @@
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
+ # Details on how the reward is delivered to the recipient.
18
+ class DeliveryDetailsWithLink
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
+ attr_accessor :method
21
+
22
+ # Current status of the delivery of the reward: * `SCHEDULED` - Reward is scheduled for delivery and will be delivered soon. * `FAILED` - Delivery of reward failed (e.g. email bounced). * `SUCCEEDED` - Reward was successfully delivered (email or text message delivered or reward link opened). * `PENDING` - Delivery is pending but not yet scheduled.
23
+ attr_accessor :status
24
+
25
+ # Link to redeem the reward at. You need to deliver this link to the recipient. Only available for rewards for which the `method` for delivery is set to `LINK`.
26
+ attr_accessor :link
27
+
28
+ class EnumAttributeValidator
29
+ attr_reader :datatype
30
+ attr_reader :allowable_values
31
+
32
+ def initialize(datatype, allowable_values)
33
+ @allowable_values = allowable_values.map do |value|
34
+ case datatype.to_s
35
+ when /Integer/i
36
+ value.to_i
37
+ when /Float/i
38
+ value.to_f
39
+ else
40
+ value
41
+ end
42
+ end
43
+ end
44
+
45
+ def valid?(value)
46
+ !value || allowable_values.include?(value)
47
+ end
48
+ end
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'method' => :'method',
54
+ :'status' => :'status',
55
+ :'link' => :'link'
56
+ }
57
+ end
58
+
59
+ # Returns all the JSON keys this model knows about
60
+ def self.acceptable_attributes
61
+ attribute_map.values
62
+ end
63
+
64
+ # Attribute type mapping.
65
+ def self.openapi_types
66
+ {
67
+ :'method' => :'String',
68
+ :'status' => :'String',
69
+ :'link' => :'String'
70
+ }
71
+ end
72
+
73
+ # List of attributes with nullable: true
74
+ def self.openapi_nullable
75
+ Set.new([
76
+ ])
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ if (!attributes.is_a?(Hash))
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::DeliveryDetailsWithLink` initialize method"
84
+ end
85
+
86
+ # check to see if the attribute exists and convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!self.class.attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::DeliveryDetailsWithLink`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'method')
95
+ self.method = attributes[:'method']
96
+ else
97
+ self.method = nil
98
+ end
99
+
100
+ if attributes.key?(:'status')
101
+ self.status = attributes[:'status']
102
+ else
103
+ self.status = nil
104
+ end
105
+
106
+ if attributes.key?(:'link')
107
+ self.link = attributes[:'link']
108
+ end
109
+ end
110
+
111
+ # Show invalid properties with the reasons. Usually used together with valid?
112
+ # @return Array for valid properties with the reasons
113
+ def list_invalid_properties
114
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
115
+ invalid_properties = Array.new
116
+ if @method.nil?
117
+ invalid_properties.push('invalid value for "method", method cannot be nil.')
118
+ end
119
+
120
+ if @status.nil?
121
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
122
+ end
123
+
124
+ invalid_properties
125
+ end
126
+
127
+ # Check to see if the all the properties in the model are valid
128
+ # @return true if the model is valid
129
+ def valid?
130
+ warn '[DEPRECATED] the `valid?` method is obsolete'
131
+ return false if @method.nil?
132
+ method_validator = EnumAttributeValidator.new('String', ["EMAIL", "LINK", "PHONE"])
133
+ return false unless method_validator.valid?(@method)
134
+ return false if @status.nil?
135
+ status_validator = EnumAttributeValidator.new('String', ["SCHEDULED", "FAILED", "SUCCEEDED", "PENDING"])
136
+ return false unless status_validator.valid?(@status)
137
+ true
138
+ end
139
+
140
+ # Custom attribute writer method checking allowed values (enum).
141
+ # @param [Object] method Object to be assigned
142
+ def method=(method)
143
+ validator = EnumAttributeValidator.new('String', ["EMAIL", "LINK", "PHONE"])
144
+ unless validator.valid?(method)
145
+ fail ArgumentError, "invalid value for \"method\", must be one of #{validator.allowable_values}."
146
+ end
147
+ @method = method
148
+ end
149
+
150
+ # Custom attribute writer method checking allowed values (enum).
151
+ # @param [Object] status Object to be assigned
152
+ def status=(status)
153
+ validator = EnumAttributeValidator.new('String', ["SCHEDULED", "FAILED", "SUCCEEDED", "PENDING"])
154
+ unless validator.valid?(status)
155
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
156
+ end
157
+ @status = status
158
+ end
159
+
160
+ # Checks equality by comparing each attribute.
161
+ # @param [Object] Object to be compared
162
+ def ==(o)
163
+ return true if self.equal?(o)
164
+ self.class == o.class &&
165
+ method == o.method &&
166
+ status == o.status &&
167
+ link == o.link
168
+ end
169
+
170
+ # @see the `==` method
171
+ # @param [Object] Object to be compared
172
+ def eql?(o)
173
+ self == o
174
+ end
175
+
176
+ # Calculates hash code according to all attributes.
177
+ # @return [Integer] Hash code
178
+ def hash
179
+ [method, status, link].hash
180
+ end
181
+
182
+ # Builds the object from hash
183
+ # @param [Hash] attributes Model attributes in the form of hash
184
+ # @return [Object] Returns the model itself
185
+ def self.build_from_hash(attributes)
186
+ return nil unless attributes.is_a?(Hash)
187
+ attributes = attributes.transform_keys(&:to_sym)
188
+ transformed_hash = {}
189
+ openapi_types.each_pair do |key, type|
190
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
191
+ transformed_hash["#{key}"] = nil
192
+ elsif type =~ /\AArray<(.*)>/i
193
+ # check to ensure the input is an array given that the attribute
194
+ # is documented as an array but the input is not
195
+ if attributes[attribute_map[key]].is_a?(Array)
196
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
197
+ end
198
+ elsif !attributes[attribute_map[key]].nil?
199
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
200
+ end
201
+ end
202
+ new(transformed_hash)
203
+ end
204
+
205
+ # Deserializes the data based on type
206
+ # @param string type Data type
207
+ # @param string value Value to be deserialized
208
+ # @return [Object] Deserialized data
209
+ def self._deserialize(type, value)
210
+ case type.to_sym
211
+ when :Time
212
+ Time.parse(value)
213
+ when :Date
214
+ Date.parse(value)
215
+ when :String
216
+ value.to_s
217
+ when :Integer
218
+ value.to_i
219
+ when :Float
220
+ value.to_f
221
+ when :Boolean
222
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
223
+ true
224
+ else
225
+ false
226
+ end
227
+ when :Object
228
+ # generic object (usually a Hash), return directly
229
+ value
230
+ when /\AArray<(?<inner_type>.+)>\z/
231
+ inner_type = Regexp.last_match[:inner_type]
232
+ value.map { |v| _deserialize(inner_type, v) }
233
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
234
+ k_type = Regexp.last_match[:k_type]
235
+ v_type = Regexp.last_match[:v_type]
236
+ {}.tap do |hash|
237
+ value.each do |k, v|
238
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
239
+ end
240
+ end
241
+ else # model
242
+ # models (e.g. Pet) or oneOf
243
+ klass = Tremendous.const_get(type)
244
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
245
+ end
246
+ end
247
+
248
+ # Returns the string representation of the object
249
+ # @return [String] String presentation of the object
250
+ def to_s
251
+ to_hash.to_s
252
+ end
253
+
254
+ # to_body is an alias to to_hash (backward compatibility)
255
+ # @return [Hash] Returns the object in the form of hash
256
+ def to_body
257
+ to_hash
258
+ end
259
+
260
+ # Returns the object in the form of hash
261
+ # @return [Hash] Returns the object in the form of hash
262
+ def to_hash
263
+ hash = {}
264
+ self.class.attribute_map.each_pair do |attr, param|
265
+ value = self.send(attr)
266
+ if value.nil?
267
+ is_nullable = self.class.openapi_nullable.include?(attr)
268
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
269
+ end
270
+
271
+ hash[param] = _to_hash(value)
272
+ end
273
+ hash
274
+ end
275
+
276
+ # Outputs non-array value in the form of hash
277
+ # For object, use to_hash. Otherwise, just return the value
278
+ # @param [Object] value Any valid value
279
+ # @return [Hash] Returns the value in the form of hash
280
+ def _to_hash(value)
281
+ if value.is_a?(Array)
282
+ value.compact.map { |v| _to_hash(v) }
283
+ elsif value.is_a?(Hash)
284
+ {}.tap do |hash|
285
+ value.each { |k, v| hash[k] = _to_hash(v) }
286
+ end
287
+ elsif value.respond_to? :to_hash
288
+ value.to_hash
289
+ else
290
+ value
291
+ end
292
+ end
293
+
294
+ end
295
+
296
+ end
@@ -0,0 +1,41 @@
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
+ class DeliveryMethod
18
+ EMAIL = "EMAIL".freeze
19
+ LINK = "LINK".freeze
20
+ PHONE = "PHONE".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [EMAIL, LINK, PHONE].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ return value if DeliveryMethod.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #DeliveryMethod"
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,42 @@
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
+ class DeliveryStatus
18
+ SCHEDULED = "SCHEDULED".freeze
19
+ FAILED = "FAILED".freeze
20
+ SUCCEEDED = "SUCCEEDED".freeze
21
+ PENDING = "PENDING".freeze
22
+
23
+ def self.all_vars
24
+ @all_vars ||= [SCHEDULED, FAILED, SUCCEEDED, PENDING].freeze
25
+ end
26
+
27
+ # Builds the enum from string
28
+ # @param [String] The enum value in the form of the string
29
+ # @return [String] The enum value
30
+ def self.build_from_hash(value)
31
+ new.build_from_hash(value)
32
+ end
33
+
34
+ # Builds the enum from string
35
+ # @param [String] The enum value in the form of the string
36
+ # @return [String] The enum value
37
+ def build_from_hash(value)
38
+ return value if DeliveryStatus.all_vars.include?(value)
39
+ raise "Invalid ENUM value #{value} for class #DeliveryStatus"
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,221 @@
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
+ class ErrorModel
18
+ attr_accessor :errors
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'errors' => :'errors'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'errors' => :'ListRewards401ResponseErrors'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ErrorModel` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::ErrorModel`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'errors')
61
+ self.errors = attributes[:'errors']
62
+ else
63
+ self.errors = nil
64
+ end
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properties with the reasons
69
+ def list_invalid_properties
70
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
71
+ invalid_properties = Array.new
72
+ if @errors.nil?
73
+ invalid_properties.push('invalid value for "errors", errors cannot be nil.')
74
+ end
75
+
76
+ invalid_properties
77
+ end
78
+
79
+ # Check to see if the all the properties in the model are valid
80
+ # @return true if the model is valid
81
+ def valid?
82
+ warn '[DEPRECATED] the `valid?` method is obsolete'
83
+ return false if @errors.nil?
84
+ true
85
+ end
86
+
87
+ # Checks equality by comparing each attribute.
88
+ # @param [Object] Object to be compared
89
+ def ==(o)
90
+ return true if self.equal?(o)
91
+ self.class == o.class &&
92
+ errors == o.errors
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [errors].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ return nil unless attributes.is_a?(Hash)
112
+ attributes = attributes.transform_keys(&:to_sym)
113
+ transformed_hash = {}
114
+ openapi_types.each_pair do |key, type|
115
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
116
+ transformed_hash["#{key}"] = nil
117
+ elsif type =~ /\AArray<(.*)>/i
118
+ # check to ensure the input is an array given that the attribute
119
+ # is documented as an array but the input is not
120
+ if attributes[attribute_map[key]].is_a?(Array)
121
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
122
+ end
123
+ elsif !attributes[attribute_map[key]].nil?
124
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
125
+ end
126
+ end
127
+ new(transformed_hash)
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def self._deserialize(type, value)
135
+ case type.to_sym
136
+ when :Time
137
+ Time.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ # models (e.g. Pet) or oneOf
168
+ klass = Tremendous.const_get(type)
169
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
170
+ end
171
+ end
172
+
173
+ # Returns the string representation of the object
174
+ # @return [String] String presentation of the object
175
+ def to_s
176
+ to_hash.to_s
177
+ end
178
+
179
+ # to_body is an alias to to_hash (backward compatibility)
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_body
182
+ to_hash
183
+ end
184
+
185
+ # Returns the object in the form of hash
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_hash
188
+ hash = {}
189
+ self.class.attribute_map.each_pair do |attr, param|
190
+ value = self.send(attr)
191
+ if value.nil?
192
+ is_nullable = self.class.openapi_nullable.include?(attr)
193
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
194
+ end
195
+
196
+ hash[param] = _to_hash(value)
197
+ end
198
+ hash
199
+ end
200
+
201
+ # Outputs non-array value in the form of hash
202
+ # For object, use to_hash. Otherwise, just return the value
203
+ # @param [Object] value Any valid value
204
+ # @return [Hash] Returns the value in the form of hash
205
+ def _to_hash(value)
206
+ if value.is_a?(Array)
207
+ value.compact.map { |v| _to_hash(v) }
208
+ elsif value.is_a?(Hash)
209
+ {}.tap do |hash|
210
+ value.each { |k, v| hash[k] = _to_hash(v) }
211
+ end
212
+ elsif value.respond_to? :to_hash
213
+ value.to_hash
214
+ else
215
+ value
216
+ end
217
+ end
218
+
219
+ end
220
+
221
+ end