tremendous_ruby 5.1.0 → 5.3.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 (29) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tremendous/api/tremendous_api.rb +538 -13
  3. data/lib/tremendous/models/campaign_base.rb +287 -0
  4. data/lib/tremendous/models/create_member.rb +1 -35
  5. data/lib/tremendous/models/create_member_request.rb +1 -35
  6. data/lib/tremendous/models/create_organization_request_copy_settings.rb +14 -2
  7. data/lib/tremendous/models/create_public_key.rb +222 -0
  8. data/lib/tremendous/models/create_public_key200_response.rb +221 -0
  9. data/lib/tremendous/models/create_public_key_request.rb +222 -0
  10. data/lib/tremendous/models/get_member200_response_member.rb +2 -20
  11. data/lib/tremendous/models/list_forex_response.rb +223 -0
  12. data/lib/tremendous/models/list_members200_response_members_inner.rb +2 -20
  13. data/lib/tremendous/models/list_roles200_response.rb +223 -0
  14. data/lib/tremendous/models/list_roles200_response_roles_inner.rb +275 -0
  15. data/lib/tremendous/models/member.rb +2 -20
  16. data/lib/tremendous/models/member_base.rb +2 -20
  17. data/lib/tremendous/models/member_with_events.rb +2 -20
  18. data/lib/tremendous/models/member_without_events.rb +2 -20
  19. data/lib/tremendous/models/public_key.rb +257 -0
  20. data/lib/tremendous/models/public_keys_response.rb +223 -0
  21. data/lib/tremendous/models/public_keys_response_public_keys_inner.rb +257 -0
  22. data/lib/tremendous/models/role.rb +275 -0
  23. data/lib/tremendous/models/test_public_key.rb +222 -0
  24. data/lib/tremendous/models/test_public_key_request.rb +222 -0
  25. data/lib/tremendous/models/update_campaign.rb +287 -0
  26. data/lib/tremendous/models/update_campaign_request.rb +257 -0
  27. data/lib/tremendous/version.rb +1 -1
  28. data/lib/tremendous.rb +15 -0
  29. metadata +18 -3
@@ -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 ListRoles200ResponseRolesInner
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::ListRoles200ResponseRolesInner` 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::ListRoles200ResponseRolesInner`. 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
@@ -27,7 +27,7 @@ module Tremendous
27
27
  # Is this member currently active in the organization. If `false`, the member will not be able to access the organization.
28
28
  attr_accessor :active
29
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>
30
+ # The role ID associated with the member within the organization.
31
31
  attr_accessor :role
32
32
 
33
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`.
@@ -98,6 +98,7 @@ module Tremendous
98
98
  def self.openapi_nullable
99
99
  Set.new([
100
100
  :'name',
101
+ :'role',
101
102
  :'last_login_at'
102
103
  ])
103
104
  end
@@ -141,8 +142,6 @@ module Tremendous
141
142
 
142
143
  if attributes.key?(:'role')
143
144
  self.role = attributes[:'role']
144
- else
145
- self.role = nil
146
145
  end
147
146
 
148
147
  if attributes.key?(:'status')
@@ -178,10 +177,6 @@ module Tremendous
178
177
  invalid_properties.push('invalid value for "email", email cannot be nil.')
179
178
  end
180
179
 
181
- if @role.nil?
182
- invalid_properties.push('invalid value for "role", role cannot be nil.')
183
- end
184
-
185
180
  if @status.nil?
186
181
  invalid_properties.push('invalid value for "status", status cannot be nil.')
187
182
  end
@@ -196,9 +191,6 @@ module Tremendous
196
191
  return false if @id.nil?
197
192
  return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/)
198
193
  return false if @email.nil?
199
- return false if @role.nil?
200
- role_validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN"])
201
- return false unless role_validator.valid?(@role)
202
194
  return false if @status.nil?
203
195
  status_validator = EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"])
204
196
  return false unless status_validator.valid?(@status)
@@ -220,16 +212,6 @@ module Tremendous
220
212
  @id = id
221
213
  end
222
214
 
223
- # Custom attribute writer method checking allowed values (enum).
224
- # @param [Object] role Object to be assigned
225
- def role=(role)
226
- validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN"])
227
- unless validator.valid?(role)
228
- fail ArgumentError, "invalid value for \"role\", must be one of #{validator.allowable_values}."
229
- end
230
- @role = role
231
- end
232
-
233
215
  # Custom attribute writer method checking allowed values (enum).
234
216
  # @param [Object] status Object to be assigned
235
217
  def status=(status)
@@ -27,7 +27,7 @@ module Tremendous
27
27
  # Is this member currently active in the organization. If `false`, the member will not be able to access the organization.
28
28
  attr_accessor :active
29
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>
30
+ # The role ID associated with the member within the organization.
31
31
  attr_accessor :role
32
32
 
33
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`.
@@ -88,6 +88,7 @@ module Tremendous
88
88
  def self.openapi_nullable
89
89
  Set.new([
90
90
  :'name',
91
+ :'role',
91
92
  ])
92
93
  end
93
94
 
@@ -130,8 +131,6 @@ module Tremendous
130
131
 
131
132
  if attributes.key?(:'role')
132
133
  self.role = attributes[:'role']
133
- else
134
- self.role = nil
135
134
  end
136
135
 
137
136
  if attributes.key?(:'status')
@@ -159,10 +158,6 @@ module Tremendous
159
158
  invalid_properties.push('invalid value for "email", email cannot be nil.')
