authress-sdk 2.0.36.0 → 2.0.39.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/lib/authress-sdk/api/access_records_api.rb +6 -6
  3. data/lib/authress-sdk/api/accounts_api.rb +9 -9
  4. data/lib/authress-sdk/api/metadata_api.rb +6 -6
  5. data/lib/authress-sdk/api/resource_permissions_api.rb +9 -9
  6. data/lib/authress-sdk/api/roles_api.rb +9 -9
  7. data/lib/authress-sdk/api/service_clients_api.rb +15 -15
  8. data/lib/authress-sdk/api/user_permissions_api.rb +9 -9
  9. data/lib/authress-sdk/api/users_api.rb +134 -0
  10. data/lib/authress-sdk/models/{permission_response.rb → permission_collection.rb} +3 -3
  11. data/lib/authress-sdk/models/{v1resourcesresource_uri_permissions.rb → user_identity.rb} +40 -38
  12. data/lib/authress-sdk/models/{inline_response_200_6.rb → user_identity_collection.rb} +5 -5
  13. metadata +6 -28
  14. data/lib/authress-sdk/models/inline_response_200.rb +0 -240
  15. data/lib/authress-sdk/models/inline_response_200_1.rb +0 -229
  16. data/lib/authress-sdk/models/inline_response_200_10.rb +0 -248
  17. data/lib/authress-sdk/models/inline_response_200_11.rb +0 -204
  18. data/lib/authress-sdk/models/inline_response_200_12.rb +0 -206
  19. data/lib/authress-sdk/models/inline_response_200_13.rb +0 -222
  20. data/lib/authress-sdk/models/inline_response_200_14.rb +0 -239
  21. data/lib/authress-sdk/models/inline_response_200_15.rb +0 -235
  22. data/lib/authress-sdk/models/inline_response_200_2.rb +0 -231
  23. data/lib/authress-sdk/models/inline_response_200_3.rb +0 -253
  24. data/lib/authress-sdk/models/inline_response_200_4.rb +0 -221
  25. data/lib/authress-sdk/models/inline_response_200_5.rb +0 -206
  26. data/lib/authress-sdk/models/inline_response_200_7.rb +0 -222
  27. data/lib/authress-sdk/models/inline_response_200_9.rb +0 -261
  28. data/lib/authress-sdk/models/v1clients_options.rb +0 -211
  29. data/lib/authress-sdk/models/v1records_account.rb +0 -204
  30. data/lib/authress-sdk/models/v1records_links.rb +0 -204
  31. data/lib/authress-sdk/models/v1records_links_self.rb +0 -216
  32. data/lib/authress-sdk/models/v1records_users.rb +0 -205
  33. data/lib/authress-sdk/models/v1roles_permissions.rb +0 -251
  34. data/lib/authress-sdk/models/v1usersuser_idresourcesresource_urimetadata_account.rb +0 -199
  35. data/lib/authress-sdk/models/v1usersuser_idtokens_resources.rb +0 -205
  36. data/lib/authress-sdk/models/v1usersuser_idtokens_statements.rb +0 -222
