rbac-api-client 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +175 -0
- data/Rakefile +10 -0
- data/client-meta.json +8 -0
- data/docs/Access.md +19 -0
- data/docs/AccessApi.md +68 -0
- data/docs/AccessPagination.md +21 -0
- data/docs/AccessPaginationAllOf.md +17 -0
- data/docs/AdditionalGroup.md +19 -0
- data/docs/Error.md +17 -0
- data/docs/Error403.md +17 -0
- data/docs/Group.md +19 -0
- data/docs/GroupApi.md +623 -0
- data/docs/GroupOut.md +33 -0
- data/docs/GroupPagination.md +21 -0
- data/docs/GroupPaginationAllOf.md +17 -0
- data/docs/GroupPrincipalIn.md +17 -0
- data/docs/GroupRoleIn.md +17 -0
- data/docs/GroupRolesPagination.md +21 -0
- data/docs/GroupWithPrincipals.md +27 -0
- data/docs/GroupWithPrincipalsAllOf.md +17 -0
- data/docs/GroupWithPrincipalsAndRoles.md +29 -0
- data/docs/GroupWithPrincipalsAndRolesAllOf.md +19 -0
- data/docs/InlineResponse200.md +17 -0
- data/docs/ListPagination.md +19 -0
- data/docs/PaginationLinks.md +23 -0
- data/docs/PaginationMeta.md +17 -0
- data/docs/Policy.md +19 -0
- data/docs/PolicyApi.md +283 -0
- data/docs/PolicyExtended.md +29 -0
- data/docs/PolicyExtendedAllOf.md +19 -0
- data/docs/PolicyIn.md +23 -0
- data/docs/PolicyInAllOf.md +19 -0
- data/docs/PolicyPagination.md +21 -0
- data/docs/PolicyPaginationAllOf.md +17 -0
- data/docs/Principal.md +25 -0
- data/docs/PrincipalApi.md +68 -0
- data/docs/PrincipalIn.md +17 -0
- data/docs/PrincipalOut.md +27 -0
- data/docs/PrincipalPagination.md +21 -0
- data/docs/PrincipalPaginationAllOf.md +17 -0
- data/docs/ResourceDefinition.md +17 -0
- data/docs/ResourceDefinitionFilter.md +21 -0
- data/docs/Role.md +19 -0
- data/docs/RoleApi.md +340 -0
- data/docs/RoleIn.md +21 -0
- data/docs/RoleInAllOf.md +17 -0
- data/docs/RoleOut.md +35 -0
- data/docs/RoleOutDynamic.md +39 -0
- data/docs/RoleOutDynamicAllOf.md +29 -0
- data/docs/RolePagination.md +21 -0
- data/docs/RolePaginationDynamic.md +21 -0
- data/docs/RolePaginationDynamicAllOf.md +17 -0
- data/docs/RoleWithAccess.md +37 -0
- data/docs/Status.md +27 -0
- data/docs/StatusApi.md +56 -0
- data/docs/Timestamped.md +19 -0
- data/docs/UUID.md +17 -0
- data/generate.sh +7 -0
- data/git_push.sh +58 -0
- data/lib/rbac-api-client.rb +93 -0
- data/lib/rbac-api-client/api/access_api.rb +104 -0
- data/lib/rbac-api-client/api/group_api.rb +800 -0
- data/lib/rbac-api-client/api/policy_api.rb +363 -0
- data/lib/rbac-api-client/api/principal_api.rb +104 -0
- data/lib/rbac-api-client/api/role_api.rb +445 -0
- data/lib/rbac-api-client/api/status_api.rb +76 -0
- data/lib/rbac-api-client/api_client.rb +386 -0
- data/lib/rbac-api-client/api_error.rb +57 -0
- data/lib/rbac-api-client/configuration.rb +248 -0
- data/lib/rbac-api-client/models/access.rb +227 -0
- data/lib/rbac-api-client/models/access_pagination.rb +239 -0
- data/lib/rbac-api-client/models/access_pagination_all_of.rb +213 -0
- data/lib/rbac-api-client/models/additional_group.rb +215 -0
- data/lib/rbac-api-client/models/error.rb +213 -0
- data/lib/rbac-api-client/models/error403.rb +213 -0
- data/lib/rbac-api-client/models/group.rb +220 -0
- data/lib/rbac-api-client/models/group_out.rb +341 -0
- data/lib/rbac-api-client/models/group_pagination.rb +239 -0
- data/lib/rbac-api-client/models/group_pagination_all_of.rb +213 -0
- data/lib/rbac-api-client/models/group_principal_in.rb +213 -0
- data/lib/rbac-api-client/models/group_role_in.rb +213 -0
- data/lib/rbac-api-client/models/group_roles_pagination.rb +239 -0
- data/lib/rbac-api-client/models/group_with_principals.rb +288 -0
- data/lib/rbac-api-client/models/group_with_principals_all_of.rb +213 -0
- data/lib/rbac-api-client/models/group_with_principals_and_roles.rb +304 -0
- data/lib/rbac-api-client/models/group_with_principals_and_roles_all_of.rb +229 -0
- data/lib/rbac-api-client/models/inline_response200.rb +213 -0
- data/lib/rbac-api-client/models/list_pagination.rb +215 -0
- data/lib/rbac-api-client/models/pagination_links.rb +233 -0
- data/lib/rbac-api-client/models/pagination_meta.rb +206 -0
- data/lib/rbac-api-client/models/policy.rb +220 -0
- data/lib/rbac-api-client/models/policy_extended.rb +302 -0
- data/lib/rbac-api-client/models/policy_extended_all_of.rb +227 -0
- data/lib/rbac-api-client/models/policy_in.rb +258 -0
- data/lib/rbac-api-client/models/policy_in_all_of.rb +227 -0
- data/lib/rbac-api-client/models/policy_pagination.rb +239 -0
- data/lib/rbac-api-client/models/policy_pagination_all_of.rb +213 -0
- data/lib/rbac-api-client/models/principal.rb +252 -0
- data/lib/rbac-api-client/models/principal_in.rb +211 -0
- data/lib/rbac-api-client/models/principal_out.rb +274 -0
- data/lib/rbac-api-client/models/principal_pagination.rb +239 -0
- data/lib/rbac-api-client/models/principal_pagination_all_of.rb +213 -0
- data/lib/rbac-api-client/models/resource_definition.rb +211 -0
- data/lib/rbac-api-client/models/resource_definition_filter.rb +273 -0
- data/lib/rbac-api-client/models/role.rb +220 -0
- data/lib/rbac-api-client/models/role_in.rb +244 -0
- data/lib/rbac-api-client/models/role_in_all_of.rb +213 -0
- data/lib/rbac-api-client/models/role_out.rb +352 -0
- data/lib/rbac-api-client/models/role_out_dynamic.rb +421 -0
- data/lib/rbac-api-client/models/role_out_dynamic_all_of.rb +346 -0
- data/lib/rbac-api-client/models/role_pagination.rb +239 -0
- data/lib/rbac-api-client/models/role_pagination_dynamic.rb +239 -0
- data/lib/rbac-api-client/models/role_pagination_dynamic_all_of.rb +213 -0
- data/lib/rbac-api-client/models/role_with_access.rb +367 -0
- data/lib/rbac-api-client/models/status.rb +256 -0
- data/lib/rbac-api-client/models/timestamped.rb +225 -0
- data/lib/rbac-api-client/models/uuid.rb +211 -0
- data/lib/rbac-api-client/version.rb +15 -0
- data/openapi.json +2613 -0
- data/rbac-api-client.gemspec +39 -0
- data/spec/api/access_api_spec.rb +49 -0
- data/spec/api/group_api_spec.rb +176 -0
- data/spec/api/policy_api_spec.rb +97 -0
- data/spec/api/principal_api_spec.rb +49 -0
- data/spec/api/role_api_spec.rb +110 -0
- data/spec/api/status_api_spec.rb +45 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/access_pagination_all_of_spec.rb +41 -0
- data/spec/models/access_pagination_spec.rb +53 -0
- data/spec/models/access_spec.rb +47 -0
- data/spec/models/additional_group_spec.rb +47 -0
- data/spec/models/error403_spec.rb +41 -0
- data/spec/models/error_spec.rb +41 -0
- data/spec/models/group_out_spec.rb +89 -0
- data/spec/models/group_pagination_all_of_spec.rb +41 -0
- data/spec/models/group_pagination_spec.rb +53 -0
- data/spec/models/group_principal_in_spec.rb +41 -0
- data/spec/models/group_role_in_spec.rb +41 -0
- data/spec/models/group_roles_pagination_spec.rb +53 -0
- data/spec/models/group_spec.rb +47 -0
- data/spec/models/group_with_principals_all_of_spec.rb +41 -0
- data/spec/models/group_with_principals_and_roles_all_of_spec.rb +47 -0
- data/spec/models/group_with_principals_and_roles_spec.rb +77 -0
- data/spec/models/group_with_principals_spec.rb +71 -0
- data/spec/models/inline_response200_spec.rb +41 -0
- data/spec/models/list_pagination_spec.rb +47 -0
- data/spec/models/pagination_links_spec.rb +59 -0
- data/spec/models/pagination_meta_spec.rb +41 -0
- data/spec/models/policy_extended_all_of_spec.rb +47 -0
- data/spec/models/policy_extended_spec.rb +77 -0
- data/spec/models/policy_in_all_of_spec.rb +47 -0
- data/spec/models/policy_in_spec.rb +59 -0
- data/spec/models/policy_pagination_all_of_spec.rb +41 -0
- data/spec/models/policy_pagination_spec.rb +53 -0
- data/spec/models/policy_spec.rb +47 -0
- data/spec/models/principal_in_spec.rb +41 -0
- data/spec/models/principal_out_spec.rb +71 -0
- data/spec/models/principal_pagination_all_of_spec.rb +41 -0
- data/spec/models/principal_pagination_spec.rb +53 -0
- data/spec/models/principal_spec.rb +65 -0
- data/spec/models/resource_definition_filter_spec.rb +57 -0
- data/spec/models/resource_definition_spec.rb +41 -0
- data/spec/models/role_in_all_of_spec.rb +41 -0
- data/spec/models/role_in_spec.rb +53 -0
- data/spec/models/role_out_dynamic_all_of_spec.rb +77 -0
- data/spec/models/role_out_dynamic_spec.rb +107 -0
- data/spec/models/role_out_spec.rb +95 -0
- data/spec/models/role_pagination_dynamic_all_of_spec.rb +41 -0
- data/spec/models/role_pagination_dynamic_spec.rb +53 -0
- data/spec/models/role_pagination_spec.rb +53 -0
- data/spec/models/role_spec.rb +47 -0
- data/spec/models/role_with_access_spec.rb +101 -0
- data/spec/models/status_spec.rb +71 -0
- data/spec/models/timestamped_spec.rb +47 -0
- data/spec/models/uuid_spec.rb +41 -0
- data/spec/spec_helper.rb +111 -0
- metadata +338 -0
@@ -0,0 +1,213 @@
|
|
1
|
+
=begin
|
2
|
+
#Role Based Access Control
|
3
|
+
|
4
|
+
#The API for Role Based Access Control.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.2.2
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module RBACApiClient
|
16
|
+
class PolicyPaginationAllOf
|
17
|
+
attr_accessor :data
|
18
|
+
|
19
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
20
|
+
def self.attribute_map
|
21
|
+
{
|
22
|
+
:'data' => :'data'
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
# Attribute type mapping.
|
27
|
+
def self.openapi_types
|
28
|
+
{
|
29
|
+
:'data' => :'Array<PolicyExtended>'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# List of attributes with nullable: true
|
34
|
+
def self.openapi_nullable
|
35
|
+
Set.new([
|
36
|
+
])
|
37
|
+
end
|
38
|
+
|
39
|
+
# Initializes the object
|
40
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
41
|
+
def initialize(attributes = {})
|
42
|
+
if (!attributes.is_a?(Hash))
|
43
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `RBACApiClient::PolicyPaginationAllOf` initialize method"
|
44
|
+
end
|
45
|
+
|
46
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
47
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
48
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
49
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `RBACApiClient::PolicyPaginationAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
50
|
+
end
|
51
|
+
h[k.to_sym] = v
|
52
|
+
}
|
53
|
+
|
54
|
+
if attributes.key?(:'data')
|
55
|
+
if (value = attributes[:'data']).is_a?(Array)
|
56
|
+
self.data = value
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
62
|
+
# @return Array for valid properties with the reasons
|
63
|
+
def list_invalid_properties
|
64
|
+
invalid_properties = Array.new
|
65
|
+
if @data.nil?
|
66
|
+
invalid_properties.push('invalid value for "data", data cannot be nil.')
|
67
|
+
end
|
68
|
+
|
69
|
+
invalid_properties
|
70
|
+
end
|
71
|
+
|
72
|
+
# Check to see if the all the properties in the model are valid
|
73
|
+
# @return true if the model is valid
|
74
|
+
def valid?
|
75
|
+
return false if @data.nil?
|
76
|
+
true
|
77
|
+
end
|
78
|
+
|
79
|
+
# Checks equality by comparing each attribute.
|
80
|
+
# @param [Object] Object to be compared
|
81
|
+
def ==(o)
|
82
|
+
return true if self.equal?(o)
|
83
|
+
self.class == o.class &&
|
84
|
+
data == o.data
|
85
|
+
end
|
86
|
+
|
87
|
+
# @see the `==` method
|
88
|
+
# @param [Object] Object to be compared
|
89
|
+
def eql?(o)
|
90
|
+
self == o
|
91
|
+
end
|
92
|
+
|
93
|
+
# Calculates hash code according to all attributes.
|
94
|
+
# @return [Integer] Hash code
|
95
|
+
def hash
|
96
|
+
[data].hash
|
97
|
+
end
|
98
|
+
|
99
|
+
# Builds the object from hash
|
100
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
101
|
+
# @return [Object] Returns the model itself
|
102
|
+
def self.build_from_hash(attributes)
|
103
|
+
new.build_from_hash(attributes)
|
104
|
+
end
|
105
|
+
|
106
|
+
# Builds the object from hash
|
107
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
108
|
+
# @return [Object] Returns the model itself
|
109
|
+
def build_from_hash(attributes)
|
110
|
+
return nil unless attributes.is_a?(Hash)
|
111
|
+
self.class.openapi_types.each_pair do |key, type|
|
112
|
+
if type =~ /\AArray<(.*)>/i
|
113
|
+
# check to ensure the input is an array given that the attribute
|
114
|
+
# is documented as an array but the input is not
|
115
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
116
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
117
|
+
end
|
118
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
119
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
120
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
121
|
+
end
|
122
|
+
|
123
|
+
self
|
124
|
+
end
|
125
|
+
|
126
|
+
# Deserializes the data based on type
|
127
|
+
# @param string type Data type
|
128
|
+
# @param string value Value to be deserialized
|
129
|
+
# @return [Object] Deserialized data
|
130
|
+
def _deserialize(type, value)
|
131
|
+
case type.to_sym
|
132
|
+
when :DateTime
|
133
|
+
DateTime.parse(value)
|
134
|
+
when :Date
|
135
|
+
Date.parse(value)
|
136
|
+
when :String
|
137
|
+
value.to_s
|
138
|
+
when :Integer
|
139
|
+
value.to_i
|
140
|
+
when :Float
|
141
|
+
value.to_f
|
142
|
+
when :Boolean
|
143
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
144
|
+
true
|
145
|
+
else
|
146
|
+
false
|
147
|
+
end
|
148
|
+
when :Object
|
149
|
+
# generic object (usually a Hash), return directly
|
150
|
+
value
|
151
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
152
|
+
inner_type = Regexp.last_match[:inner_type]
|
153
|
+
value.map { |v| _deserialize(inner_type, v) }
|
154
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
155
|
+
k_type = Regexp.last_match[:k_type]
|
156
|
+
v_type = Regexp.last_match[:v_type]
|
157
|
+
{}.tap do |hash|
|
158
|
+
value.each do |k, v|
|
159
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
else # model
|
163
|
+
RBACApiClient.const_get(type).build_from_hash(value)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
# Returns the string representation of the object
|
168
|
+
# @return [String] String presentation of the object
|
169
|
+
def to_s
|
170
|
+
to_hash.to_s
|
171
|
+
end
|
172
|
+
|
173
|
+
# to_body is an alias to to_hash (backward compatibility)
|
174
|
+
# @return [Hash] Returns the object in the form of hash
|
175
|
+
def to_body
|
176
|
+
to_hash
|
177
|
+
end
|
178
|
+
|
179
|
+
# Returns the object in the form of hash
|
180
|
+
# @return [Hash] Returns the object in the form of hash
|
181
|
+
def to_hash
|
182
|
+
hash = {}
|
183
|
+
self.class.attribute_map.each_pair do |attr, param|
|
184
|
+
value = self.send(attr)
|
185
|
+
if value.nil?
|
186
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
187
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
188
|
+
end
|
189
|
+
|
190
|
+
hash[param] = _to_hash(value)
|
191
|
+
end
|
192
|
+
hash
|
193
|
+
end
|
194
|
+
|
195
|
+
# Outputs non-array value in the form of hash
|
196
|
+
# For object, use to_hash. Otherwise, just return the value
|
197
|
+
# @param [Object] value Any valid value
|
198
|
+
# @return [Hash] Returns the value in the form of hash
|
199
|
+
def _to_hash(value)
|
200
|
+
if value.is_a?(Array)
|
201
|
+
value.compact.map { |v| _to_hash(v) }
|
202
|
+
elsif value.is_a?(Hash)
|
203
|
+
{}.tap do |hash|
|
204
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
205
|
+
end
|
206
|
+
elsif value.respond_to? :to_hash
|
207
|
+
value.to_hash
|
208
|
+
else
|
209
|
+
value
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
@@ -0,0 +1,252 @@
|
|
1
|
+
=begin
|
2
|
+
#Role Based Access Control
|
3
|
+
|
4
|
+
#The API for Role Based Access Control.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.2.2
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module RBACApiClient
|
16
|
+
class Principal
|
17
|
+
attr_accessor :username
|
18
|
+
|
19
|
+
attr_accessor :email
|
20
|
+
|
21
|
+
attr_accessor :first_name
|
22
|
+
|
23
|
+
attr_accessor :last_name
|
24
|
+
|
25
|
+
attr_accessor :is_active
|
26
|
+
|
27
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
28
|
+
def self.attribute_map
|
29
|
+
{
|
30
|
+
:'username' => :'username',
|
31
|
+
:'email' => :'email',
|
32
|
+
:'first_name' => :'first_name',
|
33
|
+
:'last_name' => :'last_name',
|
34
|
+
:'is_active' => :'is_active'
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.openapi_types
|
40
|
+
{
|
41
|
+
:'username' => :'String',
|
42
|
+
:'email' => :'String',
|
43
|
+
:'first_name' => :'String',
|
44
|
+
:'last_name' => :'String',
|
45
|
+
:'is_active' => :'Boolean'
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
# List of attributes with nullable: true
|
50
|
+
def self.openapi_nullable
|
51
|
+
Set.new([
|
52
|
+
])
|
53
|
+
end
|
54
|
+
|
55
|
+
# Initializes the object
|
56
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
57
|
+
def initialize(attributes = {})
|
58
|
+
if (!attributes.is_a?(Hash))
|
59
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `RBACApiClient::Principal` initialize method"
|
60
|
+
end
|
61
|
+
|
62
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
63
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
64
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
65
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `RBACApiClient::Principal`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
66
|
+
end
|
67
|
+
h[k.to_sym] = v
|
68
|
+
}
|
69
|
+
|
70
|
+
if attributes.key?(:'username')
|
71
|
+
self.username = attributes[:'username']
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.key?(:'email')
|
75
|
+
self.email = attributes[:'email']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.key?(:'first_name')
|
79
|
+
self.first_name = attributes[:'first_name']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.key?(:'last_name')
|
83
|
+
self.last_name = attributes[:'last_name']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.key?(:'is_active')
|
87
|
+
self.is_active = attributes[:'is_active']
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
92
|
+
# @return Array for valid properties with the reasons
|
93
|
+
def list_invalid_properties
|
94
|
+
invalid_properties = Array.new
|
95
|
+
if @username.nil?
|
96
|
+
invalid_properties.push('invalid value for "username", username cannot be nil.')
|
97
|
+
end
|
98
|
+
|
99
|
+
if @email.nil?
|
100
|
+
invalid_properties.push('invalid value for "email", email cannot be nil.')
|
101
|
+
end
|
102
|
+
|
103
|
+
invalid_properties
|
104
|
+
end
|
105
|
+
|
106
|
+
# Check to see if the all the properties in the model are valid
|
107
|
+
# @return true if the model is valid
|
108
|
+
def valid?
|
109
|
+
return false if @username.nil?
|
110
|
+
return false if @email.nil?
|
111
|
+
true
|
112
|
+
end
|
113
|
+
|
114
|
+
# Checks equality by comparing each attribute.
|
115
|
+
# @param [Object] Object to be compared
|
116
|
+
def ==(o)
|
117
|
+
return true if self.equal?(o)
|
118
|
+
self.class == o.class &&
|
119
|
+
username == o.username &&
|
120
|
+
email == o.email &&
|
121
|
+
first_name == o.first_name &&
|
122
|
+
last_name == o.last_name &&
|
123
|
+
is_active == o.is_active
|
124
|
+
end
|
125
|
+
|
126
|
+
# @see the `==` method
|
127
|
+
# @param [Object] Object to be compared
|
128
|
+
def eql?(o)
|
129
|
+
self == o
|
130
|
+
end
|
131
|
+
|
132
|
+
# Calculates hash code according to all attributes.
|
133
|
+
# @return [Integer] Hash code
|
134
|
+
def hash
|
135
|
+
[username, email, first_name, last_name, is_active].hash
|
136
|
+
end
|
137
|
+
|
138
|
+
# Builds the object from hash
|
139
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
140
|
+
# @return [Object] Returns the model itself
|
141
|
+
def self.build_from_hash(attributes)
|
142
|
+
new.build_from_hash(attributes)
|
143
|
+
end
|
144
|
+
|
145
|
+
# Builds the object from hash
|
146
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
147
|
+
# @return [Object] Returns the model itself
|
148
|
+
def build_from_hash(attributes)
|
149
|
+
return nil unless attributes.is_a?(Hash)
|
150
|
+
self.class.openapi_types.each_pair do |key, type|
|
151
|
+
if type =~ /\AArray<(.*)>/i
|
152
|
+
# check to ensure the input is an array given that the attribute
|
153
|
+
# is documented as an array but the input is not
|
154
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
155
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
156
|
+
end
|
157
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
158
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
159
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
160
|
+
end
|
161
|
+
|
162
|
+
self
|
163
|
+
end
|
164
|
+
|
165
|
+
# Deserializes the data based on type
|
166
|
+
# @param string type Data type
|
167
|
+
# @param string value Value to be deserialized
|
168
|
+
# @return [Object] Deserialized data
|
169
|
+
def _deserialize(type, value)
|
170
|
+
case type.to_sym
|
171
|
+
when :DateTime
|
172
|
+
DateTime.parse(value)
|
173
|
+
when :Date
|
174
|
+
Date.parse(value)
|
175
|
+
when :String
|
176
|
+
value.to_s
|
177
|
+
when :Integer
|
178
|
+
value.to_i
|
179
|
+
when :Float
|
180
|
+
value.to_f
|
181
|
+
when :Boolean
|
182
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
183
|
+
true
|
184
|
+
else
|
185
|
+
false
|
186
|
+
end
|
187
|
+
when :Object
|
188
|
+
# generic object (usually a Hash), return directly
|
189
|
+
value
|
190
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
191
|
+
inner_type = Regexp.last_match[:inner_type]
|
192
|
+
value.map { |v| _deserialize(inner_type, v) }
|
193
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
194
|
+
k_type = Regexp.last_match[:k_type]
|
195
|
+
v_type = Regexp.last_match[:v_type]
|
196
|
+
{}.tap do |hash|
|
197
|
+
value.each do |k, v|
|
198
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
else # model
|
202
|
+
RBACApiClient.const_get(type).build_from_hash(value)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
# Returns the string representation of the object
|
207
|
+
# @return [String] String presentation of the object
|
208
|
+
def to_s
|
209
|
+
to_hash.to_s
|
210
|
+
end
|
211
|
+
|
212
|
+
# to_body is an alias to to_hash (backward compatibility)
|
213
|
+
# @return [Hash] Returns the object in the form of hash
|
214
|
+
def to_body
|
215
|
+
to_hash
|
216
|
+
end
|
217
|
+
|
218
|
+
# Returns the object in the form of hash
|
219
|
+
# @return [Hash] Returns the object in the form of hash
|
220
|
+
def to_hash
|
221
|
+
hash = {}
|
222
|
+
self.class.attribute_map.each_pair do |attr, param|
|
223
|
+
value = self.send(attr)
|
224
|
+
if value.nil?
|
225
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
226
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
227
|
+
end
|
228
|
+
|
229
|
+
hash[param] = _to_hash(value)
|
230
|
+
end
|
231
|
+
hash
|
232
|
+
end
|
233
|
+
|
234
|
+
# Outputs non-array value in the form of hash
|
235
|
+
# For object, use to_hash. Otherwise, just return the value
|
236
|
+
# @param [Object] value Any valid value
|
237
|
+
# @return [Hash] Returns the value in the form of hash
|
238
|
+
def _to_hash(value)
|
239
|
+
if value.is_a?(Array)
|
240
|
+
value.compact.map { |v| _to_hash(v) }
|
241
|
+
elsif value.is_a?(Hash)
|
242
|
+
{}.tap do |hash|
|
243
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
244
|
+
end
|
245
|
+
elsif value.respond_to? :to_hash
|
246
|
+
value.to_hash
|
247
|
+
else
|
248
|
+
value
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|