candidhealth 0.24.2 → 0.24.3
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/lib/candidhealth/commons/types/primitive.rb +17 -0
- data/lib/candidhealth/custom_schemas/client.rb +30 -0
- data/lib/candidhealth/custom_schemas/v_1/client.rb +291 -0
- data/lib/candidhealth/custom_schemas/v_1/types/key_with_name_already_exists_error.rb +71 -0
- data/lib/candidhealth/custom_schemas/v_1/types/schema.rb +91 -0
- data/lib/candidhealth/custom_schemas/v_1/types/schema_field.rb +71 -0
- data/lib/candidhealth/custom_schemas/v_1/types/schema_get_multi_response.rb +65 -0
- data/lib/candidhealth/custom_schemas/v_1/types/schema_instance.rb +76 -0
- data/lib/candidhealth/custom_schemas/v_1/types/schema_validation_error.rb +100 -0
- data/lib/candidhealth/custom_schemas/v_1/types/schema_validation_failure.rb +65 -0
- data/lib/candidhealth/custom_schemas/v_1/types/schema_with_name_already_exists_error.rb +70 -0
- data/lib/candidhealth/encounters/v_4/client.rb +49 -12
- data/lib/candidhealth/encounters/v_4/types/encounter.rb +17 -1
- data/lib/candidhealth/encounters/v_4/types/key_does_not_exist_error.rb +70 -0
- data/lib/candidhealth/encounters/v_4/types/multiple_instances_for_schema_error.rb +60 -0
- data/lib/candidhealth/encounters/v_4/types/schema_does_not_exist_error.rb +60 -0
- data/lib/candidhealth/encounters/v_4/types/schema_instance_validation_error.rb +139 -0
- data/lib/candidhealth/encounters/v_4/types/schema_instance_validation_failure.rb +65 -0
- data/lib/candidhealth/encounters/v_4/types/schema_unauthorized_access_error.rb +60 -0
- data/lib/candidhealth/encounters/v_4/types/value_does_not_match_key_type_error.rb +90 -0
- data/lib/candidhealth.rb +7 -0
- data/lib/requests.rb +2 -2
- data/lib/types_export.rb +16 -0
- metadata +20 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e1718f0ca0a159b22fe68ff3c74381c4d6c9f0b88748b60300f78eb21c52e77
|
4
|
+
data.tar.gz: e0a6c61539217e8e38d1ebd9b681d9f53ed5b2daec264794187955f6f72228de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07f8bf71ea0330db01ded0a5260cf40b8af9622e3d3042e5ad3e65ceb85e8b85acd99921d76a0e33fc8543ea5405c4b39c0f7b6f1baa9ad62e864ea86bbb4b8e
|
7
|
+
data.tar.gz: 2e6edda2e02c8b73e2fe30ee09d90ed73f8e23521324dd79c0a88c84c1d04af110026b72ede5e54fd2567981d599b7ae5ce2bd6512ff0da2847363d58958c663
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CandidApiClient
|
4
|
+
module Commons
|
5
|
+
module Types
|
6
|
+
# The BOOLEAN and STRING primitives respectively map to the `boolean` and `string`
|
7
|
+
# JSON data types.
|
8
|
+
# The DOUBLE and INTEGER primitives must be written as a JSON `number` type.
|
9
|
+
class Primitive
|
10
|
+
BOOLEAN = "BOOLEAN"
|
11
|
+
DOUBLE = "DOUBLE"
|
12
|
+
INTEGER = "INTEGER"
|
13
|
+
STRING = "STRING"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../requests"
|
4
|
+
require_relative "v_1/client"
|
5
|
+
|
6
|
+
module CandidApiClient
|
7
|
+
module CustomSchemas
|
8
|
+
class Client
|
9
|
+
# @return [CandidApiClient::CustomSchemas::V1::V1Client]
|
10
|
+
attr_reader :v_1
|
11
|
+
|
12
|
+
# @param request_client [CandidApiClient::RequestClient]
|
13
|
+
# @return [CandidApiClient::CustomSchemas::Client]
|
14
|
+
def initialize(request_client:)
|
15
|
+
@v_1 = CandidApiClient::CustomSchemas::V1::V1Client.new(request_client: request_client)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class AsyncClient
|
20
|
+
# @return [CandidApiClient::CustomSchemas::V1::AsyncV1Client]
|
21
|
+
attr_reader :v_1
|
22
|
+
|
23
|
+
# @param request_client [CandidApiClient::AsyncRequestClient]
|
24
|
+
# @return [CandidApiClient::CustomSchemas::AsyncClient]
|
25
|
+
def initialize(request_client:)
|
26
|
+
@v_1 = CandidApiClient::CustomSchemas::V1::AsyncV1Client.new(request_client: request_client)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,291 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../../requests"
|
4
|
+
require_relative "types/schema_get_multi_response"
|
5
|
+
require_relative "types/schema"
|
6
|
+
require_relative "types/schema_field"
|
7
|
+
require "async"
|
8
|
+
|
9
|
+
module CandidApiClient
|
10
|
+
module CustomSchemas
|
11
|
+
module V1
|
12
|
+
class V1Client
|
13
|
+
# @return [CandidApiClient::RequestClient]
|
14
|
+
attr_reader :request_client
|
15
|
+
|
16
|
+
# @param request_client [CandidApiClient::RequestClient]
|
17
|
+
# @return [CandidApiClient::CustomSchemas::V1::V1Client]
|
18
|
+
def initialize(request_client:)
|
19
|
+
@request_client = request_client
|
20
|
+
end
|
21
|
+
|
22
|
+
# Returns all custom schemas.
|
23
|
+
#
|
24
|
+
# @param request_options [CandidApiClient::RequestOptions]
|
25
|
+
# @return [CandidApiClient::CustomSchemas::V1::Types::SchemaGetMultiResponse]
|
26
|
+
# @example
|
27
|
+
# api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
|
28
|
+
# api.custom_schemas.v_1.get_multi
|
29
|
+
def get_multi(request_options: nil)
|
30
|
+
response = @request_client.conn.get do |req|
|
31
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
32
|
+
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
33
|
+
req.headers = {
|
34
|
+
**(req.headers || {}),
|
35
|
+
**@request_client.get_headers,
|
36
|
+
**(request_options&.additional_headers || {})
|
37
|
+
}.compact
|
38
|
+
req.url "#{@request_client.get_url(environment: CandidApi,
|
39
|
+
request_options: request_options)}/api/custom-schemas/v1"
|
40
|
+
end
|
41
|
+
CandidApiClient::CustomSchemas::V1::Types::SchemaGetMultiResponse.from_json(json_object: response.body)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Return a custom schema with a given ID.
|
45
|
+
#
|
46
|
+
# @param schema_id [String]
|
47
|
+
# @param request_options [CandidApiClient::RequestOptions]
|
48
|
+
# @return [CandidApiClient::CustomSchemas::V1::Types::Schema]
|
49
|
+
# @example
|
50
|
+
# api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
|
51
|
+
# api.custom_schemas.v_1.get(schema_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32")
|
52
|
+
def get(schema_id:, request_options: nil)
|
53
|
+
response = @request_client.conn.get do |req|
|
54
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
55
|
+
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
56
|
+
req.headers = {
|
57
|
+
**(req.headers || {}),
|
58
|
+
**@request_client.get_headers,
|
59
|
+
**(request_options&.additional_headers || {})
|
60
|
+
}.compact
|
61
|
+
req.url "#{@request_client.get_url(environment: CandidApi,
|
62
|
+
request_options: request_options)}/api/custom-schemas/v1/#{schema_id}"
|
63
|
+
end
|
64
|
+
CandidApiClient::CustomSchemas::V1::Types::Schema.from_json(json_object: response.body)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Create a custom schema. Schema keys can be referenced as inputs in
|
68
|
+
# user-configurable rules in the Rules
|
69
|
+
# Engine, and key-value pairs can be attached to claims via the Encounters API.
|
70
|
+
#
|
71
|
+
# @param name [String]
|
72
|
+
# @param description [String]
|
73
|
+
# @param fields [Array<Hash>] Request of type Array<CandidApiClient::CustomSchemas::V1::Types::SchemaField>, as a Hash
|
74
|
+
# * :key (String)
|
75
|
+
# * :type (CandidApiClient::Commons::Types::Primitive)
|
76
|
+
# @param request_options [CandidApiClient::RequestOptions]
|
77
|
+
# @return [CandidApiClient::CustomSchemas::V1::Types::Schema]
|
78
|
+
# @example
|
79
|
+
# api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
|
80
|
+
# api.custom_schemas.v_1.create(
|
81
|
+
# name: "string",
|
82
|
+
# description: "string",
|
83
|
+
# fields: [{ key: "string", type: BOOLEAN }]
|
84
|
+
# )
|
85
|
+
def create(name:, fields:, description: nil, request_options: nil)
|
86
|
+
response = @request_client.conn.post do |req|
|
87
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
88
|
+
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
89
|
+
req.headers = {
|
90
|
+
**(req.headers || {}),
|
91
|
+
**@request_client.get_headers,
|
92
|
+
**(request_options&.additional_headers || {})
|
93
|
+
}.compact
|
94
|
+
req.body = {
|
95
|
+
**(request_options&.additional_body_parameters || {}),
|
96
|
+
name: name,
|
97
|
+
description: description,
|
98
|
+
fields: fields
|
99
|
+
}.compact
|
100
|
+
req.url "#{@request_client.get_url(environment: CandidApi,
|
101
|
+
request_options: request_options)}/api/custom-schemas/v1"
|
102
|
+
end
|
103
|
+
CandidApiClient::CustomSchemas::V1::Types::Schema.from_json(json_object: response.body)
|
104
|
+
end
|
105
|
+
|
106
|
+
# Update the name, description, or keys on a preexisting schema.
|
107
|
+
#
|
108
|
+
# @param schema_id [String]
|
109
|
+
# @param name [String]
|
110
|
+
# @param description [String]
|
111
|
+
# @param fields_to_add [Array<Hash>] A list of typed entries to add to schema. Only additive modifications are
|
112
|
+
# permitted.Request of type Array<CandidApiClient::CustomSchemas::V1::Types::SchemaField>, as a Hash
|
113
|
+
# * :key (String)
|
114
|
+
# * :type (CandidApiClient::Commons::Types::Primitive)
|
115
|
+
# @param request_options [CandidApiClient::RequestOptions]
|
116
|
+
# @return [CandidApiClient::CustomSchemas::V1::Types::Schema]
|
117
|
+
# @example
|
118
|
+
# api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
|
119
|
+
# api.custom_schemas.v_1.update(
|
120
|
+
# schema_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
|
121
|
+
# name: "string",
|
122
|
+
# description: "string",
|
123
|
+
# fields_to_add: [{ key: "string", type: BOOLEAN }]
|
124
|
+
# )
|
125
|
+
def update(schema_id:, name: nil, description: nil, fields_to_add: nil, request_options: nil)
|
126
|
+
response = @request_client.conn.patch do |req|
|
127
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
128
|
+
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
129
|
+
req.headers = {
|
130
|
+
**(req.headers || {}),
|
131
|
+
**@request_client.get_headers,
|
132
|
+
**(request_options&.additional_headers || {})
|
133
|
+
}.compact
|
134
|
+
req.body = {
|
135
|
+
**(request_options&.additional_body_parameters || {}),
|
136
|
+
name: name,
|
137
|
+
description: description,
|
138
|
+
fields_to_add: fields_to_add
|
139
|
+
}.compact
|
140
|
+
req.url "#{@request_client.get_url(environment: CandidApi,
|
141
|
+
request_options: request_options)}/api/custom-schemas/v1/#{schema_id}"
|
142
|
+
end
|
143
|
+
CandidApiClient::CustomSchemas::V1::Types::Schema.from_json(json_object: response.body)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
class AsyncV1Client
|
148
|
+
# @return [CandidApiClient::AsyncRequestClient]
|
149
|
+
attr_reader :request_client
|
150
|
+
|
151
|
+
# @param request_client [CandidApiClient::AsyncRequestClient]
|
152
|
+
# @return [CandidApiClient::CustomSchemas::V1::AsyncV1Client]
|
153
|
+
def initialize(request_client:)
|
154
|
+
@request_client = request_client
|
155
|
+
end
|
156
|
+
|
157
|
+
# Returns all custom schemas.
|
158
|
+
#
|
159
|
+
# @param request_options [CandidApiClient::RequestOptions]
|
160
|
+
# @return [CandidApiClient::CustomSchemas::V1::Types::SchemaGetMultiResponse]
|
161
|
+
# @example
|
162
|
+
# api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
|
163
|
+
# api.custom_schemas.v_1.get_multi
|
164
|
+
def get_multi(request_options: nil)
|
165
|
+
Async do
|
166
|
+
response = @request_client.conn.get do |req|
|
167
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
168
|
+
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
169
|
+
req.headers = {
|
170
|
+
**(req.headers || {}),
|
171
|
+
**@request_client.get_headers,
|
172
|
+
**(request_options&.additional_headers || {})
|
173
|
+
}.compact
|
174
|
+
req.url "#{@request_client.get_url(environment: CandidApi,
|
175
|
+
request_options: request_options)}/api/custom-schemas/v1"
|
176
|
+
end
|
177
|
+
CandidApiClient::CustomSchemas::V1::Types::SchemaGetMultiResponse.from_json(json_object: response.body)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
# Return a custom schema with a given ID.
|
182
|
+
#
|
183
|
+
# @param schema_id [String]
|
184
|
+
# @param request_options [CandidApiClient::RequestOptions]
|
185
|
+
# @return [CandidApiClient::CustomSchemas::V1::Types::Schema]
|
186
|
+
# @example
|
187
|
+
# api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
|
188
|
+
# api.custom_schemas.v_1.get(schema_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32")
|
189
|
+
def get(schema_id:, request_options: nil)
|
190
|
+
Async do
|
191
|
+
response = @request_client.conn.get do |req|
|
192
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
193
|
+
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
194
|
+
req.headers = {
|
195
|
+
**(req.headers || {}),
|
196
|
+
**@request_client.get_headers,
|
197
|
+
**(request_options&.additional_headers || {})
|
198
|
+
}.compact
|
199
|
+
req.url "#{@request_client.get_url(environment: CandidApi,
|
200
|
+
request_options: request_options)}/api/custom-schemas/v1/#{schema_id}"
|
201
|
+
end
|
202
|
+
CandidApiClient::CustomSchemas::V1::Types::Schema.from_json(json_object: response.body)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
# Create a custom schema. Schema keys can be referenced as inputs in
|
207
|
+
# user-configurable rules in the Rules
|
208
|
+
# Engine, and key-value pairs can be attached to claims via the Encounters API.
|
209
|
+
#
|
210
|
+
# @param name [String]
|
211
|
+
# @param description [String]
|
212
|
+
# @param fields [Array<Hash>] Request of type Array<CandidApiClient::CustomSchemas::V1::Types::SchemaField>, as a Hash
|
213
|
+
# * :key (String)
|
214
|
+
# * :type (CandidApiClient::Commons::Types::Primitive)
|
215
|
+
# @param request_options [CandidApiClient::RequestOptions]
|
216
|
+
# @return [CandidApiClient::CustomSchemas::V1::Types::Schema]
|
217
|
+
# @example
|
218
|
+
# api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
|
219
|
+
# api.custom_schemas.v_1.create(
|
220
|
+
# name: "string",
|
221
|
+
# description: "string",
|
222
|
+
# fields: [{ key: "string", type: BOOLEAN }]
|
223
|
+
# )
|
224
|
+
def create(name:, fields:, description: nil, request_options: nil)
|
225
|
+
Async do
|
226
|
+
response = @request_client.conn.post do |req|
|
227
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
228
|
+
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
229
|
+
req.headers = {
|
230
|
+
**(req.headers || {}),
|
231
|
+
**@request_client.get_headers,
|
232
|
+
**(request_options&.additional_headers || {})
|
233
|
+
}.compact
|
234
|
+
req.body = {
|
235
|
+
**(request_options&.additional_body_parameters || {}),
|
236
|
+
name: name,
|
237
|
+
description: description,
|
238
|
+
fields: fields
|
239
|
+
}.compact
|
240
|
+
req.url "#{@request_client.get_url(environment: CandidApi,
|
241
|
+
request_options: request_options)}/api/custom-schemas/v1"
|
242
|
+
end
|
243
|
+
CandidApiClient::CustomSchemas::V1::Types::Schema.from_json(json_object: response.body)
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
# Update the name, description, or keys on a preexisting schema.
|
248
|
+
#
|
249
|
+
# @param schema_id [String]
|
250
|
+
# @param name [String]
|
251
|
+
# @param description [String]
|
252
|
+
# @param fields_to_add [Array<Hash>] A list of typed entries to add to schema. Only additive modifications are
|
253
|
+
# permitted.Request of type Array<CandidApiClient::CustomSchemas::V1::Types::SchemaField>, as a Hash
|
254
|
+
# * :key (String)
|
255
|
+
# * :type (CandidApiClient::Commons::Types::Primitive)
|
256
|
+
# @param request_options [CandidApiClient::RequestOptions]
|
257
|
+
# @return [CandidApiClient::CustomSchemas::V1::Types::Schema]
|
258
|
+
# @example
|
259
|
+
# api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
|
260
|
+
# api.custom_schemas.v_1.update(
|
261
|
+
# schema_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
|
262
|
+
# name: "string",
|
263
|
+
# description: "string",
|
264
|
+
# fields_to_add: [{ key: "string", type: BOOLEAN }]
|
265
|
+
# )
|
266
|
+
def update(schema_id:, name: nil, description: nil, fields_to_add: nil, request_options: nil)
|
267
|
+
Async do
|
268
|
+
response = @request_client.conn.patch do |req|
|
269
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
270
|
+
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
271
|
+
req.headers = {
|
272
|
+
**(req.headers || {}),
|
273
|
+
**@request_client.get_headers,
|
274
|
+
**(request_options&.additional_headers || {})
|
275
|
+
}.compact
|
276
|
+
req.body = {
|
277
|
+
**(request_options&.additional_body_parameters || {}),
|
278
|
+
name: name,
|
279
|
+
description: description,
|
280
|
+
fields_to_add: fields_to_add
|
281
|
+
}.compact
|
282
|
+
req.url "#{@request_client.get_url(environment: CandidApi,
|
283
|
+
request_options: request_options)}/api/custom-schemas/v1/#{schema_id}"
|
284
|
+
end
|
285
|
+
CandidApiClient::CustomSchemas::V1::Types::Schema.from_json(json_object: response.body)
|
286
|
+
end
|
287
|
+
end
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end
|
291
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../../commons/types/primitive"
|
4
|
+
require "ostruct"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module CandidApiClient
|
8
|
+
module CustomSchemas
|
9
|
+
module V1
|
10
|
+
module Types
|
11
|
+
class KeyWithNameAlreadyExistsError
|
12
|
+
# @return [String]
|
13
|
+
attr_reader :key
|
14
|
+
# @return [CandidApiClient::Commons::Types::Primitive]
|
15
|
+
attr_reader :value_type
|
16
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
17
|
+
attr_reader :additional_properties
|
18
|
+
# @return [Object]
|
19
|
+
attr_reader :_field_set
|
20
|
+
protected :_field_set
|
21
|
+
|
22
|
+
OMIT = Object.new
|
23
|
+
|
24
|
+
# @param key [String]
|
25
|
+
# @param value_type [CandidApiClient::Commons::Types::Primitive]
|
26
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
27
|
+
# @return [CandidApiClient::CustomSchemas::V1::Types::KeyWithNameAlreadyExistsError]
|
28
|
+
def initialize(key:, value_type:, additional_properties: nil)
|
29
|
+
@key = key
|
30
|
+
@value_type = value_type
|
31
|
+
@additional_properties = additional_properties
|
32
|
+
@_field_set = { "key": key, "value_type": value_type }
|
33
|
+
end
|
34
|
+
|
35
|
+
# Deserialize a JSON object to an instance of KeyWithNameAlreadyExistsError
|
36
|
+
#
|
37
|
+
# @param json_object [String]
|
38
|
+
# @return [CandidApiClient::CustomSchemas::V1::Types::KeyWithNameAlreadyExistsError]
|
39
|
+
def self.from_json(json_object:)
|
40
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
41
|
+
key = struct["key"]
|
42
|
+
value_type = struct["value_type"]
|
43
|
+
new(
|
44
|
+
key: key,
|
45
|
+
value_type: value_type,
|
46
|
+
additional_properties: struct
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Serialize an instance of KeyWithNameAlreadyExistsError to a JSON object
|
51
|
+
#
|
52
|
+
# @return [String]
|
53
|
+
def to_json(*_args)
|
54
|
+
@_field_set&.to_json
|
55
|
+
end
|
56
|
+
|
57
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
58
|
+
# hash and check each fields type against the current object's property
|
59
|
+
# definitions.
|
60
|
+
#
|
61
|
+
# @param obj [Object]
|
62
|
+
# @return [Void]
|
63
|
+
def self.validate_raw(obj:)
|
64
|
+
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
65
|
+
obj.value_type.is_a?(CandidApiClient::Commons::Types::Primitive) != false || raise("Passed value for field obj.value_type is not the expected type, validation failed.")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "schema_field"
|
4
|
+
require "ostruct"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module CandidApiClient
|
8
|
+
module CustomSchemas
|
9
|
+
module V1
|
10
|
+
module Types
|
11
|
+
class Schema
|
12
|
+
# @return [String]
|
13
|
+
attr_reader :id
|
14
|
+
# @return [String]
|
15
|
+
attr_reader :name
|
16
|
+
# @return [String]
|
17
|
+
attr_reader :description
|
18
|
+
# @return [Array<CandidApiClient::CustomSchemas::V1::Types::SchemaField>]
|
19
|
+
attr_reader :fields
|
20
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
21
|
+
attr_reader :additional_properties
|
22
|
+
# @return [Object]
|
23
|
+
attr_reader :_field_set
|
24
|
+
protected :_field_set
|
25
|
+
|
26
|
+
OMIT = Object.new
|
27
|
+
|
28
|
+
# @param id [String]
|
29
|
+
# @param name [String]
|
30
|
+
# @param description [String]
|
31
|
+
# @param fields [Array<CandidApiClient::CustomSchemas::V1::Types::SchemaField>]
|
32
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
33
|
+
# @return [CandidApiClient::CustomSchemas::V1::Types::Schema]
|
34
|
+
def initialize(id:, name:, fields:, description: OMIT, additional_properties: nil)
|
35
|
+
@id = id
|
36
|
+
@name = name
|
37
|
+
@description = description if description != OMIT
|
38
|
+
@fields = fields
|
39
|
+
@additional_properties = additional_properties
|
40
|
+
@_field_set = { "id": id, "name": name, "description": description, "fields": fields }.reject do |_k, v|
|
41
|
+
v == OMIT
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Deserialize a JSON object to an instance of Schema
|
46
|
+
#
|
47
|
+
# @param json_object [String]
|
48
|
+
# @return [CandidApiClient::CustomSchemas::V1::Types::Schema]
|
49
|
+
def self.from_json(json_object:)
|
50
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
51
|
+
parsed_json = JSON.parse(json_object)
|
52
|
+
id = struct["id"]
|
53
|
+
name = struct["name"]
|
54
|
+
description = struct["description"]
|
55
|
+
fields = parsed_json["fields"]&.map do |item|
|
56
|
+
item = item.to_json
|
57
|
+
CandidApiClient::CustomSchemas::V1::Types::SchemaField.from_json(json_object: item)
|
58
|
+
end
|
59
|
+
new(
|
60
|
+
id: id,
|
61
|
+
name: name,
|
62
|
+
description: description,
|
63
|
+
fields: fields,
|
64
|
+
additional_properties: struct
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
# Serialize an instance of Schema to a JSON object
|
69
|
+
#
|
70
|
+
# @return [String]
|
71
|
+
def to_json(*_args)
|
72
|
+
@_field_set&.to_json
|
73
|
+
end
|
74
|
+
|
75
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
76
|
+
# hash and check each fields type against the current object's property
|
77
|
+
# definitions.
|
78
|
+
#
|
79
|
+
# @param obj [Object]
|
80
|
+
# @return [Void]
|
81
|
+
def self.validate_raw(obj:)
|
82
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
83
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
84
|
+
obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|
85
|
+
obj.fields.is_a?(Array) != false || raise("Passed value for field obj.fields is not the expected type, validation failed.")
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../../commons/types/primitive"
|
4
|
+
require "ostruct"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module CandidApiClient
|
8
|
+
module CustomSchemas
|
9
|
+
module V1
|
10
|
+
module Types
|
11
|
+
class SchemaField
|
12
|
+
# @return [String]
|
13
|
+
attr_reader :key
|
14
|
+
# @return [CandidApiClient::Commons::Types::Primitive]
|
15
|
+
attr_reader :type
|
16
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
17
|
+
attr_reader :additional_properties
|
18
|
+
# @return [Object]
|
19
|
+
attr_reader :_field_set
|
20
|
+
protected :_field_set
|
21
|
+
|
22
|
+
OMIT = Object.new
|
23
|
+
|
24
|
+
# @param key [String]
|
25
|
+
# @param type [CandidApiClient::Commons::Types::Primitive]
|
26
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
27
|
+
# @return [CandidApiClient::CustomSchemas::V1::Types::SchemaField]
|
28
|
+
def initialize(key:, type:, additional_properties: nil)
|
29
|
+
@key = key
|
30
|
+
@type = type
|
31
|
+
@additional_properties = additional_properties
|
32
|
+
@_field_set = { "key": key, "type": type }
|
33
|
+
end
|
34
|
+
|
35
|
+
# Deserialize a JSON object to an instance of SchemaField
|
36
|
+
#
|
37
|
+
# @param json_object [String]
|
38
|
+
# @return [CandidApiClient::CustomSchemas::V1::Types::SchemaField]
|
39
|
+
def self.from_json(json_object:)
|
40
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
41
|
+
key = struct["key"]
|
42
|
+
type = struct["type"]
|
43
|
+
new(
|
44
|
+
key: key,
|
45
|
+
type: type,
|
46
|
+
additional_properties: struct
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Serialize an instance of SchemaField to a JSON object
|
51
|
+
#
|
52
|
+
# @return [String]
|
53
|
+
def to_json(*_args)
|
54
|
+
@_field_set&.to_json
|
55
|
+
end
|
56
|
+
|
57
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
58
|
+
# hash and check each fields type against the current object's property
|
59
|
+
# definitions.
|
60
|
+
#
|
61
|
+
# @param obj [Object]
|
62
|
+
# @return [Void]
|
63
|
+
def self.validate_raw(obj:)
|
64
|
+
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
65
|
+
obj.type.is_a?(CandidApiClient::Commons::Types::Primitive) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "schema"
|
4
|
+
require "ostruct"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module CandidApiClient
|
8
|
+
module CustomSchemas
|
9
|
+
module V1
|
10
|
+
module Types
|
11
|
+
class SchemaGetMultiResponse
|
12
|
+
# @return [Array<CandidApiClient::CustomSchemas::V1::Types::Schema>]
|
13
|
+
attr_reader :schemas
|
14
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
attr_reader :additional_properties
|
16
|
+
# @return [Object]
|
17
|
+
attr_reader :_field_set
|
18
|
+
protected :_field_set
|
19
|
+
|
20
|
+
OMIT = Object.new
|
21
|
+
|
22
|
+
# @param schemas [Array<CandidApiClient::CustomSchemas::V1::Types::Schema>]
|
23
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
24
|
+
# @return [CandidApiClient::CustomSchemas::V1::Types::SchemaGetMultiResponse]
|
25
|
+
def initialize(schemas:, additional_properties: nil)
|
26
|
+
@schemas = schemas
|
27
|
+
@additional_properties = additional_properties
|
28
|
+
@_field_set = { "schemas": schemas }
|
29
|
+
end
|
30
|
+
|
31
|
+
# Deserialize a JSON object to an instance of SchemaGetMultiResponse
|
32
|
+
#
|
33
|
+
# @param json_object [String]
|
34
|
+
# @return [CandidApiClient::CustomSchemas::V1::Types::SchemaGetMultiResponse]
|
35
|
+
def self.from_json(json_object:)
|
36
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
37
|
+
parsed_json = JSON.parse(json_object)
|
38
|
+
schemas = parsed_json["schemas"]&.map do |item|
|
39
|
+
item = item.to_json
|
40
|
+
CandidApiClient::CustomSchemas::V1::Types::Schema.from_json(json_object: item)
|
41
|
+
end
|
42
|
+
new(schemas: schemas, additional_properties: struct)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Serialize an instance of SchemaGetMultiResponse to a JSON object
|
46
|
+
#
|
47
|
+
# @return [String]
|
48
|
+
def to_json(*_args)
|
49
|
+
@_field_set&.to_json
|
50
|
+
end
|
51
|
+
|
52
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
53
|
+
# hash and check each fields type against the current object's property
|
54
|
+
# definitions.
|
55
|
+
#
|
56
|
+
# @param obj [Object]
|
57
|
+
# @return [Void]
|
58
|
+
def self.validate_raw(obj:)
|
59
|
+
obj.schemas.is_a?(Array) != false || raise("Passed value for field obj.schemas is not the expected type, validation failed.")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|