tremendous_ruby 5.0.0 → 5.1.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 (139) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tremendous/api/tremendous_api.rb +2508 -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 +303 -0
  8. data/lib/tremendous/models/create_api_key200_response.rb +215 -0
  9. data/lib/tremendous/models/create_campaign201_response.rb +221 -0
  10. data/lib/tremendous/models/create_campaign_request.rb +273 -0
  11. data/lib/tremendous/models/create_invoice.rb +244 -0
  12. data/lib/tremendous/models/create_invoice200_response.rb +221 -0
  13. data/lib/tremendous/models/create_invoice_request.rb +244 -0
  14. data/lib/tremendous/models/create_member.rb +273 -0
  15. data/lib/tremendous/models/create_member200_response.rb +221 -0
  16. data/lib/tremendous/models/create_member_request.rb +273 -0
  17. data/lib/tremendous/models/create_order200_response.rb +221 -0
  18. data/lib/tremendous/models/create_order200_response_order.rb +400 -0
  19. data/lib/tremendous/models/create_order200_response_order_rewards_inner.rb +347 -0
  20. data/lib/tremendous/models/create_order200_response_order_rewards_inner_delivery.rb +296 -0
  21. data/lib/tremendous/models/create_order201_response.rb +221 -0
  22. data/lib/tremendous/models/create_order_request.rb +248 -0
  23. data/lib/tremendous/models/create_order_request_payment.rb +222 -0
  24. data/lib/tremendous/models/create_order_request_reward.rb +344 -0
  25. data/lib/tremendous/models/create_order_request_reward_custom_fields_inner.rb +248 -0
  26. data/lib/tremendous/models/create_order_request_reward_delivery.rb +250 -0
  27. data/lib/tremendous/models/create_organization.rb +268 -0
  28. data/lib/tremendous/models/create_organization200_response.rb +214 -0
  29. data/lib/tremendous/models/create_organization200_response_organization.rb +334 -0
  30. data/lib/tremendous/models/create_organization_request.rb +268 -0
  31. data/lib/tremendous/models/create_organization_request_copy_settings.rb +290 -0
  32. data/lib/tremendous/models/create_webhook200_response.rb +214 -0
  33. data/lib/tremendous/models/create_webhook_request.rb +222 -0
  34. data/lib/tremendous/models/currency_codes.rb +154 -0
  35. data/lib/tremendous/models/custom_field.rb +258 -0
  36. data/lib/tremendous/models/delivery_details.rb +286 -0
  37. data/lib/tremendous/models/delivery_details_with_link.rb +296 -0
  38. data/lib/tremendous/models/delivery_method.rb +41 -0
  39. data/lib/tremendous/models/delivery_status.rb +42 -0
  40. data/lib/tremendous/models/error_model.rb +221 -0
  41. data/lib/tremendous/models/field.rb +286 -0
  42. data/lib/tremendous/models/funding_source.rb +332 -0
  43. data/lib/tremendous/models/generate_reward_link200_response.rb +221 -0
  44. data/lib/tremendous/models/generate_reward_link200_response_reward.rb +247 -0
  45. data/lib/tremendous/models/generate_reward_link403_response.rb +221 -0
  46. data/lib/tremendous/models/generate_reward_token200_response.rb +221 -0
  47. data/lib/tremendous/models/generate_reward_token200_response_reward.rb +257 -0
  48. data/lib/tremendous/models/get_funding_source200_response.rb +221 -0
  49. data/lib/tremendous/models/get_member200_response.rb +221 -0
  50. data/lib/tremendous/models/get_member200_response_member.rb +375 -0
  51. data/lib/tremendous/models/get_member200_response_member_events_inner.rb +260 -0
  52. data/lib/tremendous/models/get_organization200_response.rb +214 -0
  53. data/lib/tremendous/models/get_product_response.rb +221 -0
  54. data/lib/tremendous/models/get_reward200_response.rb +221 -0
  55. data/lib/tremendous/models/invoice.rb +356 -0
  56. data/lib/tremendous/models/list_balance_transactions200_response.rb +216 -0
  57. data/lib/tremendous/models/list_balance_transactions200_response_invoices_inner.rb +256 -0
  58. data/lib/tremendous/models/list_campaigns200_response.rb +223 -0
  59. data/lib/tremendous/models/list_campaigns200_response_campaigns_inner.rb +303 -0
  60. data/lib/tremendous/models/list_campaigns200_response_campaigns_inner_email_style.rb +270 -0
  61. data/lib/tremendous/models/list_campaigns200_response_campaigns_inner_webpage_style.rb +270 -0
  62. data/lib/tremendous/models/list_fields200_response.rb +216 -0
  63. data/lib/tremendous/models/list_fields200_response_fields_inner.rb +286 -0
  64. data/lib/tremendous/models/list_funding_sources200_response.rb +223 -0
  65. data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner.rb +332 -0
  66. data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb +436 -0
  67. data/lib/tremendous/models/list_invoices200_response.rb +240 -0
  68. data/lib/tremendous/models/list_invoices200_response_invoices_inner.rb +356 -0
  69. data/lib/tremendous/models/list_members200_response.rb +223 -0
  70. data/lib/tremendous/models/list_members200_response_members_inner.rb +384 -0
  71. data/lib/tremendous/models/list_orders200_response.rb +240 -0
  72. data/lib/tremendous/models/list_orders200_response_orders_inner.rb +379 -0
  73. data/lib/tremendous/models/list_orders200_response_orders_inner_payment.rb +346 -0
  74. data/lib/tremendous/models/list_orders200_response_orders_inner_payment_refund.rb +242 -0
  75. data/lib/tremendous/models/list_organizations200_response.rb +216 -0
  76. data/lib/tremendous/models/list_organizations200_response_organizations_inner.rb +324 -0
  77. data/lib/tremendous/models/list_products_response.rb +223 -0
  78. data/lib/tremendous/models/list_products_response_products_inner.rb +457 -0
  79. data/lib/tremendous/models/list_products_response_products_inner_countries_inner.rb +222 -0
  80. data/lib/tremendous/models/list_products_response_products_inner_images_inner.rb +273 -0
  81. data/lib/tremendous/models/list_products_response_products_inner_skus_inner.rb +277 -0
  82. data/lib/tremendous/models/list_rewards200_response.rb +226 -0
  83. data/lib/tremendous/models/list_rewards200_response_rewards_inner.rb +347 -0
  84. data/lib/tremendous/models/list_rewards200_response_rewards_inner_custom_fields_inner.rb +258 -0
  85. data/lib/tremendous/models/list_rewards200_response_rewards_inner_delivery.rb +286 -0
  86. data/lib/tremendous/models/list_rewards200_response_rewards_inner_recipient.rb +236 -0
  87. data/lib/tremendous/models/list_rewards200_response_rewards_inner_value.rb +273 -0
  88. data/lib/tremendous/models/list_rewards401_response.rb +221 -0
  89. data/lib/tremendous/models/list_rewards401_response_errors.rb +225 -0
  90. data/lib/tremendous/models/list_rewards429_response.rb +221 -0
  91. data/lib/tremendous/models/list_webhook_events200_response.rb +216 -0
  92. data/lib/tremendous/models/list_webhooks200_response.rb +216 -0
  93. data/lib/tremendous/models/list_webhooks200_response_webhooks_inner.rb +258 -0
  94. data/lib/tremendous/models/member.rb +384 -0
  95. data/lib/tremendous/models/member_base.rb +363 -0
  96. data/lib/tremendous/models/member_with_events.rb +375 -0
  97. data/lib/tremendous/models/member_without_events.rb +384 -0
  98. data/lib/tremendous/models/order.rb +379 -0
  99. data/lib/tremendous/models/order_base.rb +370 -0
  100. data/lib/tremendous/models/order_base_payment.rb +346 -0
  101. data/lib/tremendous/models/order_for_create.rb +248 -0
  102. data/lib/tremendous/models/order_for_create_reward.rb +416 -0
  103. data/lib/tremendous/models/order_status.rb +44 -0
  104. data/lib/tremendous/models/order_with_link.rb +400 -0
  105. data/lib/tremendous/models/order_with_link_rewards_inner.rb +406 -0
  106. data/lib/tremendous/models/order_without_link.rb +379 -0
  107. data/lib/tremendous/models/order_without_link_reward.rb +406 -0
  108. data/lib/tremendous/models/organization.rb +324 -0
  109. data/lib/tremendous/models/payment_details.rb +345 -0
  110. data/lib/tremendous/models/payment_details_refund.rb +242 -0
  111. data/lib/tremendous/models/product.rb +457 -0
  112. data/lib/tremendous/models/recipient.rb +236 -0
  113. data/lib/tremendous/models/refund_details.rb +241 -0
  114. data/lib/tremendous/models/resend_reward422_response.rb +221 -0
  115. data/lib/tremendous/models/reward.rb +406 -0
  116. data/lib/tremendous/models/reward_base.rb +397 -0
  117. data/lib/tremendous/models/reward_base_custom_fields_inner.rb +258 -0
  118. data/lib/tremendous/models/reward_for_order_create.rb +416 -0
  119. data/lib/tremendous/models/reward_link.rb +247 -0
  120. data/lib/tremendous/models/reward_token.rb +257 -0
  121. data/lib/tremendous/models/reward_value.rb +273 -0
  122. data/lib/tremendous/models/reward_with_link.rb +406 -0
  123. data/lib/tremendous/models/reward_with_link_delivery.rb +296 -0
  124. data/lib/tremendous/models/reward_without_link.rb +406 -0
  125. data/lib/tremendous/models/reward_without_link_delivery.rb +286 -0
  126. data/lib/tremendous/models/simulate_webhook_request.rb +222 -0
  127. data/lib/tremendous/models/webhook.rb +258 -0
  128. data/lib/tremendous/models/webhook_post.rb +222 -0
  129. data/lib/tremendous/version.rb +3 -0
  130. data/lib/tremendous.rb +163 -0
  131. metadata +132 -11
  132. data/spec/integration/campaigns_spec.rb +0 -27
  133. data/spec/integration/funding_sources_spec.rb +0 -18
  134. data/spec/integration/invoices_spec.rb +0 -19
  135. data/spec/integration/members_spec.rb +0 -19
  136. data/spec/integration/orders_spec.rb +0 -53
  137. data/spec/integration/products_spec.rb +0 -26
  138. data/spec/spec_helper.rb +0 -111
  139. data/spec/support/setup.rb +0 -10
