Class: CandidApiClient::CustomSchemas::V1::AsyncV1Client
- Inherits:
-
Object
- Object
- CandidApiClient::CustomSchemas::V1::AsyncV1Client
- Defined in:
- lib/candidhealth/custom_schemas/v_1/client.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#create(name:, fields:, description: nil, request_options: nil) ⇒ CandidApiClient::CustomSchemas::V1::Types::Schema
Create custom schema with a set of typed keys.
-
#get(schema_id:, request_options: nil) ⇒ CandidApiClient::CustomSchemas::V1::Types::Schema
Return a custom schema with a given ID.
-
#get_multi(request_options: nil) ⇒ CandidApiClient::CustomSchemas::V1::Types::SchemaGetMultiResponse
Returns all custom schemas.
- #initialize(request_client:) ⇒ CandidApiClient::CustomSchemas::V1::AsyncV1Client constructor
-
#update(schema_id:, name: nil, description: nil, fields_to_add: nil, request_options: nil) ⇒ CandidApiClient::CustomSchemas::V1::Types::Schema
Update the name, description, or keys on a preexisting schema.
Constructor Details
#initialize(request_client:) ⇒ CandidApiClient::CustomSchemas::V1::AsyncV1Client
153 154 155 |
# File 'lib/candidhealth/custom_schemas/v_1/client.rb', line 153 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ CandidApiClient::AsyncRequestClient (readonly)
149 150 151 |
# File 'lib/candidhealth/custom_schemas/v_1/client.rb', line 149 def request_client @request_client end |
Instance Method Details
#create(name:, fields:, description: nil, request_options: nil) ⇒ CandidApiClient::CustomSchemas::V1::Types::Schema
Create custom schema with a set of typed keys. Schema keys can be referenced as
inputs in user-configurable rules in the Rules
Engine, and key-value pairs can be attached to claims via the Encounters API.
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/candidhealth/custom_schemas/v_1/client.rb', line 224 def create(name:, fields:, description: nil, request_options: nil) Async do response = @request_client.conn.post do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.body = { **(&.additional_body_parameters || {}), name: name, description: description, fields: fields }.compact req.url "#{@request_client.get_url(environment: CandidApi, request_options: )}/api/custom-schemas/v1" end CandidApiClient::CustomSchemas::V1::Types::Schema.from_json(json_object: response.body) end end |
#get(schema_id:, request_options: nil) ⇒ CandidApiClient::CustomSchemas::V1::Types::Schema
Return a custom schema with a given ID.
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/candidhealth/custom_schemas/v_1/client.rb', line 189 def get(schema_id:, request_options: nil) Async do response = @request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.url "#{@request_client.get_url(environment: CandidApi, request_options: )}/api/custom-schemas/v1/#{schema_id}" end CandidApiClient::CustomSchemas::V1::Types::Schema.from_json(json_object: response.body) end end |
#get_multi(request_options: nil) ⇒ CandidApiClient::CustomSchemas::V1::Types::SchemaGetMultiResponse
Returns all custom schemas.
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/candidhealth/custom_schemas/v_1/client.rb', line 164 def get_multi(request_options: nil) Async do response = @request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.url "#{@request_client.get_url(environment: CandidApi, request_options: )}/api/custom-schemas/v1" end CandidApiClient::CustomSchemas::V1::Types::SchemaGetMultiResponse.from_json(json_object: response.body) end end |
#update(schema_id:, name: nil, description: nil, fields_to_add: nil, request_options: nil) ⇒ CandidApiClient::CustomSchemas::V1::Types::Schema
Update the name, description, or keys on a preexisting schema.
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
# File 'lib/candidhealth/custom_schemas/v_1/client.rb', line 266 def update(schema_id:, name: nil, description: nil, fields_to_add: nil, request_options: nil) Async do response = @request_client.conn.patch do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.body = { **(&.additional_body_parameters || {}), name: name, description: description, fields_to_add: fields_to_add }.compact req.url "#{@request_client.get_url(environment: CandidApi, request_options: )}/api/custom-schemas/v1/#{schema_id}" end CandidApiClient::CustomSchemas::V1::Types::Schema.from_json(json_object: response.body) end end |