@@ -0,0 +1,134 @@
1
+ =begin
2
+
3
+ =end
4
+
5
+ module AuthressSdk
6
+ class UsersApi
7
+ attr_accessor :authress_client
8
+
9
+ def initialize(authress_client = AuthressClient.default)
10
+ @authress_client = authress_client
11
+ end
12
+
13
+ # Retrieve a user
14
+ # Get the user data associated with a user. The data returned by this endpoint is highly variable based on the source OAuth provider. Avoid depending on undocumented properties.
15
+ # @param user_id The user identifier.
16
+ # @param [Hash] opts the optional parameters
17
+ # @return [UserIdentity]
18
+ def get_user(user_id, opts = {})
19
+ data, _status_code, _headers = get_user_with_http_info(user_id, opts)
20
+ data
21
+ end
22
+
23
+ # Retrieve a user
24
+ # Get the user data associated with a user. The data returned by this endpoint is highly variable based on the source OAuth provider. Avoid depending on undocumented properties.
25
+ # @param user_id The user identifier.
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [Array<(UserIdentity, Integer, Hash)>] UserIdentity data, response status code and response headers
28
+ def get_user_with_http_info(user_id, opts = {})
29
+ if @authress_client.config[:debugging]
30
+ @authress_client.config[:logger].debug 'Calling API: UsersApi.get_user ...'
31
+ end
32
+ # verify the required parameter 'user_id' is set
33
+ if @authress_client.config[:client_side_validation] && user_id.nil?
34
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling UsersApi.get_user"
35
+ end
36
+ # resource path
37
+ local_var_path = '/v1/users/{userId}'.sub('{' + 'userId' + '}', user_id.to_s)
38
+
39
+ # query parameters
40
+ query_params = opts[:query_params] || {}
41
+
42
+ # header parameters
43
+ header_params = opts[:header_params] || {}
44
+ # HTTP header 'Accept' (if needed)
45
+ header_params['Accept'] = @authress_client.select_header_accept(['application/links+json'])
46
+
47
+ # form parameters
48
+ form_params = opts[:form_params] || {}
49
+
50
+ # http body (model)
51
+ post_body = opts[:body]
52
+
53
+ return_type = opts[:return_type] || 'UserIdentity'
54
+
55
+ auth_names = opts[:auth_names] || ['oauth2']
56
+ data, status_code, headers = @authress_client.call_api(:GET, local_var_path,
57
+ :header_params => header_params,
58
+ :query_params => query_params,
59
+ :form_params => form_params,
60
+ :body => post_body,
61
+ :auth_names => auth_names,
62
+ :return_type => return_type)
63
+
64
+ if @authress_client.config[:debugging]
65
+ @authress_client.config[:logger].debug "API called: UsersApi#get_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
66
+ end
67
+ return data, status_code, headers
68
+ end
69
+
70
+ # List users
71
+ # Returns a paginated user list for the account. The data returned by this endpoint is highly variable based on the source OAuth provider. Avoid depending on undocumented properties.
72
+ # @param [Hash] opts the optional parameters
73
+ # @option opts [Integer] :limit Max number of results to return (default to 100)
74
+ # @option opts [String] :cursor Continuation cursor for paging (will automatically be set)
75
+ # @option opts [String] :filter Filter to search users by. This is a case insensitive search through every text field.
76
+ # @option opts [String] :tenant_id Return only users that are part of the specified tenant. Users can only be part of one tenant, using this parameter will limit returned users that have logged into this tenant.
77
+ # @return [UserIdentityCollection]
78
+ def get_users(opts = {})
79
+ data, _status_code, _headers = get_users_with_http_info(opts)
80
+ data
81
+ end
82
+
83
+ # List users
84
+ # Returns a paginated user list for the account. The data returned by this endpoint is highly variable based on the source OAuth provider. Avoid depending on undocumented properties.
85
+ # @param [Hash] opts the optional parameters
86
+ # @option opts [Integer] :limit Max number of results to return (default to 100)
87
+ # @option opts [String] :cursor Continuation cursor for paging (will automatically be set)
88
+ # @option opts [String] :filter Filter to search users by. This is a case insensitive search through every text field.
89
+ # @option opts [String] :tenant_id Return only users that are part of the specified tenant. Users can only be part of one tenant, using this parameter will limit returned users that have logged into this tenant.
90
+ # @return [Array<(UserIdentityCollection, Integer, Hash)>] UserIdentityCollection data, response status code and response headers
91
+ def get_users_with_http_info(opts = {})
92
+ if @authress_client.config[:debugging]
93
+ @authress_client.config[:logger].debug 'Calling API: UsersApi.get_users ...'
94
+ end
95
+
96
+ # resource path
97
+ local_var_path = '/v1/users'
98
+
99
+ # query parameters
100
+ query_params = opts[:query_params] || {}
101
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
102
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
103
+ query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
104
+ query_params[:'tenantId'] = opts[:'tenant_id'] if !opts[:'tenant_id'].nil?
105
+
106
+ # header parameters
107
+ header_params = opts[:header_params] || {}
108
+ # HTTP header 'Accept' (if needed)
109
+ header_params['Accept'] = @authress_client.select_header_accept(['application/links+json'])
110
+
111
+ # form parameters
112
+ form_params = opts[:form_params] || {}
113
+
114
+ # http body (model)
115
+ post_body = opts[:body]
116
+
117
+ return_type = opts[:return_type] || 'UserIdentityCollection'
118
+
119
+ auth_names = opts[:auth_names] || ['oauth2']
120
+ data, status_code, headers = @authress_client.call_api(:GET, local_var_path,
121
+ :header_params => header_params,
122
+ :query_params => query_params,
123
+ :form_params => form_params,
124
+ :body => post_body,
125
+ :auth_names => auth_names,
126
+ :return_type => return_type)
127
+
128
+ if @authress_client.config[:debugging]
129
+ @authress_client.config[:logger].debug "API called: UsersApi#get_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
130
+ end
131
+ return data, status_code, headers
132
+ end
133
+ end
134
+ end
@@ -6,7 +6,7 @@ require 'date'
6
6
 
