authress-sdk 1.0.21.0 → 2.0.29.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.
@@ -1,344 +0,0 @@
1
- =begin
2
-
3
- =end
4
-
5
- require 'date'
6
-
7
- module AuthressSdk
8
- # The access record which links users to roles.
9
- class Body3
10
- # Unique identifier for the record, can be specified on record creation.
11
- attr_accessor :record_id
12
-
13
- # A helpful name for this record
14
- attr_accessor :name
15
-
16
- # More details about this record
17
- attr_accessor :description
18
-
19
- # Current status of the access record.
20
- attr_accessor :status
21
-
22
- attr_accessor :account
23
-
24
- # The list of users this record applies to
25
- attr_accessor :users
26
-
27
- # The list of admin that can edit this record even if they do not have global record edit permissions.
28
- attr_accessor :admins
29
-
30
- # A list of statements which match roles to resources. Users in this record have all statements apply to them
31
- attr_accessor :statements
32
-
33
- attr_accessor :links
34
-
35
- class EnumAttributeValidator
36
- attr_reader :datatype
37
- attr_reader :allowable_values
38
-
39
- def initialize(datatype, allowable_values)
40
- @allowable_values = allowable_values.map do |value|
41
- case datatype.to_s
42
- when /Integer/i
43
- value.to_i
44
- when /Float/i
45
- value.to_f
46
- else
47
- value
48
- end
49
- end
50
- end
51
-
52
- def valid?(value)
53
- !value || allowable_values.include?(value)
54
- end
55
- end
56
-
57
- # Attribute mapping from ruby-style variable name to JSON key.
58
- def self.attribute_map
59
- {
60
- :'record_id' => :'recordId',
61
- :'name' => :'name',
62
- :'description' => :'description',
63
- :'status' => :'status',
64
- :'account' => :'account',
65
- :'users' => :'users',
66
- :'admins' => :'admins',
67
- :'statements' => :'statements',
68
- :'links' => :'links'
69
- }
70
- end
71
-
72
- # Attribute type mapping.
73
- def self.openapi_types
74
- {
75
- :'record_id' => :'Object',
76
- :'name' => :'Object',
77
- :'description' => :'Object',
78
- :'status' => :'Object',
79
- :'account' => :'Object',
80
- :'users' => :'Object',
81
- :'admins' => :'Object',
82
- :'statements' => :'Object',
83
- :'links' => :'Object'
84
- }
85
- end
86
-
87
- # List of attributes with nullable: true
88
- def self.openapi_nullable
89
- Set.new([
90
- ])
91
- end
92
-
93
- # Initializes the object
94
- # @param [Hash] attributes Model attributes in the form of hash
95
- def initialize(attributes = {})
96
- if (!attributes.is_a?(Hash))
97
- fail ArgumentError, "The input argument (attributes) must be a hash in `AuthressSdk::Body3` initialize method"
98
- end
99
-
100
- # check to see if the attribute exists and convert string to symbol for hash key
101
- attributes = attributes.each_with_object({}) { |(k, v), h|
102
- if (!self.class.attribute_map.key?(k.to_sym))
103
- fail ArgumentError, "`#{k}` is not a valid attribute in `AuthressSdk::Body3`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
104
- end
105
- h[k.to_sym] = v
106
- }
107
-
108
- if attributes.key?(:'record_id')
109
- self.record_id = attributes[:'record_id']
110
- end
111
-
112
- if attributes.key?(:'name')
113
- self.name = attributes[:'name']
114
- end
115
-
116
- if attributes.key?(:'description')
117
- self.description = attributes[:'description']
118
- end
119
-
120
- if attributes.key?(:'status')
121
- self.status = attributes[:'status']
122
- end
123
-
124
- if attributes.key?(:'account')
125
- self.account = attributes[:'account']
126
- end
127
-
128
- if attributes.key?(:'users')
129
- if (value = attributes[:'users']).is_a?(Array)
130
- self.users = value
131
- end
132
- end
133
-
134
- if attributes.key?(:'admins')
135
- if (value = attributes[:'admins']).is_a?(Array)
136
- self.admins = value
137
- end
138
- end
139
-
140
- if attributes.key?(:'statements')
141
- if (value = attributes[:'statements']).is_a?(Array)
142
- self.statements = value
143
- end
144
- end
145
-
146
- if attributes.key?(:'links')
147
- self.links = attributes[:'links']
148
- end
149
- end
150
-
151
- # Show invalid properties with the reasons. Usually used together with valid?
152
- # @return Array for valid properties with the reasons
153
- def list_invalid_properties
154
- invalid_properties = Array.new
155
- if @name.nil?
156
- invalid_properties.push('invalid value for "name", name cannot be nil.')
157
- end
158
-
159
- if @account.nil?
160
- invalid_properties.push('invalid value for "account", account cannot be nil.')
161
- end
162
-
163
- if @users.nil?
164
- invalid_properties.push('invalid value for "users", users cannot be nil.')
165
- end
166
-
167
- if @statements.nil?
168
- invalid_properties.push('invalid value for "statements", statements cannot be nil.')
169
- end
170
-
171
- if @links.nil?
172
- invalid_properties.push('invalid value for "links", links cannot be nil.')
173
- end
174
-
175
- invalid_properties
176
- end
177
-
178
- # Check to see if the all the properties in the model are valid
179
- # @return true if the model is valid
180
- def valid?
181
- return false if @name.nil?
182
- status_validator = EnumAttributeValidator.new('Object', ['ACTIVE', 'DELETED'])
183
- return false unless status_validator.valid?(@status)
184
- return false if @account.nil?
185
- return false if @users.nil?
186
- return false if @statements.nil?
187
- return false if @links.nil?
188
- true
189
- end
190
-
191
- # Custom attribute writer method checking allowed values (enum).
192
- # @param [Object] status Object to be assigned
193
- def status=(status)
194
- validator = EnumAttributeValidator.new('Object', ['ACTIVE', 'DELETED'])
195
- unless validator.valid?(status)
196
- fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
197
- end
198
- @status = status
199
- end
200
-
201
- # Checks equality by comparing each attribute.
202
- # @param [Object] Object to be compared
203
- def ==(o)
204
- return true if self.equal?(o)
205
- self.class == o.class &&
206
- record_id == o.record_id &&
207
- name == o.name &&
208
- description == o.description &&
209
- status == o.status &&
210
- account == o.account &&
211
- users == o.users &&
212
- admins == o.admins &&
213
- statements == o.statements &&
214
- links == o.links
215
- end
216
-
217
- # @see the `==` method
218
- # @param [Object] Object to be compared
219
- def eql?(o)
220
- self == o
221
- end
222
-
223
- # Calculates hash code according to all attributes.
224
- # @return [Integer] Hash code
225
- def hash
226
- [record_id, name, description, status, account, users, admins, statements, links].hash
227
- end
228
-
229
- # Builds the object from hash
230
- # @param [Hash] attributes Model attributes in the form of hash
231
- # @return [Object] Returns the model itself
232
- def self.build_from_hash(attributes)
233
- new.build_from_hash(attributes)
234
- end
235
-
236
- # Builds the object from hash
237
- # @param [Hash] attributes Model attributes in the form of hash
238
- # @return [Object] Returns the model itself
239
- def build_from_hash(attributes)
240
- return nil unless attributes.is_a?(Hash)
241
- self.class.openapi_types.each_pair do |key, type|
242
- if type =~ /\AArray<(.*)>/i
243
- # check to ensure the input is an array given that the attribute
244
- # is documented as an array but the input is not
245
- if attributes[self.class.attribute_map[key]].is_a?(Array)
246
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
247
- end
248
- elsif !attributes[self.class.attribute_map[key]].nil?
249
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
250
- elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
251
- self.send("#{key}=", nil)
252
- end
253
- end
254
-
255
- self
256
- end
257
-
258
- # Deserializes the data based on type
259
- # @param string type Data type
260
- # @param string value Value to be deserialized
261
- # @return [Object] Deserialized data
262
- def _deserialize(type, value)
263
- case type.to_sym
264
- when :DateTime
265
- DateTime.parse(value)
266
- when :Date
267
- Date.parse(value)
268
- when :String
269
- value.to_s
270
- when :Integer
271
- value.to_i
272
- when :Float
273
- value.to_f
274
- when :Boolean
275
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
276
- true
277
- else
278
- false
279
- end
280
- when :Object
281
- # generic object (usually a Hash), return directly
282
- value
283
- when /\AArray<(?<inner_type>.+)>\z/
284
- inner_type = Regexp.last_match[:inner_type]
285
- value.map { |v| _deserialize(inner_type, v) }
286
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
287
- k_type = Regexp.last_match[:k_type]
288
- v_type = Regexp.last_match[:v_type]
289
- {}.tap do |hash|
290
- value.each do |k, v|
291
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
292
- end
293
- end
294
- else # model
295
- AuthressSdk.const_get(type).build_from_hash(value)
296
- end
297
- end
298
-
299
- # Returns the string representation of the object
300
- # @return [String] String presentation of the object
301
- def to_s
302
- to_hash.to_s
303
- end
304
-
305
- # to_body is an alias to to_hash (backward compatibility)
306
- # @return [Hash] Returns the object in the form of hash
307
- def to_body
308
- to_hash
309
- end
310
-
311
- # Returns the object in the form of hash
312
- # @return [Hash] Returns the object in the form of hash
313
- def to_hash
314
- hash = {}
315
- self.class.attribute_map.each_pair do |attr, param|
316
- value = self.send(attr)
317
- if value.nil?
318
- is_nullable = self.class.openapi_nullable.include?(attr)
319
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
320
- end
321
-
322
- hash[param] = _to_hash(value)
323
- end
324
- hash
325
- end
326
-
327
- # Outputs non-array value in the form of hash
328
- # For object, use to_hash. Otherwise, just return the value
329
- # @param [Object] value Any valid value
330
- # @return [Hash] Returns the value in the form of hash
331
- def _to_hash(value)
332
- if value.is_a?(Array)
333
- value.compact.map { |v| _to_hash(v) }
334
- elsif value.is_a?(Hash)
335
- {}.tap do |hash|
336
- value.each { |k, v| hash[k] = _to_hash(v) }
337
- end
338
- elsif value.respond_to? :to_hash
339
- value.to_hash
340
- else
341
- value
342
- end
343
- end end
344
- end
@@ -1,344 +0,0 @@
1
- =begin
2
-
3
- =end
4
-
5
- require 'date'
6
-
7
- module AuthressSdk
8
- # The access record which links users to roles.
9
- class Body4
10
- # Unique identifier for the record, can be specified on record creation.
11
- attr_accessor :record_id
12
-
13
- # A helpful name for this record
14
- attr_accessor :name
15
-
16
- # More details about this record
17
- attr_accessor :description
18
-
19
- # Current status of the access record.
20
- attr_accessor :status
21
-
22
- attr_accessor :account
23
-
24
- # The list of users this record applies to
25
- attr_accessor :users
26
-
27
- # The list of admin that can edit this record even if they do not have global record edit permissions.
28
- attr_accessor :admins
29
-
30
- # A list of statements which match roles to resources. Users in this record have all statements apply to them
31
- attr_accessor :statements
32
-
33
- attr_accessor :links
34
-
35
- class EnumAttributeValidator
36
- attr_reader :datatype
37
- attr_reader :allowable_values
38
-
39
- def initialize(datatype, allowable_values)
40
- @allowable_values = allowable_values.map do |value|
41
- case datatype.to_s
42
- when /Integer/i
43
- value.to_i
44
- when /Float/i
45
- value.to_f
46
- else
47
- value
48
- end
49
- end
50
- end
51
-
52
- def valid?(value)
53
- !value || allowable_values.include?(value)
54
- end
55
- end
56
-
57
- # Attribute mapping from ruby-style variable name to JSON key.
58
- def self.attribute_map
59
- {
60
- :'record_id' => :'recordId',
61
- :'name' => :'name',
62
- :'description' => :'description',
63
- :'status' => :'status',
64
- :'account' => :'account',
65
- :'users' => :'users',
66
- :'admins' => :'admins',
67
- :'statements' => :'statements',
68
- :'links' => :'links'
69
- }
70
- end
71
-
72
- # Attribute type mapping.
73
- def self.openapi_types
74
- {
75
- :'record_id' => :'Object',
76
- :'name' => :'Object',
77
- :'description' => :'Object',
78
- :'status' => :'Object',
79
- :'account' => :'Object',
80
- :'users' => :'Object',
81
- :'admins' => :'Object',
82
- :'statements' => :'Object',
83
- :'links' => :'Object'
84
- }
85
- end
86
-
87
- # List of attributes with nullable: true
88
- def self.openapi_nullable
89
- Set.new([
90
- ])
91
- end
92
-
93
- # Initializes the object
94
- # @param [Hash] attributes Model attributes in the form of hash
95
- def initialize(attributes = {})
96
- if (!attributes.is_a?(Hash))
97
- fail ArgumentError, "The input argument (attributes) must be a hash in `AuthressSdk::Body4` initialize method"
98
- end
99
-
100
- # check to see if the attribute exists and convert string to symbol for hash key
101
- attributes = attributes.each_with_object({}) { |(k, v), h|
102
- if (!self.class.attribute_map.key?(k.to_sym))
103
- fail ArgumentError, "`#{k}` is not a valid attribute in `AuthressSdk::Body4`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
104
- end
105
- h[k.to_sym] = v
106
- }
107
-
108
- if attributes.key?(:'record_id')
109
- self.record_id = attributes[:'record_id']
110
- end
111
-
112
- if attributes.key?(:'name')
113
- self.name = attributes[:'name']
114
- end
115
-
116
- if attributes.key?(:'description')
117
- self.description = attributes[:'description']
118
- end
119
-
120
- if attributes.key?(:'status')
121
- self.status = attributes[:'status']
122
- end
123
-
124
- if attributes.key?(:'account')
125
- self.account = attributes[:'account']
126
- end
127
-
128
- if attributes.key?(:'users')
129
- if (value = attributes[:'users']).is_a?(Array)
130
- self.users = value
131
- end
132
- end
133
-
134
- if attributes.key?(:'admins')
135
- if (value = attributes[:'admins']).is_a?(Array)
136
- self.admins = value
137
- end
138
- end
139
-
140
- if attributes.key?(:'statements')
141
- if (value = attributes[:'statements']).is_a?(Array)
142
- self.statements = value
143
- end
144
- end
145
-
146
- if attributes.key?(:'links')
147
- self.links = attributes[:'links']
148
- end
149
- end
150
-
151
- # Show invalid properties with the reasons. Usually used together with valid?
152
- # @return Array for valid properties with the reasons
153
- def list_invalid_properties
154
- invalid_properties = Array.new
155
- if @name.nil?
156
- invalid_properties.push('invalid value for "name", name cannot be nil.')
157
- end
158
-
159
- if @account.nil?
160
- invalid_properties.push('invalid value for "account", account cannot be nil.')
161
- end
162
-
163
- if @users.nil?
164
- invalid_properties.push('invalid value for "users", users cannot be nil.')
165
- end
166
-
167
- if @statements.nil?
168
- invalid_properties.push('invalid value for "statements", statements cannot be nil.')
169
- end
170
-
171
- if @links.nil?
172
- invalid_properties.push('invalid value for "links", links cannot be nil.')
173
- end
174
-
175
- invalid_properties
176
- end
177
-
178
- # Check to see if the all the properties in the model are valid
179
- # @return true if the model is valid
180
- def valid?
181
- return false if @name.nil?
182
- status_validator = EnumAttributeValidator.new('Object', ['ACTIVE', 'DELETED'])
183
- return false unless status_validator.valid?(@status)
184
- return false if @account.nil?
185
- return false if @users.nil?
186
- return false if @statements.nil?
187
- return false if @links.nil?
188
- true
189
- end
190
-
191
- # Custom attribute writer method checking allowed values (enum).
192
- # @param [Object] status Object to be assigned
193
- def status=(status)
194
- validator = EnumAttributeValidator.new('Object', ['ACTIVE', 'DELETED'])
195
- unless validator.valid?(status)
196
- fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
197
- end
198
- @status = status
199
- end
200
-
201
- # Checks equality by comparing each attribute.
202
- # @param [Object] Object to be compared
203
- def ==(o)
204
- return true if self.equal?(o)
205
- self.class == o.class &&
206
- record_id == o.record_id &&
207
- name == o.name &&
208
- description == o.description &&
209
- status == o.status &&
210
- account == o.account &&
211
- users == o.users &&
212
- admins == o.admins &&
213
- statements == o.statements &&
214
- links == o.links
215
- end
216
-
217
- # @see the `==` method
218
- # @param [Object] Object to be compared
219
- def eql?(o)
220
- self == o
221
- end
222
-
223
- # Calculates hash code according to all attributes.
224
- # @return [Integer] Hash code
225
- def hash
226
- [record_id, name, description, status, account, users, admins, statements, links].hash
227
- end
228
-
229
- # Builds the object from hash
230
- # @param [Hash] attributes Model attributes in the form of hash
231
- # @return [Object] Returns the model itself
232
- def self.build_from_hash(attributes)
233
- new.build_from_hash(attributes)
234
- end
235
-
236
- # Builds the object from hash
237
- # @param [Hash] attributes Model attributes in the form of hash
238
- # @return [Object] Returns the model itself
239
- def build_from_hash(attributes)
240
- return nil unless attributes.is_a?(Hash)
241
- self.class.openapi_types.each_pair do |key, type|
242
- if type =~ /\AArray<(.*)>/i
243
- # check to ensure the input is an array given that the attribute
244
- # is documented as an array but the input is not
245
- if attributes[self.class.attribute_map[key]].is_a?(Array)
246
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
247
- end
248
- elsif !attributes[self.class.attribute_map[key]].nil?
249
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
250
- elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
251
- self.send("#{key}=", nil)
252
- end
253
- end
254
-
255
- self
256
- end
257
-
258
- # Deserializes the data based on type
259
- # @param string type Data type
260
- # @param string value Value to be deserialized
261
- # @return [Object] Deserialized data
262
- def _deserialize(type, value)
263
- case type.to_sym
264
- when :DateTime
265
- DateTime.parse(value)
266
- when :Date
267
- Date.parse(value)
268
- when :String
269
- value.to_s
270
- when :Integer
271
- value.to_i
272
- when :Float
273
- value.to_f
274
- when :Boolean
275
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
276
- true
277
- else
278
- false
279
- end
280
- when :Object
281
- # generic object (usually a Hash), return directly
282
- value
283
- when /\AArray<(?<inner_type>.+)>\z/
284
- inner_type = Regexp.last_match[:inner_type]
285
- value.map { |v| _deserialize(inner_type, v) }
286
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
287
- k_type = Regexp.last_match[:k_type]
288
- v_type = Regexp.last_match[:v_type]
289
- {}.tap do |hash|
290
- value.each do |k, v|
291
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
292
- end
293
- end
294
- else # model
295
- AuthressSdk.const_get(type).build_from_hash(value)
296
- end
297
- end
298
-
299
- # Returns the string representation of the object
300
- # @return [String] String presentation of the object
301
- def to_s
302
- to_hash.to_s
303
- end
304
-
305
- # to_body is an alias to to_hash (backward compatibility)
306
- # @return [Hash] Returns the object in the form of hash
307
- def to_body
308
- to_hash
309
- end
310
-
311
- # Returns the object in the form of hash
312
- # @return [Hash] Returns the object in the form of hash
313
- def to_hash
314
- hash = {}
315
- self.class.attribute_map.each_pair do |attr, param|
316
- value = self.send(attr)
317
- if value.nil?
318
- is_nullable = self.class.openapi_nullable.include?(attr)
319
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
320
- end
321
-
322
- hash[param] = _to_hash(value)
323
- end
324
- hash
325
- end
326
-
327
- # Outputs non-array value in the form of hash
328
- # For object, use to_hash. Otherwise, just return the value
329
- # @param [Object] value Any valid value
330
- # @return [Hash] Returns the value in the form of hash
331
- def _to_hash(value)
332
- if value.is_a?(Array)
333
- value.compact.map { |v| _to_hash(v) }
334
- elsif value.is_a?(Hash)
335
- {}.tap do |hash|
336
- value.each { |k, v| hash[k] = _to_hash(v) }
337
- end
338
- elsif value.respond_to? :to_hash
339
- value.to_hash
340
- else
341
- value
342
- end
343
- end end
344
- end