@@ -0,0 +1,363 @@
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 has one or more users that can access and manage that organization. These users are called members. Members can take actions via the Tremendous web dashboard directly. These actions include adding funding sources to the organization, creating Campaigns, and more.
18
+ class MemberBase
19
+ attr_accessor :id
20
+
21
+ # Email address of the member
22
+ attr_accessor :email
23
+
24
+ # Full name of the member
25
+ attr_accessor :name
26
+
27
+ # Is this member currently active in the organization. If `false`, the member will not be able to access the organization.
28
+ attr_accessor :active
29
+
30
+ # Role of the member within the organization. <table> <thead> <tr> <th>Role</th> <th>Description</th> </tr> </thead> <tr> <td><code>MEMBER</code></td> <td>Limited permissions. Can view their own reward and order histories only.</td> </tr> <tr> <td><code>ADMIN</code></td> <td>Update organization settings, invite other members to the organization, and view all member order and reward histories within their organization.</td> </tr> <tbody> </tbody> </table>
31
+ attr_accessor :role
32
+
33
+ # Current status of the member's account. When creating a member it starts out in the status `INVITED`. As soon as that member open the invitation link and registers an account, the status switches to `REGISTERED`.
34
+ attr_accessor :status
35
+
36
+ class EnumAttributeValidator
37
+ attr_reader :datatype
38
+ attr_reader :allowable_values
39
+
40
+ def initialize(datatype, allowable_values)
41
+ @allowable_values = allowable_values.map do |value|
42
+ case datatype.to_s
43
+ when /Integer/i
44
+ value.to_i
45
+ when /Float/i
46
+ value.to_f
47
+ else
48
+ value
49
+ end
50
+ end
51
+ end
52
+
53
+ def valid?(value)
54
+ !value || allowable_values.include?(value)
55
+ end
56
+ end
57
+
58
+ # Attribute mapping from ruby-style variable name to JSON key.
59
+ def self.attribute_map
60
+ {
61
+ :'id' => :'id',
62
+ :'email' => :'email',
63
+ :'name' => :'name',
64
+ :'active' => :'active',
65
+ :'role' => :'role',
66
+ :'status' => :'status'
67
+ }
68
+ end
69
+
70
+ # Returns all the JSON keys this model knows about
71
+ def self.acceptable_attributes
72
+ attribute_map.values
73
+ end
74
+
75
+ # Attribute type mapping.
76
+ def self.openapi_types
77
+ {
78
+ :'id' => :'String',
79
+ :'email' => :'String',
80
+ :'name' => :'String',
81
+ :'active' => :'Boolean',
82
+ :'role' => :'String',
83
+ :'status' => :'String'
84
+ }
85
+ end
86
+
87
+ # List of attributes with nullable: true
88
+ def self.openapi_nullable
89
+ Set.new([
90
+ :'name',
91
+ ])
92
+ end
93
+
94
+ # Initializes the object
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ def initialize(attributes = {})
97
+ if (!attributes.is_a?(Hash))
98
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::MemberBase` initialize method"
99
+ end
100
+
101
+ # check to see if the attribute exists and convert string to symbol for hash key
102
+ attributes = attributes.each_with_object({}) { |(k, v), h|
103
+ if (!self.class.attribute_map.key?(k.to_sym))
104
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::MemberBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
105
+ end
106
+ h[k.to_sym] = v
107
+ }
108
+
109
+ if attributes.key?(:'id')
110
+ self.id = attributes[:'id']
111
+ else
112
+ self.id = nil
113
+ end
114
+
115
+ if attributes.key?(:'email')
116
+ self.email = attributes[:'email']
117
+ else
118
+ self.email = nil
119
+ end
120
+
121
+ if attributes.key?(:'name')
122
+ self.name = attributes[:'name']
123
+ else
124
+ self.name = nil
125
+ end
126
+
127
+ if attributes.key?(:'active')
128
+ self.active = attributes[:'active']
129
+ end
130
+
131
+ if attributes.key?(:'role')
132
+ self.role = attributes[:'role']
133
+ else
134
+ self.role = nil
135
+ end
136
+
137
+ if attributes.key?(:'status')
138
+ self.status = attributes[:'status']
139
+ else
140
+ self.status = nil
141
+ end
142
+ end
143
+
144
+ # Show invalid properties with the reasons. Usually used together with valid?
145
+ # @return Array for valid properties with the reasons
146
+ def list_invalid_properties
147
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
148
+ invalid_properties = Array.new
149
+ if @id.nil?
150
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
151
+ end
152
+
153
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
154
+ if @id !~ pattern
155
+ invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
156
+ end
157
+
158
+ if @email.nil?
159
+ invalid_properties.push('invalid value for "email", email cannot be nil.')
160
+ end
161
+
162
+ if @role.nil?
163
+ invalid_properties.push('invalid value for "role", role cannot be nil.')
164
+ end
165
+
166
+ if @status.nil?
167
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
168
+ end
169
+
170
+ invalid_properties
171
+ end
172
+
173
+ # Check to see if the all the properties in the model are valid
174
+ # @return true if the model is valid
175
+ def valid?
176
+ warn '[DEPRECATED] the `valid?` method is obsolete'
177
+ return false if @id.nil?
178
+ return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/)
179
+ return false if @email.nil?
180
+ return false if @role.nil?
181
+ role_validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN"])
182
+ return false unless role_validator.valid?(@role)
183
+ return false if @status.nil?
184
+ status_validator = EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"])
185
+ return false unless status_validator.valid?(@status)
186
+ true
187
+ end
188
+
189
+ # Custom attribute writer method with validation
190
+ # @param [Object] id Value to be assigned
191
+ def id=(id)
192
+ if id.nil?
193
+ fail ArgumentError, 'id cannot be nil'
194
+ end
195
+
196
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
197
+ if id !~ pattern
198
+ fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
199
+ end
200
+
201
+ @id = id
202
+ end
203
+
204
+ # Custom attribute writer method checking allowed values (enum).
205
+ # @param [Object] role Object to be assigned
206
+ def role=(role)
207
+ validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN"])
208
+ unless validator.valid?(role)
209
+ fail ArgumentError, "invalid value for \"role\", must be one of #{validator.allowable_values}."
210
+ end
211
+ @role = role
212
+ end
213
+
214
+ # Custom attribute writer method checking allowed values (enum).
215
+ # @param [Object] status Object to be assigned
216
+ def status=(status)
217
+ validator = EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"])
218
+ unless validator.valid?(status)
219
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
220
+ end
221
+ @status = status
222
+ end
223
+
224
+ # Checks equality by comparing each attribute.
225
+ # @param [Object] Object to be compared
226
+ def ==(o)
227
+ return true if self.equal?(o)
228
+ self.class == o.class &&
229
+ id == o.id &&
230
+ email == o.email &&
231
+ name == o.name &&
232
+ active == o.active &&
233
+ role == o.role &&
234
+ status == o.status
235
+ end
236
+
237
+ # @see the `==` method
238
+ # @param [Object] Object to be compared
239
+ def eql?(o)
240
+ self == o
241
+ end
242
+
243
+ # Calculates hash code according to all attributes.
244
+ # @return [Integer] Hash code
245
+ def hash
246
+ [id, email, name, active, role, status].hash
247
+ end
248
+
249
+ # Builds the object from hash
250
+ # @param [Hash] attributes Model attributes in the form of hash
251
+ # @return [Object] Returns the model itself
252
+ def self.build_from_hash(attributes)
253
+ return nil unless attributes.is_a?(Hash)
254
+ attributes = attributes.transform_keys(&:to_sym)
255
+ transformed_hash = {}
256
+ openapi_types.each_pair do |key, type|
257
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
258
+ transformed_hash["#{key}"] = nil
259
+ elsif type =~ /\AArray<(.*)>/i
260
+ # check to ensure the input is an array given that the attribute
261
+ # is documented as an array but the input is not
262
+ if attributes[attribute_map[key]].is_a?(Array)
263
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
264
+ end
265
+ elsif !attributes[attribute_map[key]].nil?
266
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
267
+ end
268
+ end
269
+ new(transformed_hash)
270
+ end
271
+
272
+ # Deserializes the data based on type
273
+ # @param string type Data type
274
+ # @param string value Value to be deserialized
275
+ # @return [Object] Deserialized data
276
+ def self._deserialize(type, value)
277
+ case type.to_sym
278
+ when :Time
279
+ Time.parse(value)
280
+ when :Date
281
+ Date.parse(value)
282
+ when :String
283
+ value.to_s
284
+ when :Integer
285
+ value.to_i
286
+ when :Float
287
+ value.to_f
288
+ when :Boolean
289
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
290
+ true
291
+ else
292
+ false
293
+ end
294
+ when :Object
295
+ # generic object (usually a Hash), return directly
296
+ value
297
+ when /\AArray<(?<inner_type>.+)>\z/
298
+ inner_type = Regexp.last_match[:inner_type]
299
+ value.map { |v| _deserialize(inner_type, v) }
300
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
301
+ k_type = Regexp.last_match[:k_type]
302
+ v_type = Regexp.last_match[:v_type]
303
+ {}.tap do |hash|
304
+ value.each do |k, v|
305
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
306
+ end
307
+ end
308
+ else # model
309
+ # models (e.g. Pet) or oneOf
310
+ klass = Tremendous.const_get(type)
311
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
312
+ end
313
+ end
314
+
315
+ # Returns the string representation of the object
316
+ # @return [String] String presentation of the object
317
+ def to_s
318
+ to_hash.to_s
319
+ end
320
+
321
+ # to_body is an alias to to_hash (backward compatibility)
322
+ # @return [Hash] Returns the object in the form of hash
323
+ def to_body
324
+ to_hash
325
+ end
326
+
327
+ # Returns the object in the form of hash
328
+ # @return [Hash] Returns the object in the form of hash
329
+ def to_hash
330
+ hash = {}
331
+ self.class.attribute_map.each_pair do |attr, param|
332
+ value = self.send(attr)
333
+ if value.nil?
334
+ is_nullable = self.class.openapi_nullable.include?(attr)
335
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
336
+ end
337
+
338
+ hash[param] = _to_hash(value)
339
+ end
340
+ hash
341
+ end
342
+
343
+ # Outputs non-array value in the form of hash
344
+ # For object, use to_hash. Otherwise, just return the value
345
+ # @param [Object] value Any valid value
346
+ # @return [Hash] Returns the value in the form of hash
347
+ def _to_hash(value)
348
+ if value.is_a?(Array)
349
+ value.compact.map { |v| _to_hash(v) }
350
+ elsif value.is_a?(Hash)
351
+ {}.tap do |hash|
352
+ value.each { |k, v| hash[k] = _to_hash(v) }
353
+ end
354
+ elsif value.respond_to? :to_hash
355
+ value.to_hash
356
+ else
357
+ value
358
+ end
359
+ end
360
+
361
+ end
362
+
363
+ end