7
7
  module AuthressSdk
8
8
  # A collect of permissions that the user has to a resource.
9
- class PermissionResponse
9
+ class PermissionCollection
10
10
  attr_accessor :account
11
11
 
12
12
  attr_accessor :user_id
@@ -42,13 +42,13 @@ module AuthressSdk
42
42
  # @param [Hash] attributes Model attributes in the form of hash
43
43
  def initialize(attributes = {})
44
44
  if (!attributes.is_a?(Hash))
45
- fail ArgumentError, "The input argument (attributes) must be a hash in `AuthressSdk::PermissionResponse` initialize method"
45
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AuthressSdk::PermissionCollection` initialize method"
46
46
  end
47
47
 
48
48
  # check to see if the attribute exists and convert string to symbol for hash key
49
49
  attributes = attributes.each_with_object({}) { |(k, v), h|
50
50
  if (!self.class.attribute_map.key?(k.to_sym))
51
- fail ArgumentError, "`#{k}` is not a valid attribute in `AuthressSdk::PermissionResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
51
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AuthressSdk::PermissionCollection`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
52
52
  end
53
53
  h[k.to_sym] = v
54
54
  }
@@ -5,10 +5,19 @@
5
5
  require 'date'
6
6
 
7
7
  module AuthressSdk
8
- class V1resourcesresourceUriPermissions
9
- attr_accessor :action
8
+ # The access record which links users to roles.
9
+ class UserIdentity
10
+ # The user identifier.
11
+ attr_accessor :user_id
10
12
 
11
- attr_accessor :allow
13
+ # The user's formatted display name.
14
+ attr_accessor :name
15
+
16
+ # A url that resolves to a picture that can be rendered.
17
+ attr_accessor :picture
18
+
19
+ # The user's verified email address sourced from their SSO IdP.
20
+ attr_accessor :email
12
21
 
13
22
  class EnumAttributeValidator
14
23
  attr_reader :datatype
@@ -35,16 +44,20 @@ module AuthressSdk
35
44
  # Attribute mapping from ruby-style variable name to JSON key.
36
45
  def self.attribute_map
37
46
  {
38
- :'action' => :'action',
39
- :'allow' => :'allow'
47
+ :'user_id' => :'userId',
48
+ :'name' => :'name',
49
+ :'picture' => :'picture',
50
+ :'email' => :'email'
40
51
  }
41
52
  end
42
53
 
43
54
  # Attribute type mapping.
44
55
  def self.openapi_types
45
56
  {
46
- :'action' => :'Object',
47
- :'allow' => :'Object'
57
+ :'user_id' => :'Object',
58
+ :'name' => :'Object',
59
+ :'picture' => :'Object',
60
+ :'email' => :'Object'
48
61
  }
49
62
  end
50
63
 
@@ -58,23 +71,31 @@ module AuthressSdk
58
71
  # @param [Hash] attributes Model attributes in the form of hash
59
72
  def initialize(attributes = {})
60
73
  if (!attributes.is_a?(Hash))
61
- fail ArgumentError, "The input argument (attributes) must be a hash in `AuthressSdk::V1resourcesresourceUriPermissions` initialize method"
74
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AuthressSdk::UserIdentity` initialize method"
62
75
  end