160
159
  end
161
160
 
162
- if @role.nil?
163
- invalid_properties.push('invalid value for "role", role cannot be nil.')
164
- end
165
-
166
161
  if @status.nil?
167
162
  invalid_properties.push('invalid value for "status", status cannot be nil.')
168
163
  end
@@ -177,9 +172,6 @@ module Tremendous
177
172
  return false if @id.nil?
178
173
  return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/)
179
174
  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
175
  return false if @status.nil?
184
176
  status_validator = EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"])
185
177
  return false unless status_validator.valid?(@status)
@@ -201,16 +193,6 @@ module Tremendous
201
193
  @id = id
202
194
  end
203
195
 
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
196
  # Custom attribute writer method checking allowed values (enum).
215
197
  # @param [Object] status Object to be assigned
216
198
  def status=(status)
@@ -27,7 +27,7 @@ module Tremendous
27
27
  # Is this member currently active in the organization. If `false`, the member will not be able to access the organization.
28
28
  attr_accessor :active
29
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>
30
+ # The role ID associated with the member within the organization.
31
31
  attr_accessor :role
32
32
 
33
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`.
@@ -93,6 +93,7 @@ module Tremendous
93
93
  def self.openapi_nullable
94
94
  Set.new([
95
95
  :'name',
96
+ :'role',
96
97
  ])
97
98
  end
98
99
 
@@ -135,8 +136,6 @@ module Tremendous
135
136
 
136
137
  if attributes.key?(:'role')
137
138
  self.role = attributes[:'role']
138
- else
139
- self.role = nil
140
139
  end
141
140
 
142
141
  if attributes.key?(:'status')
@@ -170,10 +169,6 @@ module Tremendous
170
169
  invalid_properties.push('invalid value for "email", email cannot be nil.')
171
170
  end
172
171
 
173
- if @role.nil?
174
- invalid_properties.push('invalid value for "role", role cannot be nil.')
175
- end
176
-
177
172
  if @status.nil?
178
173
  invalid_properties.push('invalid value for "status", status cannot be nil.')
179
174
  end
@@ -188,9 +183,6 @@ module Tremendous
188
183
  return false if @id.nil?
189
184
  return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/)
190
185
  return false if @email.nil?
191
- return false if @role.nil?
192
- role_validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN"])
193
- return false unless role_validator.valid?(@role)
194
186
  return false if @status.nil?
195
187
  status_validator = EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"])
196
188
  return false unless status_validator.valid?(@status)
@@ -212,16 +204,6 @@ module Tremendous
212
204
  @id = id
213
205
  end
214
206
 
215
- # Custom attribute writer method checking allowed values (enum).
216
- # @param [Object] role Object to be assigned
217
- def role=(role)
218
- validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN"])
219
- unless validator.valid?(role)
220
- fail ArgumentError, "invalid value for \"role\", must be one of #{validator.allowable_values}."
221
- end
222
- @role = role
223
- end
224
-
225
207
  # Custom attribute writer method checking allowed values (enum).
226
208
  # @param [Object] status Object to be assigned
227
209
  def status=(status)
@@ -27,7 +27,7 @@ module Tremendous
27
27
  # Is this member currently active in the organization. If `false`, the member will not be able to access the organization.
28
28
  attr_accessor :active
29
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>
30
+ # The role ID associated with the member within the organization.
31
31
  attr_accessor :role
32
32
 
33
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`.
@@ -98,6 +98,7 @@ module Tremendous
98
98
  def self.openapi_nullable
99
99
  Set.new([
100
100
  :'name',
101
+ :'role',
101
102
  :'last_login_at'
102
103
  ])
103
104
  end
@@ -141,8 +142,6 @@ module Tremendous
141
142
 
142
143
  if attributes.key?(:'role')
143
144
  self.role = attributes[:'role']
144
- else
145
- self.role = nil
146
145
  end
147
146
 
148
147
  if attributes.key?(:'status')
@@ -178,10 +177,6 @@ module Tremendous
178
177
  invalid_properties.push('invalid value for "email", email cannot be nil.')
179
178
  end
180
179
 
181
- if @role.nil?
182
- invalid_properties.push('invalid value for "role", role cannot be nil.')
183
- end
184
-
185
180
  if @status.nil?
186
181
  invalid_properties.push('invalid value for "status", status cannot be nil.')
187
182
  end
@@ -196,9 +191,6 @@ module Tremendous
196
191
  return false if @id.nil?
197
192
  return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/)
198
193
  return false if @email.nil?
199
- return false if @role.nil?
200
- role_validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN"])
201
- return false unless role_validator.valid?(@role)
202
194
  return false if @status.nil?
203
195
  status_validator = EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"])
204
196
  return false unless status_validator.valid?(@status)
@@ -220,16 +212,6 @@ module Tremendous
220
212
  @id = id
221
213
  end
222
214
 
223
- # Custom attribute writer method checking allowed values (enum).
224
- # @param [Object] role Object to be assigned
225
- def role=(role)
226
- validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN"])
227
- unless validator.valid?(role)
228
- fail ArgumentError, "invalid value for \"role\", must be one of #{validator.allowable_values}."
229
- end
230
- @role = role
231
- end
232
-
233
215
  # Custom attribute writer method checking allowed values (enum).
234
216
  # @param [Object] status Object to be assigned
235
217
  def status=(status)