Class: CandidApiClient::MedicationDispense::V1::V1Client
- Inherits:
-
Object
- Object
- CandidApiClient::MedicationDispense::V1::V1Client
- Defined in:
- lib/candidhealth/medication_dispense/v_1/client.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
- #create(request:, request_options: nil) ⇒ CandidApiClient::Encounters::V4::Types::Encounter
- #initialize(request_client:) ⇒ CandidApiClient::MedicationDispense::V1::V1Client constructor
Constructor Details
#initialize(request_client:) ⇒ CandidApiClient::MedicationDispense::V1::V1Client
17 18 19 |
# File 'lib/candidhealth/medication_dispense/v_1/client.rb', line 17 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ CandidApiClient::RequestClient (readonly)
13 14 15 |
# File 'lib/candidhealth/medication_dispense/v_1/client.rb', line 13 def request_client @request_client end |
Instance Method Details
#create(request:, request_options: nil) ⇒ CandidApiClient::Encounters::V4::Types::Encounter
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/candidhealth/medication_dispense/v_1/client.rb', line 44 def create(request:, 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 = { **(request || {}), **(&.additional_body_parameters || {}) }.compact req.url "#{@request_client.get_url(environment: CandidApi, request_options: )}/api/medication-dispense/v1" end CandidApiClient::Encounters::V4::Types::Encounter.from_json(json_object: response.body) end |