63
76
 
64
77
  # check to see if the attribute exists and convert string to symbol for hash key
65
78
  attributes = attributes.each_with_object({}) { |(k, v), h|
66
79
  if (!self.class.attribute_map.key?(k.to_sym))
67
- fail ArgumentError, "`#{k}` is not a valid attribute in `AuthressSdk::V1resourcesresourceUriPermissions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
80
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AuthressSdk::UserIdentity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
81
  end
69
82
  h[k.to_sym] = v
70
83
  }
71
84
 
72
- if attributes.key?(:'action')
73
- self.action = attributes[:'action']
85
+ if attributes.key?(:'user_id')
86
+ self.user_id = attributes[:'user_id']
87
+ end
88
+
89
+ if attributes.key?(:'name')
90
+ self.name = attributes[:'name']
74
91
  end
75
92
 
76
- if attributes.key?(:'allow')
77
- self.allow = attributes[:'allow']
93
+ if attributes.key?(:'picture')
94
+ self.picture = attributes[:'picture']
95
+ end
96
+
97
+ if attributes.key?(:'email')
98
+ self.email = attributes[:'email']
78
99
  end
79
100
  end
80
101
 
@@ -82,44 +103,25 @@ module AuthressSdk
82
103
  # @return Array for valid properties with the reasons
83
104
  def list_invalid_properties
84
105
  invalid_properties = Array.new
85
- if @action.nil?
86
- invalid_properties.push('invalid value for "action", action cannot be nil.')
87
- end
88
-
89
- if @allow.nil?
90
- invalid_properties.push('invalid value for "allow", allow cannot be nil.')
91
- end
92
-
93
106
  invalid_properties
94
107
  end
95
108
 
96
109
  # Check to see if the all the properties in the model are valid
97
110
  # @return true if the model is valid
98
111
  def valid?
99
- return false if @action.nil?
100
- action_validator = EnumAttributeValidator.new('Object', ['CLAIM', 'PUBLIC'])
101
- return false unless action_validator.valid?(@action)
102
- return false if @allow.nil?
112
+ return false if @user_id.nil?
103
113
  true
104
114
  end
105
115
 
106
- # Custom attribute writer method checking allowed values (enum).
107
- # @param [Object] action Object to be assigned
108
- def action=(action)
109
- validator = EnumAttributeValidator.new('Object', ['CLAIM', 'PUBLIC'])
110
- unless validator.valid?(action)
111
- fail ArgumentError, "invalid value for \"action\", must be one of #{validator.allowable_values}."
112
- end
113
- @action = action
114
- end
115
-
116
116
  # Checks equality by comparing each attribute.
117
117
  # @param [Object] Object to be compared
118
118
  def ==(o)
119
119
  return true if self.equal?(o)
120
120
  self.class == o.class &&
121
- action == o.action &&
122
- allow == o.allow
121
+ user_id == o.user_id &&
122
+ name == o.name &&
123
+ picture == o.picture &&
124
+ email == o.email
123
125
  end
124
126
 
125
127
  # @see the `==` method
@@ -131,7 +133,7 @@ module AuthressSdk
131
133
  # Calculates hash code according to all attributes.
132
134
  # @return [Integer] Hash code
133
135
  def hash
134
- [action, allow].hash
136
+ [user_id, name, picture, email].hash
135
137
  end
136
138
 
137
139
  # Builds the object from hash
@@ -5,9 +5,9 @@
5
5
  require 'date'
6
6
 
