pescheck-client 0.4.2 → 0.5.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.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +54 -45
  3. data/docs/AddOnsApi.md +305 -0
  4. data/docs/AddonPrice.md +20 -0
  5. data/docs/AuthenticationApi.md +1 -71
  6. data/docs/DisabledDivision.md +20 -0
  7. data/docs/OAuthApplication.md +1 -1
  8. data/docs/OAuthApplicationResponse.md +6 -2
  9. data/docs/OrganisationAddon.md +32 -0
  10. data/docs/OrganisationAddonUpdate.md +18 -0
  11. data/docs/OrganisationAddonUpdateResult.md +34 -0
  12. data/docs/PatchedOrganisationAddonUpdate.md +18 -0
  13. data/docs/ScreeningsApi.md +72 -0
  14. data/docs/V2Candidate.md +1 -1
  15. data/docs/V2CheckField.md +1 -1
  16. data/docs/V2Document.md +1 -1
  17. data/docs/V2ProfileCheck.md +1 -1
  18. data/docs/V2ProfileCheckEntry.md +1 -1
  19. data/docs/V2ProfileDetail.md +4 -0
  20. data/docs/V2ProfileUpdateCheck.md +1 -1
  21. data/docs/V2ScreeningCheck.md +1 -1
  22. data/docs/V2ScreeningCheckEntry.md +1 -1
  23. data/docs/V2ScreeningCheckListItem.md +1 -1
  24. data/docs/V2ScreeningCreate.md +5 -1
  25. data/docs/V2ScreeningDetail.md +5 -1
  26. data/docs/{V2ScreeningDetailProfile.md → V2ScreeningDetailOrganisation.md} +2 -2
  27. data/docs/V2ScreeningListItem.md +3 -1
  28. data/docs/V2ScreeningNote.md +24 -0
  29. data/docs/V2ScreeningNoteInput.md +22 -0
  30. data/docs/WebhooksApi.md +1 -1
  31. data/lib/pescheck-client/api/add_ons_api.rb +305 -0
  32. data/lib/pescheck-client/api/authentication_api.rb +2 -68
  33. data/lib/pescheck-client/api/profiles_api.rb +1 -1
  34. data/lib/pescheck-client/api/screenings_api.rb +66 -0
  35. data/lib/pescheck-client/api/webhooks_api.rb +2 -2
  36. data/lib/pescheck-client/configuration.rb +8 -0
  37. data/lib/pescheck-client/models/addon_price.rb +202 -0
  38. data/lib/pescheck-client/models/{custom_token_obtain_pair.rb → disabled_division.rb} +34 -35
  39. data/lib/pescheck-client/models/o_auth_application.rb +3 -3
  40. data/lib/pescheck-client/models/o_auth_application_response.rb +70 -44
  41. data/lib/pescheck-client/models/organisation_addon.rb +339 -0
  42. data/lib/pescheck-client/models/organisation_addon_update.rb +165 -0
  43. data/lib/pescheck-client/models/organisation_addon_update_result.rb +368 -0
  44. data/lib/pescheck-client/models/patched_organisation_addon_update.rb +148 -0
  45. data/lib/pescheck-client/models/v2_candidate.rb +1 -35
  46. data/lib/pescheck-client/models/v2_check_field.rb +2 -2
  47. data/lib/pescheck-client/models/v2_document.rb +6 -30
  48. data/lib/pescheck-client/models/v2_profile_check.rb +3 -3
  49. data/lib/pescheck-client/models/v2_profile_check_entry.rb +6 -30
  50. data/lib/pescheck-client/models/v2_profile_detail.rb +55 -1
  51. data/lib/pescheck-client/models/v2_profile_update_check.rb +3 -3
  52. data/lib/pescheck-client/models/v2_screening_check.rb +3 -3
  53. data/lib/pescheck-client/models/v2_screening_check_entry.rb +6 -30
  54. data/lib/pescheck-client/models/v2_screening_check_list_item.rb +6 -30
  55. data/lib/pescheck-client/models/v2_screening_create.rb +25 -4
  56. data/lib/pescheck-client/models/v2_screening_detail.rb +42 -2
  57. data/lib/pescheck-client/models/{v2_screening_detail_profile.rb → v2_screening_detail_organisation.rb} +4 -3
  58. data/lib/pescheck-client/models/v2_screening_list_item.rb +14 -2
  59. data/lib/pescheck-client/models/v2_screening_note.rb +229 -0
  60. data/lib/pescheck-client/models/v2_screening_note_input.rb +220 -0
  61. data/lib/pescheck-client/models/webhook_response.rb +5 -5
  62. data/lib/pescheck-client/version.rb +1 -1
  63. data/lib/pescheck-client.rb +10 -2
  64. data/spec/api/add_ons_api_spec.rb +84 -0
  65. data/spec/api/authentication_api_spec.rb +1 -12
  66. data/spec/api/screenings_api_spec.rb +13 -0
  67. data/spec/api/webhooks_api_spec.rb +1 -1
  68. data/spec/models/{custom_token_obtain_pair_spec.rb → addon_price_spec.rb} +8 -8
  69. data/spec/models/disabled_division_spec.rb +42 -0
  70. data/spec/models/o_auth_application_response_spec.rb +12 -8
  71. data/spec/models/o_auth_application_spec.rb +1 -1
  72. data/spec/models/organisation_addon_spec.rb +78 -0
  73. data/spec/models/organisation_addon_update_result_spec.rb +84 -0
  74. data/spec/models/organisation_addon_update_spec.rb +36 -0
  75. data/spec/models/patched_organisation_addon_update_spec.rb +36 -0
  76. data/spec/models/v2_candidate_spec.rb +0 -4
  77. data/spec/models/v2_document_spec.rb +0 -4
  78. data/spec/models/v2_profile_check_entry_spec.rb +0 -4
  79. data/spec/models/v2_profile_check_spec.rb +1 -1
  80. data/spec/models/v2_profile_detail_spec.rb +12 -0
  81. data/spec/models/v2_profile_update_check_spec.rb +1 -1
  82. data/spec/models/v2_screening_check_entry_spec.rb +0 -4
  83. data/spec/models/v2_screening_check_list_item_spec.rb +0 -4
  84. data/spec/models/v2_screening_check_spec.rb +1 -1
  85. data/spec/models/v2_screening_create_spec.rb +12 -0
  86. data/spec/models/{v2_screening_detail_profile_spec.rb → v2_screening_detail_organisation_spec.rb} +6 -6
  87. data/spec/models/v2_screening_detail_spec.rb +12 -0
  88. data/spec/models/v2_screening_list_item_spec.rb +6 -0
  89. data/spec/models/v2_screening_note_input_spec.rb +52 -0
  90. data/spec/models/v2_screening_note_spec.rb +54 -0
  91. metadata +71 -39
  92. data/docs/CustomTokenObtainPair.md +0 -20
