pescheck 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +193 -0
  4. data/Rakefile +10 -0
  5. data/docs/AuthenticationApi.md +217 -0
  6. data/docs/ChecksApi.md +147 -0
  7. data/docs/CustomTokenObtainPair.md +20 -0
  8. data/docs/DivisionReadOnly.md +46 -0
  9. data/docs/DivisionWrite.md +40 -0
  10. data/docs/DivisionsApi.md +369 -0
  11. data/docs/JWTGeneration.md +24 -0
  12. data/docs/JWTResponse.md +28 -0
  13. data/docs/OAuthApi.md +213 -0
  14. data/docs/OAuthApplication.md +26 -0
  15. data/docs/OAuthApplicationResponse.md +32 -0
  16. data/docs/PaginatedDivisionReadOnlyList.md +24 -0
  17. data/docs/PaginatedV2ProfileListItemList.md +24 -0
  18. data/docs/PaginatedV2ScreeningListItemList.md +24 -0
  19. data/docs/PatchedDivisionWrite.md +40 -0
  20. data/docs/PatchedV2ProfilePartialUpdate.md +20 -0
  21. data/docs/ProfilesApi.md +438 -0
  22. data/docs/ScreeningsApi.md +293 -0
  23. data/docs/TokenRefresh.md +20 -0
  24. data/docs/V2Candidate.md +36 -0
  25. data/docs/V2CheckField.md +26 -0
  26. data/docs/V2CheckInfo.md +40 -0
  27. data/docs/V2Document.md +28 -0
  28. data/docs/V2DocumentContent.md +20 -0
  29. data/docs/V2Money.md +20 -0
  30. data/docs/V2ProfileCheck.md +20 -0
  31. data/docs/V2ProfileCheckEntry.md +30 -0
  32. data/docs/V2ProfileCreate.md +22 -0
  33. data/docs/V2ProfileDetail.md +38 -0
  34. data/docs/V2ProfileListItem.md +30 -0
  35. data/docs/V2ProfileUpdate.md +22 -0
  36. data/docs/V2ProfileUpdateCheck.md +22 -0
  37. data/docs/V2ScreeningCheck.md +24 -0
  38. data/docs/V2ScreeningCheckEntry.md +34 -0
  39. data/docs/V2ScreeningCheckListItem.md +22 -0
  40. data/docs/V2ScreeningCreate.md +22 -0
  41. data/docs/V2ScreeningDetail.md +34 -0
  42. data/docs/V2ScreeningDetailProfile.md +20 -0
  43. data/docs/V2ScreeningListItem.md +34 -0
  44. data/docs/VerifyWebhook.md +18 -0
  45. data/docs/Webhook.md +26 -0
  46. data/docs/WebhookResponse.md +36 -0
  47. data/docs/WebhooksApi.md +290 -0
  48. data/git_push.sh +57 -0
  49. data/lib/pescheck/api/authentication_api.rb +220 -0
  50. data/lib/pescheck/api/checks_api.rb +144 -0
  51. data/lib/pescheck/api/divisions_api.rb +365 -0
  52. data/lib/pescheck/api/o_auth_api.rb +202 -0
  53. data/lib/pescheck/api/profiles_api.rb +432 -0
  54. data/lib/pescheck/api/screenings_api.rb +288 -0
  55. data/lib/pescheck/api/webhooks_api.rb +278 -0
  56. data/lib/pescheck/api_client.rb +441 -0
  57. data/lib/pescheck/api_error.rb +58 -0
  58. data/lib/pescheck/api_model_base.rb +88 -0
  59. data/lib/pescheck/configuration.rb +429 -0
  60. data/lib/pescheck/models/custom_token_obtain_pair.rb +191 -0
  61. data/lib/pescheck/models/division_read_only.rb +469 -0
  62. data/lib/pescheck/models/division_write.rb +436 -0
  63. data/lib/pescheck/models/jwt_generation.rb +213 -0
  64. data/lib/pescheck/models/jwt_response.rb +285 -0
  65. data/lib/pescheck/models/o_auth_application.rb +265 -0
  66. data/lib/pescheck/models/o_auth_application_response.rb +379 -0
  67. data/lib/pescheck/models/paginated_division_read_only_list.rb +216 -0
  68. data/lib/pescheck/models/paginated_v2_profile_list_item_list.rb +216 -0
  69. data/lib/pescheck/models/paginated_v2_screening_list_item_list.rb +216 -0
  70. data/lib/pescheck/models/patched_division_write.rb +360 -0
  71. data/lib/pescheck/models/patched_v2_profile_partial_update.rb +176 -0
  72. data/lib/pescheck/models/token_refresh.rb +173 -0
  73. data/lib/pescheck/models/v2_candidate.rb +390 -0
  74. data/lib/pescheck/models/v2_check_field.rb +246 -0
  75. data/lib/pescheck/models/v2_check_info.rb +438 -0
  76. data/lib/pescheck/models/v2_document.rb +308 -0
  77. data/lib/pescheck/models/v2_document_content.rb +175 -0
  78. data/lib/pescheck/models/v2_money.rb +210 -0
  79. data/lib/pescheck/models/v2_profile_check.rb +201 -0
  80. data/lib/pescheck/models/v2_profile_check_entry.rb +349 -0
  81. data/lib/pescheck/models/v2_profile_create.rb +212 -0
  82. data/lib/pescheck/models/v2_profile_detail.rb +401 -0
  83. data/lib/pescheck/models/v2_profile_list_item.rb +291 -0
  84. data/lib/pescheck/models/v2_profile_update.rb +213 -0
  85. data/lib/pescheck/models/v2_profile_update_check.rb +210 -0
  86. data/lib/pescheck/models/v2_screening_check.rb +221 -0
  87. data/lib/pescheck/models/v2_screening_check_entry.rb +376 -0
  88. data/lib/pescheck/models/v2_screening_check_list_item.rb +242 -0
  89. data/lib/pescheck/models/v2_screening_create.rb +201 -0
  90. data/lib/pescheck/models/v2_screening_detail.rb +348 -0
  91. data/lib/pescheck/models/v2_screening_detail_profile.rb +156 -0
  92. data/lib/pescheck/models/v2_screening_list_item.rb +330 -0
  93. data/lib/pescheck/models/verify_webhook.rb +166 -0
  94. data/lib/pescheck/models/webhook.rb +265 -0
  95. data/lib/pescheck/models/webhook_response.rb +353 -0
  96. data/lib/pescheck/version.rb +15 -0
  97. data/lib/pescheck.rb +83 -0
  98. data/pescheck.gemspec +41 -0
  99. data/spec/api/authentication_api_spec.rb +68 -0
  100. data/spec/api/checks_api_spec.rb +56 -0
  101. data/spec/api/divisions_api_spec.rb +94 -0
  102. data/spec/api/o_auth_api_spec.rb +67 -0
  103. data/spec/api/profiles_api_spec.rb +105 -0
  104. data/spec/api/screenings_api_spec.rb +81 -0
  105. data/spec/api/webhooks_api_spec.rb +81 -0
  106. data/spec/models/custom_token_obtain_pair_spec.rb +42 -0
  107. data/spec/models/division_read_only_spec.rb +120 -0
  108. data/spec/models/division_write_spec.rb +102 -0
  109. data/spec/models/jwt_generation_spec.rb +54 -0
  110. data/spec/models/jwt_response_spec.rb +66 -0
  111. data/spec/models/o_auth_application_response_spec.rb +86 -0
  112. data/spec/models/o_auth_application_spec.rb +68 -0
  113. data/spec/models/paginated_division_read_only_list_spec.rb +54 -0
  114. data/spec/models/paginated_v2_profile_list_item_list_spec.rb +54 -0
  115. data/spec/models/paginated_v2_screening_list_item_list_spec.rb +54 -0
  116. data/spec/models/patched_division_write_spec.rb +102 -0
  117. data/spec/models/patched_v2_profile_partial_update_spec.rb +42 -0
  118. data/spec/models/token_refresh_spec.rb +42 -0
  119. data/spec/models/v2_candidate_spec.rb +94 -0
  120. data/spec/models/v2_check_field_spec.rb +60 -0
  121. data/spec/models/v2_check_info_spec.rb +102 -0
  122. data/spec/models/v2_document_content_spec.rb +42 -0
  123. data/spec/models/v2_document_spec.rb +70 -0
  124. data/spec/models/v2_money_spec.rb +42 -0
  125. data/spec/models/v2_profile_check_entry_spec.rb +76 -0
  126. data/spec/models/v2_profile_check_spec.rb +46 -0
  127. data/spec/models/v2_profile_create_spec.rb +48 -0
  128. data/spec/models/v2_profile_detail_spec.rb +96 -0
  129. data/spec/models/v2_profile_list_item_spec.rb +72 -0
  130. data/spec/models/v2_profile_update_check_spec.rb +52 -0
  131. data/spec/models/v2_profile_update_spec.rb +48 -0
  132. data/spec/models/v2_screening_check_entry_spec.rb +88 -0
  133. data/spec/models/v2_screening_check_list_item_spec.rb +52 -0
  134. data/spec/models/v2_screening_check_spec.rb +58 -0
  135. data/spec/models/v2_screening_create_spec.rb +48 -0
  136. data/spec/models/v2_screening_detail_profile_spec.rb +42 -0
  137. data/spec/models/v2_screening_detail_spec.rb +84 -0
  138. data/spec/models/v2_screening_list_item_spec.rb +84 -0
  139. data/spec/models/verify_webhook_spec.rb +36 -0
  140. data/spec/models/webhook_response_spec.rb +90 -0
  141. data/spec/models/webhook_spec.rb +64 -0
  142. data/spec/spec_helper.rb +111 -0
  143. metadata +302 -0