7
7
  module AuthressSdk
8
- # A collection of users with explicit permission to a resource.
9
- class InlineResponse2006
10
- # A list of users
8
+ # A collection of user identities
9
+ class UserIdentityCollection
10
+ # A list of user identities
11
11
  attr_accessor :users
12
12
 
13
13
  attr_accessor :links
@@ -38,13 +38,13 @@ module AuthressSdk
38
38
  # @param [Hash] attributes Model attributes in the form of hash
39
39
  def initialize(attributes = {})
40
40
  if (!attributes.is_a?(Hash))
41
- fail ArgumentError, "The input argument (attributes) must be a hash in `AuthressSdk::InlineResponse2006` initialize method"
41
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AuthressSdk::UserIdentityCollection` initialize method"
42
42
  end
43
43
 
44
44
  # check to see if the attribute exists and convert string to symbol for hash key
45
45
  attributes = attributes.each_with_object({}) { |(k, v), h|
46
46
  if (!self.class.attribute_map.key?(k.to_sym))
47
- fail ArgumentError, "`#{k}` is not a valid attribute in `AuthressSdk::InlineResponse2006`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
47
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AuthressSdk::UserIdentityCollection`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
48
48
  end
49
49
  h[k.to_sym] = v
50
50
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authress-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.36.0
4
+ version: 2.0.39.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Authress
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-26 00:00:00.000000000 Z
11
+ date: 2023-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -120,6 +120,7 @@ files:
120
120
  - lib/authress-sdk/api/roles_api.rb
121
121
  - lib/authress-sdk/api/service_clients_api.rb
122
122
  - lib/authress-sdk/api/user_permissions_api.rb
123
+ - lib/authress-sdk/api/users_api.rb
123
124
  - lib/authress-sdk/api_error.rb
124
125
  - lib/authress-sdk/authress_client.rb
125
126
  - lib/authress-sdk/constant_token_provider.rb
@@ -138,26 +139,11 @@ files:
138
139
  - lib/authress-sdk/models/identity_collection.rb
139
140
  - lib/authress-sdk/models/identity_collection_identities.rb
140
141
  - lib/authress-sdk/models/identity_request.rb
141
- - lib/authress-sdk/models/inline_response_200.rb
142
- - lib/authress-sdk/models/inline_response_200_1.rb
143
- - lib/authress-sdk/models/inline_response_200_10.rb
144
- - lib/authress-sdk/models/inline_response_200_11.rb
145
- - lib/authress-sdk/models/inline_response_200_12.rb
146
- - lib/authress-sdk/models/inline_response_200_13.rb
147
- - lib/authress-sdk/models/inline_response_200_14.rb
148
- - lib/authress-sdk/models/inline_response_200_15.rb
149
- - lib/authress-sdk/models/inline_response_200_2.rb
150
- - lib/authress-sdk/models/inline_response_200_3.rb
151
- - lib/authress-sdk/models/inline_response_200_4.rb
152
- - lib/authress-sdk/models/inline_response_200_5.rb
153
- - lib/authress-sdk/models/inline_response_200_6.rb
154
- - lib/authress-sdk/models/inline_response_200_7.rb
155
- - lib/authress-sdk/models/inline_response_200_9.rb
156
142
  - lib/authress-sdk/models/invite.rb
157
143
  - lib/authress-sdk/models/link.rb
158
144
  - lib/authress-sdk/models/metadata_object.rb
145
+ - lib/authress-sdk/models/permission_collection.rb
159
146
  - lib/authress-sdk/models/permission_object.rb
160
- - lib/authress-sdk/models/permission_response.rb
161
147
  - lib/authress-sdk/models/resource_permission.rb
162
148
  - lib/authress-sdk/models/resource_permission_collection.rb
163
149
  - lib/authress-sdk/models/resource_permission_collection_links.rb
@@ -168,21 +154,13 @@ files:
168
154
  - lib/authress-sdk/models/statement.rb
169
155
  - lib/authress-sdk/models/token_request.rb
170
156
  - lib/authress-sdk/models/user.rb
157
+ - lib/authress-sdk/models/user_identity.rb
158
+ - lib/authress-sdk/models/user_identity_collection.rb
171
159
  - lib/authress-sdk/models/user_resources.rb
172
160
  - lib/authress-sdk/models/user_resources_resources.rb
173
161
  - lib/authress-sdk/models/user_token.rb
174
162
  - lib/authress-sdk/models/user_token_links.rb
175
163
  - lib/authress-sdk/models/user_token_links_self.rb
176
- - lib/authress-sdk/models/v1clients_options.rb
177
- - lib/authress-sdk/models/v1records_account.rb
178
- - lib/authress-sdk/models/v1records_links.rb
179
- - lib/authress-sdk/models/v1records_links_self.rb
180
- - lib/authress-sdk/models/v1records_users.rb
181
- - lib/authress-sdk/models/v1resourcesresource_uri_permissions.rb
182
- - lib/authress-sdk/models/v1roles_permissions.rb
183
- - lib/authress-sdk/models/v1usersuser_idresourcesresource_urimetadata_account.rb
184
- - lib/authress-sdk/models/v1usersuser_idtokens_resources.rb
185
- - lib/authress-sdk/models/v1usersuser_idtokens_statements.rb
186
164
  - lib/authress-sdk/omniauth.rb
187
165
  - lib/authress-sdk/service_client_token_provider.rb
188
166
  - lib/authress-sdk/token_validator.rb
@@ -1,240 +0,0 @@
1
- =begin
2
-
3
- =end
4
-
5
- require 'date'
6
-
7
- module AuthressSdk
8
- # A collect of permissions that the user has to a resource.
9
- class InlineResponse200
10
- attr_accessor :account
11
-
12
- attr_accessor :user_id
13
-
14
- # A list of the resources the user has some permission to.
15
- attr_accessor :resources
16
-
17
- attr_accessor :links
18
-
19
- # Attribute mapping from ruby-style variable name to JSON key.
20
- def self.attribute_map
21
- {
22
- :'account' => :'account',
23
- :'user_id' => :'userId',
24
- :'resources' => :'resources',
25
- :'links' => :'links'
26
- }
27
- end
28
-
29
- # Attribute type mapping.
30
- def self.openapi_types
31
- {
32
- :'account' => :'Object',
33
- :'user_id' => :'Object',
34
- :'resources' => :'Object',
35
- :'links' => :'Object'
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 `AuthressSdk::InlineResponse200` 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 `AuthressSdk::InlineResponse200`. 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?(:'account')
61
- self.account = attributes[:'account']
62
- end
63
-
64
- if attributes.key?(:'user_id')
65
- self.user_id = attributes[:'user_id']
66
- end
67
-
68
- if attributes.key?(:'resources')
69
- if (value = attributes[:'resources']).is_a?(Array)
70
- self.resources = value
71
- end
72
- end
73
-
74
- if attributes.key?(:'links')
75
- self.links = attributes[:'links']
76
- end
77
- end
78
-
79
- # Show invalid properties with the reasons. Usually used together with valid?
80
- # @return Array for valid properties with the reasons
81
- def list_invalid_properties
82
- invalid_properties = Array.new
83
- if @user_id.nil?
84
- invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
85
- end
86
-
87
- if @links.nil?
88
- invalid_properties.push('invalid value for "links", links cannot be nil.')
89
- end
90
-
91
- invalid_properties
92
- end
93
-
94
- # Check to see if the all the properties in the model are valid
95
- # @return true if the model is valid
96
- def valid?
97
- return false if @user_id.nil?
98
- return false if @links.nil?
99
- true
100
- end
101
-
102
- # Checks equality by comparing each attribute.
103
- # @param [Object] Object to be compared
104
- def ==(o)
105
- return true if self.equal?(o)
106
- self.class == o.class &&
107
- account == o.account &&
108
- user_id == o.user_id &&
109
- resources == o.resources &&
110
- links == o.links
111
- end
112
-
113
- # @see the `==` method
114
- # @param [Object] Object to be compared
115
- def eql?(o)
116
- self == o
117
- end
118
-
119
- # Calculates hash code according to all attributes.
120
- # @return [Integer] Hash code
121
- def hash
122
- [account, user_id, resources, links].hash
123
- end
124
-
125
- # Builds the object from hash
126
- # @param [Hash] attributes Model attributes in the form of hash
127
- # @return [Object] Returns the model itself
128
- def self.build_from_hash(attributes)
129
- new.build_from_hash(attributes)
130
- end
131
-
132
- # Builds the object from hash
133
- # @param [Hash] attributes Model attributes in the form of hash
134
- # @return [Object] Returns the model itself
135
- def build_from_hash(attributes)
136
- return nil unless attributes.is_a?(Hash)
137
- self.class.openapi_types.each_pair do |key, type|
138
- if type =~ /\AArray<(.*)>/i
139
- # check to ensure the input is an array given that the attribute
140
- # is documented as an array but the input is not
141
- if attributes[self.class.attribute_map[key]].is_a?(Array)
142
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
143
- end
144
- elsif !attributes[self.class.attribute_map[key]].nil?
145
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
146
- elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
147
- self.send("#{key}=", nil)
148
- end
149
- end
150
-
151
- self
152
- end
153
-
154
- # Deserializes the data based on type
155
- # @param string type Data type
156
- # @param string value Value to be deserialized
157
- # @return [Object] Deserialized data
158
- def _deserialize(type, value)
159
- case type.to_sym
160
- when :DateTime
161
- DateTime.parse(value)
162
- when :Date
163
- Date.parse(value)
164
- when :String
165
- value.to_s
166
- when :Integer
167
- value.to_i
168
- when :Float
169
- value.to_f
170
- when :Boolean
171
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
172
- true
173
- else
174
- false
175
- end
176
- when :Object
177
- # generic object (usually a Hash), return directly
178
- value
179
- when /\AArray<(?<inner_type>.+)>\z/
180
- inner_type = Regexp.last_match[:inner_type]
181
- value.map { |v| _deserialize(inner_type, v) }
182
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
183
- k_type = Regexp.last_match[:k_type]
184
- v_type = Regexp.last_match[:v_type]
185
- {}.tap do |hash|
186
- value.each do |k, v|
187
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
188
- end
189
- end
190
- else # model
191
- AuthressSdk.const_get(type).build_from_hash(value)
192
- end
193
- end
194
-
195
- # Returns the string representation of the object
196
- # @return [String] String presentation of the object
197
- def to_s
198
- to_hash.to_s
199
- end
200
-
201
- # to_body is an alias to to_hash (backward compatibility)
202
- # @return [Hash] Returns the object in the form of hash
203
- def to_body
204
- to_hash
205
- end
206
-
207
- # Returns the object in the form of hash
208
- # @return [Hash] Returns the object in the form of hash
209
- def to_hash
210
- hash = {}
211
- self.class.attribute_map.each_pair do |attr, param|
212
- value = self.send(attr)
213
- if value.nil?
214
- is_nullable = self.class.openapi_nullable.include?(attr)
215
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
- end
217
-
218
- hash[param] = _to_hash(value)
219
- end
220
- hash
221
- end
222
-
223
- # Outputs non-array value in the form of hash
224
- # For object, use to_hash. Otherwise, just return the value
225
- # @param [Object] value Any valid value
226
- # @return [Hash] Returns the value in the form of hash
227
- def _to_hash(value)
228
- if value.is_a?(Array)
229
- value.compact.map { |v| _to_hash(v) }
230
- elsif value.is_a?(Hash)
231
- {}.tap do |hash|
232
- value.each { |k, v| hash[k] = _to_hash(v) }
233
- end
234
- elsif value.respond_to? :to_hash
235
- value.to_hash
236
- else
237
- value
238
- end
239
- end end
240
- end