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.
- checksums.yaml +4 -4
- data/README.md +9 -11
- data/lib/authress_sdk/api/access_records_api.rb +9 -9
- data/lib/authress_sdk/models/access_record.rb +13 -1
- data/lib/authress_sdk/service_client_token_provider.rb +1 -0
- metadata +9 -36
- data/lib/authress_sdk/models/access_record_collection_records.rb +0 -344
- data/lib/authress_sdk/models/body.rb +0 -229
- data/lib/authress_sdk/models/body_1.rb +0 -222
- data/lib/authress_sdk/models/body_10.rb +0 -239
- data/lib/authress_sdk/models/body_11.rb +0 -239
- data/lib/authress_sdk/models/body_2.rb +0 -206
- data/lib/authress_sdk/models/body_3.rb +0 -344
- data/lib/authress_sdk/models/body_4.rb +0 -344
- data/lib/authress_sdk/models/body_5.rb +0 -218
- data/lib/authress_sdk/models/body_6.rb +0 -248
- data/lib/authress_sdk/models/body_7.rb +0 -248
- data/lib/authress_sdk/models/body_8.rb +0 -220
- data/lib/authress_sdk/models/body_9.rb +0 -216
- data/lib/authress_sdk/models/inline_response_200_8.rb +0 -344
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3c95b25f7727e7f6b90209419704f659a8738dd52ebaad303401b444cf90e7f
|
4
|
+
data.tar.gz: 7d401c5035c2228c58963a05c594fe76246353b60cb07c30502c15b02f492d66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5800a573207985a6a2a27f9b51b7df07986e70c47f33b32d3f5851d12d91a8876e82ca3594e62cf1709d8147e39cd575dda1a93c43ffb47b9684ff6caa2135bf
|
7
|
+
data.tar.gz: b923b90bf8dead1f91fdc22f0f0b8f25fb022ba9e29ef01479073e15a44c64bcdf92534d4fa03f002d4b372cfce099b4589525925501fe5a6e0c2793b80c2638
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# Authress SDK for Ruby
|
2
2
|
This is the Authress SDK used to integrate with the authorization as a service provider Authress at https://authress.io.
|
3
3
|
|
4
4
|
[](http://badge.fury.io/rb/authress-sdk)
|
@@ -22,9 +22,10 @@ require 'authress-sdk'
|
|
22
22
|
require 'authress-sdk'
|
23
23
|
|
24
24
|
# create an instance of the API class during service initialization
|
25
|
-
# Replace
|
25
|
+
# Replace the base_url with the custom Authress domain for your account
|
26
|
+
# https://authress.io/app/#/settings?focus=domain
|
26
27
|
AuthressSdk.configure do |config|
|
27
|
-
config.base_url = 'https://
|
28
|
+
config.base_url = 'https://login.company.com'
|
28
29
|
end
|
29
30
|
|
30
31
|
# on api route
|
@@ -65,7 +66,7 @@ require 'authress-sdk'
|
|
65
66
|
# Create a service client in the Authress management portal and past the access token here
|
66
67
|
# This will generate a token automatically instead of passing the user token to the api
|
67
68
|
AuthressSdk.configure do |config|
|
68
|
-
config.base_url = 'https://
|
69
|
+
config.base_url = 'https://login.company.com'
|
69
70
|
client_access_key = 'eyJrZXlJ....'
|
70
71
|
config.token_provider = AuthressSdk::ServiceClientTokenProvider.new(client_access_key)
|
71
72
|
end
|
@@ -78,7 +79,7 @@ def getResource(resourceId) {
|
|
78
79
|
resource_uri = "resources/#{resourceId}" # String | The uri path of a resource to validate, must be URL encoded, uri segments are allowed, the resource must be a full path, and permissions are not inherited by sub-resources.
|
79
80
|
permission = 'READ' # String | Permission to check, '*' and scoped permissions can also be checked here.
|
80
81
|
begin
|
81
|
-
#Check to see if a user has permissions to a resource.
|
82
|
+
# Check to see if a user has permissions to a resource.
|
82
83
|
api_instance = AuthressSdk::UserPermissionsApi.new
|
83
84
|
api_instance.authorize_user(user_id, resource_uri, permission)
|
84
85
|
rescue AuthressSdk::ApiError => e
|
@@ -103,8 +104,8 @@ You may receive **User does not have sufficient access to grant permissions to r
|
|
103
104
|
require 'authress-sdk'
|
104
105
|
|
105
106
|
begin
|
106
|
-
#Create a new access record.
|
107
|
-
new_record = AuthressSdk::
|
107
|
+
# Create a new access record.
|
108
|
+
new_record = AuthressSdk::AccessRecord.new {
|
108
109
|
name: "Access To New Resource #{NewResourceId}",
|
109
110
|
users: [{ userId: requestUserId }],
|
110
111
|
statements: [{
|
@@ -120,7 +121,4 @@ rescue AuthressSdk::ApiError => e
|
|
120
121
|
puts "Exception when calling AccessRecordsApi->create_record: #{e}"
|
121
122
|
raise
|
122
123
|
end
|
123
|
-
```
|
124
|
-
|
125
|
-
### Early release
|
126
|
-
* Add in access_token handling to client
|
124
|
+
```
|
@@ -127,7 +127,7 @@ module AuthressSdk
|
|
127
127
|
# Specify user roles for specific resources. (Records have a maximum size of ~100KB) <br><span class=\"badge badge-outline-secondary\">GRANT: Existing Resource Permissions</span>
|
128
128
|
# @param body
|
129
129
|
# @param [Hash] opts the optional parameters
|
130
|
-
# @return [
|
130
|
+
# @return [AccessRecord]
|
131
131
|
def create_record(body, opts = {})
|
132
132
|
data, _status_code, _headers = create_record_with_http_info(body, opts)
|
133
133
|
data
|
@@ -137,7 +137,7 @@ module AuthressSdk
|
|
137
137
|
# Specify user roles for specific resources. (Records have a maximum size of ~100KB) <br><span class=\"badge badge-outline-secondary\">GRANT: Existing Resource Permissions</span>
|
138
138
|
# @param body
|
139
139
|
# @param [Hash] opts the optional parameters
|
140
|
-
# @return [Array<(
|
140
|
+
# @return [Array<(AccessRecord, Integer, Hash)>] AccessRecord data, response status code and response headers
|
141
141
|
def create_record_with_http_info(body, opts = {})
|
142
142
|
if @authress_client.config.debugging
|
143
143
|
@authress_client.config.logger.debug 'Calling API: AccessRecordsApi.create_record ...'
|
@@ -165,7 +165,7 @@ module AuthressSdk
|
|
165
165
|
# http body (model)
|
166
166
|
post_body = opts[:body] || @authress_client.object_to_http_body(body)
|
167
167
|
|
168
|
-
return_type = opts[:return_type] || '
|
168
|
+
return_type = opts[:return_type] || 'AccessRecord'
|
169
169
|
|
170
170
|
auth_names = opts[:auth_names] || ['oauth2']
|
171
171
|
data, status_code, headers = @authress_client.call_api(:POST, local_var_path,
|
@@ -293,7 +293,7 @@ module AuthressSdk
|
|
293
293
|
# Access records contain information assigning permissions to users for resources. <br><span class=\"badge badge-outline-secondary\">READ (or Admin): Authress:AccessRecords/{recordId}</span>
|
294
294
|
# @param record_id The identifier of the access record.
|
295
295
|
# @param [Hash] opts the optional parameters
|
296
|
-
# @return [
|
296
|
+
# @return [AccessRecord]
|
297
297
|
def get_record(record_id, opts = {})
|
298
298
|
data, _status_code, _headers = get_record_with_http_info(record_id, opts)
|
299
299
|
data
|
@@ -303,7 +303,7 @@ module AuthressSdk
|
|
303
303
|
# Access records contain information assigning permissions to users for resources. <br><span class=\"badge badge-outline-secondary\">READ (or Admin): Authress:AccessRecords/{recordId}</span>
|
304
304
|
# @param record_id The identifier of the access record.
|
305
305
|
# @param [Hash] opts the optional parameters
|
306
|
-
# @return [Array<(
|
306
|
+
# @return [Array<(AccessRecord, Integer, Hash)>] AccessRecord data, response status code and response headers
|
307
307
|
def get_record_with_http_info(record_id, opts = {})
|
308
308
|
if @authress_client.config.debugging
|
309
309
|
@authress_client.config.logger.debug 'Calling API: AccessRecordsApi.get_record ...'
|
@@ -329,7 +329,7 @@ module AuthressSdk
|
|
329
329
|
# http body (model)
|
330
330
|
post_body = opts[:body]
|
331
331
|
|
332
|
-
return_type = opts[:return_type] || '
|
332
|
+
return_type = opts[:return_type] || 'AccessRecord'
|
333
333
|
|
334
334
|
auth_names = opts[:auth_names] || ['oauth2']
|
335
335
|
data, status_code, headers = @authress_client.call_api(:GET, local_var_path,
|
@@ -471,7 +471,7 @@ module AuthressSdk
|
|
471
471
|
# @param body
|
472
472
|
# @param record_id The identifier of the access record.
|
473
473
|
# @param [Hash] opts the optional parameters
|
474
|
-
# @return [
|
474
|
+
# @return [AccessRecord]
|
475
475
|
def update_record(body, record_id, opts = {})
|
476
476
|
data, _status_code, _headers = update_record_with_http_info(body, record_id, opts)
|
477
477
|
data
|
@@ -482,7 +482,7 @@ module AuthressSdk
|
|
482
482
|
# @param body
|
483
483
|
# @param record_id The identifier of the access record.
|
484
484
|
# @param [Hash] opts the optional parameters
|
485
|
-
# @return [Array<(
|
485
|
+
# @return [Array<(AccessRecord, Integer, Hash)>] AccessRecord data, response status code and response headers
|
486
486
|
def update_record_with_http_info(body, record_id, opts = {})
|
487
487
|
if @authress_client.config.debugging
|
488
488
|
@authress_client.config.logger.debug 'Calling API: AccessRecordsApi.update_record ...'
|
@@ -514,7 +514,7 @@ module AuthressSdk
|
|
514
514
|
# http body (model)
|
515
515
|
post_body = opts[:body] || @authress_client.object_to_http_body(body)
|
516
516
|
|
517
|
-
return_type = opts[:return_type] || '
|
517
|
+
return_type = opts[:return_type] || 'AccessRecord'
|
518
518
|
|
519
519
|
auth_names = opts[:auth_names] || ['oauth2']
|
520
520
|
data, status_code, headers = @authress_client.call_api(:PUT, local_var_path,
|
@@ -24,6 +24,9 @@ module AuthressSdk
|
|
24
24
|
# The list of users this record applies to
|
25
25
|
attr_accessor :users
|
26
26
|
|
27
|
+
# The list of groups this record applies to. Users in these groups will be receive access to the resources listed.
|
28
|
+
attr_accessor :groups
|
29
|
+
|
27
30
|
# The list of admin that can edit this record even if they do not have global record edit permissions.
|
28
31
|
attr_accessor :admins
|
29
32
|
|
@@ -63,6 +66,7 @@ module AuthressSdk
|
|
63
66
|
:'status' => :'status',
|
64
67
|
:'account' => :'account',
|
65
68
|
:'users' => :'users',
|
69
|
+
:'groups' => :'groups',
|
66
70
|
:'admins' => :'admins',
|
67
71
|
:'statements' => :'statements',
|
68
72
|
:'links' => :'links'
|
@@ -78,6 +82,7 @@ module AuthressSdk
|
|
78
82
|
:'status' => :'Object',
|
79
83
|
:'account' => :'Object',
|
80
84
|
:'users' => :'Object',
|
85
|
+
:'groups' => :'Object',
|
81
86
|
:'admins' => :'Object',
|
82
87
|
:'statements' => :'Object',
|
83
88
|
:'links' => :'Object'
|
@@ -131,6 +136,12 @@ module AuthressSdk
|
|
131
136
|
end
|
132
137
|
end
|
133
138
|
|
139
|
+
if attributes.key?(:'groups')
|
140
|
+
if (value = attributes[:'groups']).is_a?(Array)
|
141
|
+
self.groups = value
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
134
145
|
if attributes.key?(:'admins')
|
135
146
|
if (value = attributes[:'admins']).is_a?(Array)
|
136
147
|
self.admins = value
|
@@ -209,6 +220,7 @@ module AuthressSdk
|
|
209
220
|
status == o.status &&
|
210
221
|
account == o.account &&
|
211
222
|
users == o.users &&
|
223
|
+
groups == o.groups &&
|
212
224
|
admins == o.admins &&
|
213
225
|
statements == o.statements &&
|
214
226
|
links == o.links
|
@@ -223,7 +235,7 @@ module AuthressSdk
|
|
223
235
|
# Calculates hash code according to all attributes.
|
224
236
|
# @return [Integer] Hash code
|
225
237
|
def hash
|
226
|
-
[record_id, name, description, status, account, users, admins, statements, links].hash
|
238
|
+
[record_id, name, description, status, account, users, groups, admins, statements, links].hash
|
227
239
|
end
|
228
240
|
|
229
241
|
# Builds the object from hash
|
metadata
CHANGED
@@ -1,23 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authress-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.29.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Rhosys
|
8
7
|
- Authress
|
9
|
-
autorequire:
|
8
|
+
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2023-03-24 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: typhoeus
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
16
|
requirements:
|
18
|
-
- - "~>"
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '1.0'
|
21
17
|
- - ">="
|
22
18
|
- !ruby/object:Gem::Version
|
23
19
|
version: 1.0.1
|
@@ -25,9 +21,6 @@ dependencies:
|
|
25
21
|
prerelease: false
|
26
22
|
version_requirements: !ruby/object:Gem::Requirement
|
27
23
|
requirements:
|
28
|
-
- - "~>"
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
version: '1.0'
|
31
24
|
- - ">="
|
32
25
|
- !ruby/object:Gem::Version
|
33
26
|
version: 1.0.1
|
@@ -55,22 +48,16 @@ dependencies:
|
|
55
48
|
name: rspec
|
56
49
|
requirement: !ruby/object:Gem::Requirement
|
57
50
|
requirements:
|
58
|
-
- - "~>"
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '3.6'
|
61
51
|
- - ">="
|
62
52
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
53
|
+
version: '0'
|
64
54
|
type: :development
|
65
55
|
prerelease: false
|
66
56
|
version_requirements: !ruby/object:Gem::Requirement
|
67
57
|
requirements:
|
68
|
-
- - "~>"
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: '3.6'
|
71
58
|
- - ">="
|
72
59
|
- !ruby/object:Gem::Version
|
73
|
-
version:
|
60
|
+
version: '0'
|
74
61
|
description: " This is the Authress SDK used to integrate with the authorization
|
75
62
|
as a service provider Authress at https://authress.io. The full documentation is
|
76
63
|
available in the Github repo Readme: https://github.com/Authress/authress-sdk.rb.\n"
|
@@ -95,22 +82,9 @@ files:
|
|
95
82
|
- lib/authress_sdk/constant_token_provider.rb
|
96
83
|
- lib/authress_sdk/models/access_record.rb
|
97
84
|
- lib/authress_sdk/models/access_record_collection.rb
|
98
|
-
- lib/authress_sdk/models/access_record_collection_records.rb
|
99
85
|
- lib/authress_sdk/models/account.rb
|
100
86
|
- lib/authress_sdk/models/account_collection.rb
|
101
87
|
- lib/authress_sdk/models/account_collection_accounts.rb
|
102
|
-
- lib/authress_sdk/models/body.rb
|
103
|
-
- lib/authress_sdk/models/body_1.rb
|
104
|
-
- lib/authress_sdk/models/body_10.rb
|
105
|
-
- lib/authress_sdk/models/body_11.rb
|
106
|
-
- lib/authress_sdk/models/body_2.rb
|
107
|
-
- lib/authress_sdk/models/body_3.rb
|
108
|
-
- lib/authress_sdk/models/body_4.rb
|
109
|
-
- lib/authress_sdk/models/body_5.rb
|
110
|
-
- lib/authress_sdk/models/body_6.rb
|
111
|
-
- lib/authress_sdk/models/body_7.rb
|
112
|
-
- lib/authress_sdk/models/body_8.rb
|
113
|
-
- lib/authress_sdk/models/body_9.rb
|
114
88
|
- lib/authress_sdk/models/claim_request.rb
|
115
89
|
- lib/authress_sdk/models/claim_response.rb
|
116
90
|
- lib/authress_sdk/models/client.rb
|
@@ -135,7 +109,6 @@ files:
|
|
135
109
|
- lib/authress_sdk/models/inline_response_200_5.rb
|
136
110
|
- lib/authress_sdk/models/inline_response_200_6.rb
|
137
111
|
- lib/authress_sdk/models/inline_response_200_7.rb
|
138
|
-
- lib/authress_sdk/models/inline_response_200_8.rb
|
139
112
|
- lib/authress_sdk/models/inline_response_200_9.rb
|
140
113
|
- lib/authress_sdk/models/invite.rb
|
141
114
|
- lib/authress_sdk/models/link.rb
|
@@ -178,7 +151,7 @@ metadata:
|
|
178
151
|
homepage_uri: https://github.com/Authress/authress-sdk.rb
|
179
152
|
source_code_uri: https://github.com/Authress/authress-sdk.rb
|
180
153
|
wiki_uri: https://github.com/Authress/authress-sdk.rb/wiki
|
181
|
-
post_install_message:
|
154
|
+
post_install_message:
|
182
155
|
rdoc_options: []
|
183
156
|
require_paths:
|
184
157
|
- lib
|
@@ -186,15 +159,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
186
159
|
requirements:
|
187
160
|
- - ">="
|
188
161
|
- !ruby/object:Gem::Version
|
189
|
-
version: '
|
162
|
+
version: '3.0'
|
190
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
191
164
|
requirements:
|
192
165
|
- - ">="
|
193
166
|
- !ruby/object:Gem::Version
|
194
167
|
version: '0'
|
195
168
|
requirements: []
|
196
|
-
rubygems_version: 3.
|
197
|
-
signing_key:
|
169
|
+
rubygems_version: 3.4.6
|
170
|
+
signing_key:
|
198
171
|
specification_version: 4
|
199
172
|
summary: The Authress SDK for Ruby provides authorization as a service with fully
|
200
173
|
compatible REST apis.
|
@@ -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 AccessRecordCollectionRecords
|
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::AccessRecordCollectionRecords` 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::AccessRecordCollectionRecords`. 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
|