@@ -0,0 +1,285 @@
1
+ =begin
2
+ #Pescheck API
3
+
4
+ #API for Pescheck ## Authentication This API supports three authentication methods: 1. **OAuth2** (recommended for API clients) - Use client credentials flow 2. **JWT Bearer** (for user-based access) - Obtain tokens via /api/jwt/ endpoint 3. **Cookie** (for browser-based access) - Session authentication via web login ## Quick Start for API Clients 1. Select your environment from the servers dropdown 2. Use OAuth2 with client credentials flow 3. Scopes are automatically included: read:api, create:api, update:api
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.23.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Pescheck
17
+ # Serializer for JWT token response
18
+ class JWTResponse < ApiModelBase
19
+ # JWT access token
20
+ attr_accessor :access_token
21
+
22
+ # JWT refresh token
23
+ attr_accessor :refresh_token
24
+
25
+ attr_accessor :token_type
26
+
27
+ # Access token expiration in seconds
28
+ attr_accessor :expires_in
29
+
30
+ # Organization name
31
+ attr_accessor :organisation
32
+
33
+ # Organization ID
34
+ attr_accessor :organisation_id
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'access_token' => :'access_token',
40
+ :'refresh_token' => :'refresh_token',
41
+ :'token_type' => :'token_type',
42
+ :'expires_in' => :'expires_in',
43
+ :'organisation' => :'organisation',
44
+ :'organisation_id' => :'organisation_id'
45
+ }
46
+ end
47
+
48
+ # Returns attribute mapping this model knows about
49
+ def self.acceptable_attribute_map
50
+ attribute_map
51
+ end
52
+
53
+ # Returns all the JSON keys this model knows about
54
+ def self.acceptable_attributes
55
+ acceptable_attribute_map.values
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.openapi_types
60
+ {
61
+ :'access_token' => :'String',
62
+ :'refresh_token' => :'String',
63
+ :'token_type' => :'String',
64
+ :'expires_in' => :'Integer',
65
+ :'organisation' => :'String',
66
+ :'organisation_id' => :'String'
67
+ }
68
+ end
69
+
70
+ # List of attributes with nullable: true
71
+ def self.openapi_nullable
72
+ Set.new([
73
+ ])
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Pescheck::JWTResponse` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ acceptable_attribute_map = self.class.acceptable_attribute_map
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!acceptable_attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Pescheck::JWTResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'access_token')
93
+ self.access_token = attributes[:'access_token']
94
+ else
95
+ self.access_token = nil
96
+ end
97
+
98
+ if attributes.key?(:'refresh_token')
99
+ self.refresh_token = attributes[:'refresh_token']
100
+ else
101
+ self.refresh_token = nil
102
+ end
103
+
104
+ if attributes.key?(:'token_type')
105
+ self.token_type = attributes[:'token_type']
106
+ else
107
+ self.token_type = 'Bearer'
108
+ end
109
+
110
+ if attributes.key?(:'expires_in')
111
+ self.expires_in = attributes[:'expires_in']
112
+ else
113
+ self.expires_in = nil
114
+ end
115
+
116
+ if attributes.key?(:'organisation')
117
+ self.organisation = attributes[:'organisation']
118
+ else
119
+ self.organisation = nil
120
+ end
121
+
122
+ if attributes.key?(:'organisation_id')
123
+ self.organisation_id = attributes[:'organisation_id']
124
+ else
125
+ self.organisation_id = nil
126
+ end
127
+ end
128
+
129
+ # Show invalid properties with the reasons. Usually used together with valid?
130
+ # @return Array for valid properties with the reasons
131
+ def list_invalid_properties
132
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
133
+ invalid_properties = Array.new
134
+ if @access_token.nil?
135
+ invalid_properties.push('invalid value for "access_token", access_token cannot be nil.')
136
+ end
137
+
138
+ if @refresh_token.nil?
139
+ invalid_properties.push('invalid value for "refresh_token", refresh_token cannot be nil.')
140
+ end
141
+
142
+ if @expires_in.nil?
143
+ invalid_properties.push('invalid value for "expires_in", expires_in cannot be nil.')
144
+ end
145
+
146
+ if @organisation.nil?
147
+ invalid_properties.push('invalid value for "organisation", organisation cannot be nil.')
148
+ end
149
+
150
+ if @organisation_id.nil?
151
+ invalid_properties.push('invalid value for "organisation_id", organisation_id cannot be nil.')
152
+ end
153
+
154
+ invalid_properties
155
+ end
156
+
157
+ # Check to see if the all the properties in the model are valid
158
+ # @return true if the model is valid
159
+ def valid?
160
+ warn '[DEPRECATED] the `valid?` method is obsolete'
161
+ return false if @access_token.nil?
162
+ return false if @refresh_token.nil?
163
+ return false if @expires_in.nil?
164
+ return false if @organisation.nil?
165
+ return false if @organisation_id.nil?
166
+ true
167
+ end
168
+
169
+ # Custom attribute writer method with validation
170
+ # @param [Object] access_token Value to be assigned
171
+ def access_token=(access_token)
172
+ if access_token.nil?
173
+ fail ArgumentError, 'access_token cannot be nil'
174
+ end
175
+
176
+ @access_token = access_token
177
+ end
178
+
179
+ # Custom attribute writer method with validation
180
+ # @param [Object] refresh_token Value to be assigned
181
+ def refresh_token=(refresh_token)
182
+ if refresh_token.nil?
183
+ fail ArgumentError, 'refresh_token cannot be nil'
184
+ end
185
+
186
+ @refresh_token = refresh_token
187
+ end
188
+
189
+ # Custom attribute writer method with validation
190
+ # @param [Object] expires_in Value to be assigned
191
+ def expires_in=(expires_in)
192
+ if expires_in.nil?
193
+ fail ArgumentError, 'expires_in cannot be nil'
194
+ end
195
+
196
+ @expires_in = expires_in
197
+ end
198
+
199
+ # Custom attribute writer method with validation
200
+ # @param [Object] organisation Value to be assigned
201
+ def organisation=(organisation)
202
+ if organisation.nil?
203
+ fail ArgumentError, 'organisation cannot be nil'
204
+ end
205
+
206
+ @organisation = organisation
207
+ end
208
+
209
+ # Custom attribute writer method with validation
210
+ # @param [Object] organisation_id Value to be assigned
211
+ def organisation_id=(organisation_id)
212
+ if organisation_id.nil?
213
+ fail ArgumentError, 'organisation_id cannot be nil'
214
+ end
215
+
216
+ @organisation_id = organisation_id
217
+ end
218
+
219
+ # Checks equality by comparing each attribute.
220
+ # @param [Object] Object to be compared
221
+ def ==(o)
222
+ return true if self.equal?(o)
223
+ self.class == o.class &&
224
+ access_token == o.access_token &&
225
+ refresh_token == o.refresh_token &&
226
+ token_type == o.token_type &&
227
+ expires_in == o.expires_in &&
228
+ organisation == o.organisation &&
229
+ organisation_id == o.organisation_id
230
+ end
231
+
232
+ # @see the `==` method
233
+ # @param [Object] Object to be compared
234
+ def eql?(o)
235
+ self == o
236
+ end
237
+
238
+ # Calculates hash code according to all attributes.
239
+ # @return [Integer] Hash code
240
+ def hash
241
+ [access_token, refresh_token, token_type, expires_in, organisation, organisation_id].hash
242
+ end
243
+
244
+ # Builds the object from hash
245
+ # @param [Hash] attributes Model attributes in the form of hash
246
+ # @return [Object] Returns the model itself
247
+ def self.build_from_hash(attributes)
248
+ return nil unless attributes.is_a?(Hash)
249
+ attributes = attributes.transform_keys(&:to_sym)
250
+ transformed_hash = {}
251
+ openapi_types.each_pair do |key, type|
252
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
253
+ transformed_hash["#{key}"] = nil
254
+ elsif type =~ /\AArray<(.*)>/i
255
+ # check to ensure the input is an array given that the attribute
256
+ # is documented as an array but the input is not
257
+ if attributes[attribute_map[key]].is_a?(Array)
258
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
259
+ end
260
+ elsif !attributes[attribute_map[key]].nil?
261
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
262
+ end
263
+ end
264
+ new(transformed_hash)
265
+ end
266
+
267
+ # Returns the object in the form of hash
268
+ # @return [Hash] Returns the object in the form of hash
269
+ def to_hash
270
+ hash = {}
271
+ self.class.attribute_map.each_pair do |attr, param|
272
+ value = self.send(attr)
273
+ if value.nil?
274
+ is_nullable = self.class.openapi_nullable.include?(attr)
275
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
276
+ end
277
+
278
+ hash[param] = _to_hash(value)
279
+ end
280
+ hash
281
+ end
282
+
283
+ end
284
+
285
+ end
@@ -0,0 +1,265 @@
1
+ =begin
2
+ #Pescheck API
3
+
4
+ #API for Pescheck ## Authentication This API supports three authentication methods: 1. **OAuth2** (recommended for API clients) - Use client credentials flow 2. **JWT Bearer** (for user-based access) - Obtain tokens via /api/jwt/ endpoint 3. **Cookie** (for browser-based access) - Session authentication via web login ## Quick Start for API Clients 1. Select your environment from the servers dropdown 2. Use OAuth2 with client credentials flow 3. Scopes are automatically included: read:api, create:api, update:api
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.23.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Pescheck
17
+ # Serializer for OAuth application creation requests
18
+ class OAuthApplication < ApiModelBase
19
+ # Name for the OAuth application
20
+ attr_accessor :name
21
+
22
+ # Client type (confidential recommended for server-to-server) * `confidential` - Confidential * `public` - Public
23
+ attr_accessor :client_type
24
+
25
+ # Grant type (client_credentials for API access) * `authorization-code` - Authorization code * `implicit` - Implicit * `password` - Resource owner password-based * `client-credentials` - Client credentials * `openid-hybrid` - OpenID connect hybrid
26
+ attr_accessor :authorization_grant_type
27
+
28
+ # Space-separated redirect URIs (optional for client_credentials)
29
+ attr_accessor :redirect_uris
30
+
31
+ # Division ID to create application for (optional)
32
+ attr_accessor :division_id
33
+
34
+ class EnumAttributeValidator
35
+ attr_reader :datatype
36
+ attr_reader :allowable_values
37
+
38
+ def initialize(datatype, allowable_values)
39
+ @allowable_values = allowable_values.map do |value|
40
+ case datatype.to_s
41
+ when /Integer/i
42
+ value.to_i
43
+ when /Float/i
44
+ value.to_f
45
+ else
46
+ value
47
+ end
48
+ end
49
+ end
50
+
51
+ def valid?(value)
52
+ !value || allowable_values.include?(value)
53
+ end
54
+ end
55
+
56
+ # Attribute mapping from ruby-style variable name to JSON key.
57
+ def self.attribute_map
58
+ {
59
+ :'name' => :'name',
60
+ :'client_type' => :'client_type',
61
+ :'authorization_grant_type' => :'authorization_grant_type',
62
+ :'redirect_uris' => :'redirect_uris',
63
+ :'division_id' => :'division_id'
64
+ }
65
+ end
66
+
67
+ # Returns attribute mapping this model knows about
68
+ def self.acceptable_attribute_map
69
+ attribute_map
70
+ end
71
+
72
+ # Returns all the JSON keys this model knows about
73
+ def self.acceptable_attributes
74
+ acceptable_attribute_map.values
75
+ end
76
+
77
+ # Attribute type mapping.
78
+ def self.openapi_types
79
+ {
80
+ :'name' => :'String',
81
+ :'client_type' => :'String',
82
+ :'authorization_grant_type' => :'String',
83
+ :'redirect_uris' => :'String',
84
+ :'division_id' => :'String'
85
+ }
86
+ end
87
+
88
+ # List of attributes with nullable: true
89
+ def self.openapi_nullable
90
+ Set.new([
91
+ ])
92
+ end
93
+
94
+ # Initializes the object
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ def initialize(attributes = {})
97
+ if (!attributes.is_a?(Hash))
98
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Pescheck::OAuthApplication` initialize method"
99
+ end
100
+
101
+ # check to see if the attribute exists and convert string to symbol for hash key
102
+ acceptable_attribute_map = self.class.acceptable_attribute_map
103
+ attributes = attributes.each_with_object({}) { |(k, v), h|
104
+ if (!acceptable_attribute_map.key?(k.to_sym))
105
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Pescheck::OAuthApplication`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
106
+ end
107
+ h[k.to_sym] = v
108
+ }
109
+
110
+ if attributes.key?(:'name')
111
+ self.name = attributes[:'name']
112
+ else
113
+ self.name = nil
114
+ end
115
+
116
+ if attributes.key?(:'client_type')
117
+ self.client_type = attributes[:'client_type']
118
+ else
119
+ self.client_type = 'confidential'
120
+ end
121
+
122
+ if attributes.key?(:'authorization_grant_type')
123
+ self.authorization_grant_type = attributes[:'authorization_grant_type']
124
+ else
125
+ self.authorization_grant_type = 'client-credentials'
126
+ end
127
+
128
+ if attributes.key?(:'redirect_uris')
129
+ self.redirect_uris = attributes[:'redirect_uris']
130
+ end
131
+
132
+ if attributes.key?(:'division_id')
133
+ self.division_id = attributes[:'division_id']
134
+ end
135
+ end
136
+
137
+ # Show invalid properties with the reasons. Usually used together with valid?
138
+ # @return Array for valid properties with the reasons
139
+ def list_invalid_properties
140
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
141
+ invalid_properties = Array.new
142
+ if @name.nil?
143
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
144
+ end
145
+
146
+ if @name.to_s.length > 255
147
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 255.')
148
+ end
149
+
150
+ invalid_properties
151
+ end
152
+
153
+ # Check to see if the all the properties in the model are valid
154
+ # @return true if the model is valid
155
+ def valid?
156
+ warn '[DEPRECATED] the `valid?` method is obsolete'
157
+ return false if @name.nil?
158
+ return false if @name.to_s.length > 255
159
+ client_type_validator = EnumAttributeValidator.new('String', ["confidential", "public"])
160
+ return false unless client_type_validator.valid?(@client_type)
161
+ authorization_grant_type_validator = EnumAttributeValidator.new('String', ["authorization-code", "implicit", "password", "client-credentials", "openid-hybrid"])
162
+ return false unless authorization_grant_type_validator.valid?(@authorization_grant_type)
163
+ true
164
+ end
165
+
166
+ # Custom attribute writer method with validation
167
+ # @param [Object] name Value to be assigned
168
+ def name=(name)
169
+ if name.nil?
170
+ fail ArgumentError, 'name cannot be nil'
171
+ end
172
+
173
+ if name.to_s.length > 255
174
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 255.'
175
+ end
176
+
177
+ @name = name
178
+ end
179
+
180
+ # Custom attribute writer method checking allowed values (enum).
181
+ # @param [Object] client_type Object to be assigned
182
+ def client_type=(client_type)
183
+ validator = EnumAttributeValidator.new('String', ["confidential", "public"])
184
+ unless validator.valid?(client_type)
185
+ fail ArgumentError, "invalid value for \"client_type\", must be one of #{validator.allowable_values}."
186
+ end
187
+ @client_type = client_type
188
+ end
189
+
190
+ # Custom attribute writer method checking allowed values (enum).
191
+ # @param [Object] authorization_grant_type Object to be assigned
192
+ def authorization_grant_type=(authorization_grant_type)
193
+ validator = EnumAttributeValidator.new('String', ["authorization-code", "implicit", "password", "client-credentials", "openid-hybrid"])
194
+ unless validator.valid?(authorization_grant_type)
195
+ fail ArgumentError, "invalid value for \"authorization_grant_type\", must be one of #{validator.allowable_values}."
196
+ end
197
+ @authorization_grant_type = authorization_grant_type
198
+ end
199
+
200
+ # Checks equality by comparing each attribute.
201
+ # @param [Object] Object to be compared
202
+ def ==(o)
203
+ return true if self.equal?(o)
204
+ self.class == o.class &&
205
+ name == o.name &&
206
+ client_type == o.client_type &&
207
+ authorization_grant_type == o.authorization_grant_type &&
208
+ redirect_uris == o.redirect_uris &&
209
+ division_id == o.division_id
210
+ end
211
+
212
+ # @see the `==` method
213
+ # @param [Object] Object to be compared
214
+ def eql?(o)
215
+ self == o
216
+ end
217
+
218
+ # Calculates hash code according to all attributes.
219
+ # @return [Integer] Hash code
220
+ def hash
221
+ [name, client_type, authorization_grant_type, redirect_uris, division_id].hash
222
+ end
223
+
224
+ # Builds the object from hash
225
+ # @param [Hash] attributes Model attributes in the form of hash
226
+ # @return [Object] Returns the model itself
227
+ def self.build_from_hash(attributes)
228
+ return nil unless attributes.is_a?(Hash)
229
+ attributes = attributes.transform_keys(&:to_sym)
230
+ transformed_hash = {}
231
+ openapi_types.each_pair do |key, type|
232
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
233
+ transformed_hash["#{key}"] = nil
234
+ elsif type =~ /\AArray<(.*)>/i
235
+ # check to ensure the input is an array given that the attribute
236
+ # is documented as an array but the input is not
237
+ if attributes[attribute_map[key]].is_a?(Array)
238
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
239
+ end
240
+ elsif !attributes[attribute_map[key]].nil?
241
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
242
+ end
243
+ end
244
+ new(transformed_hash)
245
+ end
246
+
247
+ # Returns the object in the form of hash
248
+ # @return [Hash] Returns the object in the form of hash
249
+ def to_hash
250
+ hash = {}
251
+ self.class.attribute_map.each_pair do |attr, param|
252
+ value = self.send(attr)
253
+ if value.nil?
254
+ is_nullable = self.class.openapi_nullable.include?(attr)
255
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
256
+ end
257
+
258
+ hash[param] = _to_hash(value)
259
+ end
260
+ hash
261
+ end
262
+
263
+ end
264
+
265
+ end