@@ -19,12 +19,16 @@ module Pescheck
19
19
 
20
20
  attr_accessor :status
21
21
 
22
+ attr_accessor :organisation
23
+
22
24
  attr_accessor :profile
23
25
 
24
26
  attr_accessor :candidate
25
27
 
26
28
  attr_accessor :checks
27
29
 
30
+ attr_accessor :screening_notes
31
+
28
32
  # Public wizard URL for the candidate. Null when no check needs candidate input.
29
33
  attr_accessor :candidate_wizard_url
30
34
 
@@ -40,9 +44,11 @@ module Pescheck
40
44
  {
41
45
  :'id' => :'id',
42
46
  :'status' => :'status',
47
+ :'organisation' => :'organisation',
43
48
  :'profile' => :'profile',
44
49
  :'candidate' => :'candidate',
45
50
  :'checks' => :'checks',
51
+ :'screening_notes' => :'screening_notes',
46
52
  :'candidate_wizard_url' => :'candidate_wizard_url',
47
53
  :'dashboard_url' => :'dashboard_url',
48
54
  :'created_at' => :'created_at',
@@ -65,9 +71,11 @@ module Pescheck
65
71
  {
66
72
  :'id' => :'String',
67
73
  :'status' => :'String',
68
- :'profile' => :'V2ScreeningDetailProfile',
74
+ :'organisation' => :'V2ScreeningDetailOrganisation',
75
+ :'profile' => :'V2ScreeningDetailOrganisation',
69
76
  :'candidate' => :'V2Candidate',
70
77
  :'checks' => :'Array<V2ScreeningCheckEntry>',
78
+ :'screening_notes' => :'Array<V2ScreeningNote>',
71
79
  :'candidate_wizard_url' => :'String',
72
80
  :'dashboard_url' => :'String',
73
81
  :'created_at' => :'Time',
@@ -78,6 +86,7 @@ module Pescheck
78
86
  # List of attributes with nullable: true
79
87
  def self.openapi_nullable
80
88
  Set.new([
89
+ :'organisation',
81
90
  :'profile',
82
91
  :'candidate_wizard_url',
83
92
  ])
@@ -111,6 +120,12 @@ module Pescheck
111
120
  self.status = nil
112
121
  end
113
122
 
123
+ if attributes.key?(:'organisation')
124
+ self.organisation = attributes[:'organisation']
125
+ else
126
+ self.organisation = nil
127
+ end
128
+
114
129
  if attributes.key?(:'profile')
115
130
  self.profile = attributes[:'profile']
116
131
  else
@@ -131,6 +146,14 @@ module Pescheck
131
146
  self.checks = nil
132
147
  end
133
148
 
149
+ if attributes.key?(:'screening_notes')
150
+ if (value = attributes[:'screening_notes']).is_a?(Array)
151
+ self.screening_notes = value
152
+ end
153
+ else
154
+ self.screening_notes = nil
155
+ end
156
+
134
157
  if attributes.key?(:'candidate_wizard_url')
135
158
  self.candidate_wizard_url = attributes[:'candidate_wizard_url']
136
159
  else
@@ -177,6 +200,10 @@ module Pescheck
177
200
  invalid_properties.push('invalid value for "checks", checks cannot be nil.')
178
201
  end
179
202
 
203
+ if @screening_notes.nil?
204
+ invalid_properties.push('invalid value for "screening_notes", screening_notes cannot be nil.')
205
+ end
206
+
180
207
  if @dashboard_url.nil?
181
208
  invalid_properties.push('invalid value for "dashboard_url", dashboard_url cannot be nil.')
182
209
  end
@@ -200,6 +227,7 @@ module Pescheck
200
227
  return false if @status.nil?
201
228
  return false if @candidate.nil?
202
229
  return false if @checks.nil?
230
+ return false if @screening_notes.nil?
203
231
  return false if @dashboard_url.nil?
204
232
  return false if @created_at.nil?
205
233
  return false if @updated_at.nil?
@@ -246,6 +274,16 @@ module Pescheck
246
274
  @checks = checks
247
275
  end
248
276
 
277
+ # Custom attribute writer method with validation
278
+ # @param [Object] screening_notes Value to be assigned
279
+ def screening_notes=(screening_notes)
280
+ if screening_notes.nil?
281
+ fail ArgumentError, 'screening_notes cannot be nil'
282
+ end
283
+
284
+ @screening_notes = screening_notes
285
+ end
286
+
249
287
  # Custom attribute writer method with validation
250
288
  # @param [Object] dashboard_url Value to be assigned
251
289
  def dashboard_url=(dashboard_url)
@@ -283,9 +321,11 @@ module Pescheck
283
321
  self.class == o.class &&
284
322
  id == o.id &&
285
323
  status == o.status &&
324
+ organisation == o.organisation &&
286
325
  profile == o.profile &&
287
326
  candidate == o.candidate &&
288
327
  checks == o.checks &&
328
+ screening_notes == o.screening_notes &&
289
329
  candidate_wizard_url == o.candidate_wizard_url &&
290
330
  dashboard_url == o.dashboard_url &&
291
331
  created_at == o.created_at &&
@@ -301,7 +341,7 @@ module Pescheck
301
341
  # Calculates hash code according to all attributes.
302
342
  # @return [Integer] Hash code
303
343
  def hash
304
- [id, status, profile, candidate, checks, candidate_wizard_url, dashboard_url, created_at, updated_at].hash
344
+ [id, status, organisation, profile, candidate, checks, screening_notes, candidate_wizard_url, dashboard_url, created_at, updated_at].hash
305
345
  end
306
346
 
307
347
  # Builds the object from hash
@@ -14,7 +14,8 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Pescheck
17
- class V2ScreeningDetailProfile < ApiModelBase
17
+ # Organisation owning this screening. For departments, the department itself.
18
+ class V2ScreeningDetailOrganisation < ApiModelBase
18
19
  attr_accessor :id
19
20
 
20
21
  attr_accessor :name
@@ -55,14 +56,14 @@ module Pescheck
55
56
  # @param [Hash] attributes Model attributes in the form of hash
56
57
  def initialize(attributes = {})
57
58
  if (!attributes.is_a?(Hash))
58
- fail ArgumentError, "The input argument (attributes) must be a hash in `Pescheck::V2ScreeningDetailProfile` initialize method"
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Pescheck::V2ScreeningDetailOrganisation` initialize method"
59
60
  end
60
61
 
61
62
  # check to see if the attribute exists and convert string to symbol for hash key
62
63
  acceptable_attribute_map = self.class.acceptable_attribute_map
63
64
  attributes = attributes.each_with_object({}) { |(k, v), h|
64
65
  if (!acceptable_attribute_map.key?(k.to_sym))
65
- fail ArgumentError, "`#{k}` is not a valid attribute in `Pescheck::V2ScreeningDetailProfile`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Pescheck::V2ScreeningDetailOrganisation`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
66
67
  end
67
68
  h[k.to_sym] = v
68
69
  }
@@ -20,6 +20,8 @@ module Pescheck
20
20
 
21
21
  attr_accessor :status
22
22
 
23
+ attr_accessor :organisation
24
+
23
25
  attr_accessor :profile
24
26
 
25
27
  attr_accessor :candidate
@@ -39,6 +41,7 @@ module Pescheck
39
41
  {
40
42
  :'id' => :'id',
41
43
  :'status' => :'status',
44
+ :'organisation' => :'organisation',
42
45
  :'profile' => :'profile',
43
46
  :'candidate' => :'candidate',
44
47
  :'checks' => :'checks',
@@ -64,7 +67,8 @@ module Pescheck
64
67
  {
65
68
  :'id' => :'String',
66
69
  :'status' => :'String',
67
- :'profile' => :'V2ScreeningDetailProfile',
70
+ :'organisation' => :'V2ScreeningDetailOrganisation',
71
+ :'profile' => :'V2ScreeningDetailOrganisation',
68
72
  :'candidate' => :'V2Candidate',
69
73
  :'checks' => :'Array<V2ScreeningCheckListItem>',
70
74
  :'candidate_wizard_url' => :'String',
@@ -77,6 +81,7 @@ module Pescheck
77
81
  # List of attributes with nullable: true
78
82
  def self.openapi_nullable
79
83
  Set.new([
84
+ :'organisation',
80
85
  :'profile',
81
86
  :'candidate_wizard_url',
82
87
  ])
@@ -108,6 +113,12 @@ module Pescheck
108
113
  self.status = attributes[:'status']
109
114
  end
110
115
 
116
+ if attributes.key?(:'organisation')
117
+ self.organisation = attributes[:'organisation']
118
+ else
119
+ self.organisation = nil
120
+ end
121
+
111
122
  if attributes.key?(:'profile')
112
123
  self.profile = attributes[:'profile']
113
124
  else
@@ -265,6 +276,7 @@ module Pescheck
265
276
  self.class == o.class &&
266
277
  id == o.id &&
267
278
  status == o.status &&
279
+ organisation == o.organisation &&
268
280
  profile == o.profile &&
269
281
  candidate == o.candidate &&
270
282
  checks == o.checks &&
@@ -283,7 +295,7 @@ module Pescheck
283
295
  # Calculates hash code according to all attributes.
284
296
  # @return [Integer] Hash code
285
297
  def hash
286
- [id, status, profile, candidate, checks, candidate_wizard_url, dashboard_url, created_at, updated_at].hash
298
+ [id, status, organisation, profile, candidate, checks, candidate_wizard_url, dashboard_url, created_at, updated_at].hash
287
299
  end
288
300
 
289
301
  # Builds the object from hash
@@ -0,0 +1,229 @@
1
+ =begin
2
+ #Pescheck API
3
+
4
+ #Official client library for the Pescheck API (v2), generated from the OpenAPI specification. Authenticate with OAuth2 client credentials and use the checks, profiles, screenings, webhooks and divisions endpoints. See https://github.com/pescheckit/pescheck-clients for installation and usage.
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
+ # A note recorded on the screening. `check_id` is the Check the note targets (null for type-only or unscoped notes).
18
+ class V2ScreeningNote < ApiModelBase
19
+ attr_accessor :note
20
+
21
+ attr_accessor :check_type
22
+
23
+ attr_accessor :check_id
24
+
25
+ attr_accessor :created_at
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'note' => :'note',
31
+ :'check_type' => :'check_type',
32
+ :'check_id' => :'check_id',
33
+ :'created_at' => :'created_at'
34
+ }
35
+ end
36
+
37
+ # Returns attribute mapping this model knows about
38
+ def self.acceptable_attribute_map
39
+ attribute_map
40
+ end
41
+
42
+ # Returns all the JSON keys this model knows about
43
+ def self.acceptable_attributes
44
+ acceptable_attribute_map.values
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'note' => :'String',
51
+ :'check_type' => :'String',
52
+ :'check_id' => :'String',
53
+ :'created_at' => :'Time'
54
+ }
55
+ end
56
+
57
+ # List of attributes with nullable: true
58
+ def self.openapi_nullable
59
+ Set.new([
60
+ :'check_id',
61
+ ])
62
+ end
63
+
64
+ # Initializes the object
65
+ # @param [Hash] attributes Model attributes in the form of hash
66
+ def initialize(attributes = {})
67
+ if (!attributes.is_a?(Hash))
68
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Pescheck::V2ScreeningNote` initialize method"
69
+ end
70
+
71
+ # check to see if the attribute exists and convert string to symbol for hash key
72
+ acceptable_attribute_map = self.class.acceptable_attribute_map
73
+ attributes = attributes.each_with_object({}) { |(k, v), h|
74
+ if (!acceptable_attribute_map.key?(k.to_sym))
75
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Pescheck::V2ScreeningNote`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
76
+ end
77
+ h[k.to_sym] = v
78
+ }
79
+
80
+ if attributes.key?(:'note')
81
+ self.note = attributes[:'note']
82
+ else
83
+ self.note = nil
84
+ end
85
+
86
+ if attributes.key?(:'check_type')
87
+ self.check_type = attributes[:'check_type']
88
+ else
89
+ self.check_type = nil
90
+ end
91
+
92
+ if attributes.key?(:'check_id')
93
+ self.check_id = attributes[:'check_id']
94
+ else
95
+ self.check_id = nil
96
+ end
97
+
98
+ if attributes.key?(:'created_at')
99
+ self.created_at = attributes[:'created_at']
100
+ else
101
+ self.created_at = nil
102
+ end
103
+ end
104
+
105
+ # Show invalid properties with the reasons. Usually used together with valid?
106
+ # @return Array for valid properties with the reasons
107
+ def list_invalid_properties
108
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
109
+ invalid_properties = Array.new
110
+ if @note.nil?
111
+ invalid_properties.push('invalid value for "note", note cannot be nil.')
112
+ end
113
+
114
+ if @check_type.nil?
115
+ invalid_properties.push('invalid value for "check_type", check_type cannot be nil.')
116
+ end
117
+
118
+ if @created_at.nil?
119
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
120
+ end
121
+
122
+ invalid_properties
123
+ end
124
+
125
+ # Check to see if the all the properties in the model are valid
126
+ # @return true if the model is valid
127
+ def valid?
128
+ warn '[DEPRECATED] the `valid?` method is obsolete'
129
+ return false if @note.nil?
130
+ return false if @check_type.nil?
131
+ return false if @created_at.nil?
132
+ true
133
+ end
134
+
135
+ # Custom attribute writer method with validation
136
+ # @param [Object] note Value to be assigned
137
+ def note=(note)
138
+ if note.nil?
139
+ fail ArgumentError, 'note cannot be nil'
140
+ end
141
+
142
+ @note = note
143
+ end
144
+
145
+ # Custom attribute writer method with validation
146
+ # @param [Object] check_type Value to be assigned
147
+ def check_type=(check_type)
148
+ if check_type.nil?
149
+ fail ArgumentError, 'check_type cannot be nil'
150
+ end
151
+
152
+ @check_type = check_type
153
+ end
154
+
155
+ # Custom attribute writer method with validation
156
+ # @param [Object] created_at Value to be assigned
157
+ def created_at=(created_at)
158
+ if created_at.nil?
159
+ fail ArgumentError, 'created_at cannot be nil'
160
+ end
161
+
162
+ @created_at = created_at
163
+ end
164
+
165
+ # Checks equality by comparing each attribute.
166
+ # @param [Object] Object to be compared
167
+ def ==(o)
168
+ return true if self.equal?(o)
169
+ self.class == o.class &&
170
+ note == o.note &&
171
+ check_type == o.check_type &&
172
+ check_id == o.check_id &&
173
+ created_at == o.created_at
174
+ end
175
+
176
+ # @see the `==` method
177
+ # @param [Object] Object to be compared
178
+ def eql?(o)
179
+ self == o
180
+ end
181
+
182
+ # Calculates hash code according to all attributes.
183
+ # @return [Integer] Hash code
184
+ def hash
185
+ [note, check_type, check_id, created_at].hash
186
+ end
187
+
188
+ # Builds the object from hash
189
+ # @param [Hash] attributes Model attributes in the form of hash
190
+ # @return [Object] Returns the model itself
191
+ def self.build_from_hash(attributes)
192
+ return nil unless attributes.is_a?(Hash)
193
+ attributes = attributes.transform_keys(&:to_sym)
194
+ transformed_hash = {}
195
+ openapi_types.each_pair do |key, type|
196
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
197
+ transformed_hash["#{key}"] = nil
198
+ elsif type =~ /\AArray<(.*)>/i
199
+ # check to ensure the input is an array given that the attribute
200
+ # is documented as an array but the input is not
201
+ if attributes[attribute_map[key]].is_a?(Array)
202
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
203
+ end
204
+ elsif !attributes[attribute_map[key]].nil?
205
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
206
+ end
207
+ end
208
+ new(transformed_hash)
209
+ end
210
+
211
+ # Returns the object in the form of hash
212
+ # @return [Hash] Returns the object in the form of hash
213
+ def to_hash
214
+ hash = {}
215
+ self.class.attribute_map.each_pair do |attr, param|
216
+ value = self.send(attr)
217
+ if value.nil?
218
+ is_nullable = self.class.openapi_nullable.include?(attr)
219
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
220
+ end
221
+
222
+ hash[param] = _to_hash(value)
223
+ end
224
+ hash
225
+ end
226
+
227
+ end
228
+
229
+ end
@@ -0,0 +1,220 @@
1
+ =begin
2
+ #Pescheck API
3
+
4
+ #Official client library for the Pescheck API (v2), generated from the OpenAPI specification. Authenticate with OAuth2 client credentials and use the checks, profiles, screenings, webhooks and divisions endpoints. See https://github.com/pescheckit/pescheck-clients for installation and usage.
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
+ # A note to record on the screening at creation. Scope it to a specific check with `profile_check_id` (links the note to the Check spawned from that ProfileCheck) or to a `check_type`; `profile_check_id` wins when both are given. With neither, the note is recorded against the screening with no check (check_type 'other').
18
+ class V2ScreeningNoteInput < ApiModelBase
19
+ attr_accessor :note
20
+
21
+ # Links the note to the Check spawned from this ProfileCheck. Wins over check_type.
22
+ attr_accessor :profile_check_id
23
+
24
+ # Scope the note to a check type. Ignored when profile_check_id is given. * `addresscheck` - addresscheck * `adversemedia2check` - adversemedia2check * `adversemediacheck` - adversemediacheck * `bigcheck` - bigcheck * `criminalrecordscheck` - criminalrecordscheck * `criminalrecordsuploadcheck` - criminalrecordsuploadcheck * `customintegritycheck` - customintegritycheck * `cvcheck` - cvcheck * `edrcheck` - edrcheck * `ibancheck` - ibancheck * `id2check` - id2check * `idcheck` - idcheck * `integritycheck` - integritycheck * `openhealthcarecheck` - openhealthcarecheck * `permissioncheck` - permissioncheck * `pescheckadversemediacheck` - pescheckadversemediacheck * `qualificationcheck` - qualificationcheck * `righttoworkcheck` - righttoworkcheck * `vogcheck` - vogcheck * `watchlist2check` - watchlist2check * `watchlistcheck` - watchlistcheck * `workreferencecheck` - workreferencecheck * `worldwidecreditcheck` - worldwidecreditcheck
25
+ attr_accessor :check_type
26
+
27
+ class EnumAttributeValidator
28
+ attr_reader :datatype
29
+ attr_reader :allowable_values
30
+
31
+ def initialize(datatype, allowable_values)
32
+ @allowable_values = allowable_values.map do |value|
33
+ case datatype.to_s
34
+ when /Integer/i
35
+ value.to_i
36
+ when /Float/i
37
+ value.to_f
38
+ else
39
+ value
40
+ end
41
+ end
42
+ end
43
+
44
+ def valid?(value)
45
+ !value || allowable_values.include?(value)
46
+ end
47
+ end
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'note' => :'note',
53
+ :'profile_check_id' => :'profile_check_id',
54
+ :'check_type' => :'check_type'
55
+ }
56
+ end
57
+
58
+ # Returns attribute mapping this model knows about
59
+ def self.acceptable_attribute_map
60
+ attribute_map
61
+ end
62
+
63
+ # Returns all the JSON keys this model knows about
64
+ def self.acceptable_attributes
65
+ acceptable_attribute_map.values
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.openapi_types
70
+ {
71
+ :'note' => :'String',
72
+ :'profile_check_id' => :'String',
73
+ :'check_type' => :'String'
74
+ }
75
+ end
76
+
77
+ # List of attributes with nullable: true
78
+ def self.openapi_nullable
79
+ Set.new([
80
+ :'profile_check_id',
81
+ ])
82
+ end
83
+
84
+ # Initializes the object
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ def initialize(attributes = {})
87
+ if (!attributes.is_a?(Hash))
88
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Pescheck::V2ScreeningNoteInput` initialize method"
89
+ end
90
+
91
+ # check to see if the attribute exists and convert string to symbol for hash key
92
+ acceptable_attribute_map = self.class.acceptable_attribute_map
93
+ attributes = attributes.each_with_object({}) { |(k, v), h|
94
+ if (!acceptable_attribute_map.key?(k.to_sym))
95
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Pescheck::V2ScreeningNoteInput`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
96
+ end
97
+ h[k.to_sym] = v
98
+ }
99
+
100
+ if attributes.key?(:'note')
101
+ self.note = attributes[:'note']
102
+ else
103
+ self.note = nil
104
+ end
105
+
106
+ if attributes.key?(:'profile_check_id')
107
+ self.profile_check_id = attributes[:'profile_check_id']
108
+ end
109
+
110
+ if attributes.key?(:'check_type')
111
+ self.check_type = attributes[:'check_type']
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
119
+ invalid_properties = Array.new
120
+ if @note.nil?
121
+ invalid_properties.push('invalid value for "note", note cannot be nil.')
122
+ end
123
+
124
+ invalid_properties
125
+ end
126
+
127
+ # Check to see if the all the properties in the model are valid
128
+ # @return true if the model is valid
129
+ def valid?
130
+ warn '[DEPRECATED] the `valid?` method is obsolete'
131
+ return false if @note.nil?
132
+ check_type_validator = EnumAttributeValidator.new('String', ["addresscheck", "adversemedia2check", "adversemediacheck", "bigcheck", "criminalrecordscheck", "criminalrecordsuploadcheck", "customintegritycheck", "cvcheck", "edrcheck", "ibancheck", "id2check", "idcheck", "integritycheck", "openhealthcarecheck", "permissioncheck", "pescheckadversemediacheck", "qualificationcheck", "righttoworkcheck", "vogcheck", "watchlist2check", "watchlistcheck", "workreferencecheck", "worldwidecreditcheck", ""])
133
+ return false unless check_type_validator.valid?(@check_type)
134
+ true
135
+ end
136
+
137
+ # Custom attribute writer method with validation
138
+ # @param [Object] note Value to be assigned
139
+ def note=(note)
140
+ if note.nil?
141
+ fail ArgumentError, 'note cannot be nil'
142
+ end
143
+
144
+ @note = note
145
+ end
146
+
147
+ # Custom attribute writer method checking allowed values (enum).
148
+ # @param [Object] check_type Object to be assigned
149
+ def check_type=(check_type)
150
+ validator = EnumAttributeValidator.new('String', ["addresscheck", "adversemedia2check", "adversemediacheck", "bigcheck", "criminalrecordscheck", "criminalrecordsuploadcheck", "customintegritycheck", "cvcheck", "edrcheck", "ibancheck", "id2check", "idcheck", "integritycheck", "openhealthcarecheck", "permissioncheck", "pescheckadversemediacheck", "qualificationcheck", "righttoworkcheck", "vogcheck", "watchlist2check", "watchlistcheck", "workreferencecheck", "worldwidecreditcheck", ""])
151
+ unless validator.valid?(check_type)
152
+ fail ArgumentError, "invalid value for \"check_type\", must be one of #{validator.allowable_values}."
153
+ end
154
+ @check_type = check_type
155
+ end
156
+
157
+ # Checks equality by comparing each attribute.
158
+ # @param [Object] Object to be compared
159
+ def ==(o)
160
+ return true if self.equal?(o)
161
+ self.class == o.class &&
162
+ note == o.note &&
163
+ profile_check_id == o.profile_check_id &&
164
+ check_type == o.check_type
165
+ end
166
+
167
+ # @see the `==` method
168
+ # @param [Object] Object to be compared
169
+ def eql?(o)
170
+ self == o
171
+ end
172
+
173
+ # Calculates hash code according to all attributes.
174
+ # @return [Integer] Hash code
175
+ def hash
176
+ [note, profile_check_id, check_type].hash
177
+ end
178
+
179
+ # Builds the object from hash
180
+ # @param [Hash] attributes Model attributes in the form of hash
181
+ # @return [Object] Returns the model itself
182
+ def self.build_from_hash(attributes)
183
+ return nil unless attributes.is_a?(Hash)
184
+ attributes = attributes.transform_keys(&:to_sym)
185
+ transformed_hash = {}
186
+ openapi_types.each_pair do |key, type|
187
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
188
+ transformed_hash["#{key}"] = nil
189
+ elsif type =~ /\AArray<(.*)>/i
190
+ # check to ensure the input is an array given that the attribute
191
+ # is documented as an array but the input is not
192
+ if attributes[attribute_map[key]].is_a?(Array)
193
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
194
+ end
195
+ elsif !attributes[attribute_map[key]].nil?
196
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
197
+ end
198
+ end
199
+ new(transformed_hash)
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash
205
+ hash = {}
206
+ self.class.attribute_map.each_pair do |attr, param|
207
+ value = self.send(attr)
208
+ if value.nil?
209
+ is_nullable = self.class.openapi_nullable.include?(attr)
210
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
211
+ end
212
+
213
+ hash[param] = _to_hash(value)
214
+ end
215
+ hash
216
+ end
217
+
218
+ end
219
+
220
+ end