Class: CandidApiClient::CustomSchemas::V1::V1Client
- Inherits:
-
Object
- Object
- CandidApiClient::CustomSchemas::V1::V1Client
- 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::V1Client 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::V1Client
18 19 20 |
# File 'lib/candidhealth/custom_schemas/v_1/client.rb', line 18 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ CandidApiClient::RequestClient (readonly)
14 15 16 |
# File 'lib/candidhealth/custom_schemas/v_1/client.rb', line 14 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.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/candidhealth/custom_schemas/v_1/client.rb', line 85 def create(name:, fields:, description: nil, request_options: nil) 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 |
#get(schema_id:, request_options: nil) ⇒ CandidApiClient::CustomSchemas::V1::Types::Schema
Return a custom schema with a given ID.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/candidhealth/custom_schemas/v_1/client.rb', line 52 def get(schema_id:, request_options: nil) 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 |
#get_multi(request_options: nil) ⇒ CandidApiClient::CustomSchemas::V1::Types::SchemaGetMultiResponse
Returns all custom schemas.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/candidhealth/custom_schemas/v_1/client.rb', line 29 def get_multi(request_options: nil) 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 |
#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.
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/candidhealth/custom_schemas/v_1/client.rb', line 125 def update(schema_id:, name: nil, description: nil, fields_to_add: nil, request_options: nil) 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 |