Class: CandidApiClient::MedicationDispense::V1::V1Client

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/medication_dispense/v_1/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ CandidApiClient::MedicationDispense::V1::V1Client

Parameters:



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_clientCandidApiClient::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

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.medication_dispense.v_1.create(request: { medication_dispense_external_id: "string", patient_external_id: "string", procedure_code: "string", quantity: "string", units: MJ, date_of_service: DateTime.parse(2023-01-15), drug_identification: { service_id_qualifier: EAN_UCC_13, national_drug_code: "string", national_drug_unit_count: "string", measurement_unit_code: MILLILITERS, link_sequence_number: "string", pharmacy_prescription_number: "string", conversion_formula: "string", drug_description: "string" }, description: "string", modifiers: [TWENTY_TWO] })

Parameters:

  • request (Hash)

    Request of type CandidApiClient::MedicationDispense::V1::Types::MedicationDispenseCreate, as a Hash

    • :medication_dispense_external_id (String)

    • :patient_external_id (String)

    • :procedure_code (String)

    • :quantity (String)

    • :units (CandidApiClient::Commons::Types::ServiceLineUnits)

    • :date_of_service (Date)

    • :drug_identification (Hash)

      • :service_id_qualifier (CandidApiClient::ServiceLines::V2::Types::ServiceIdQualifier)

      • :national_drug_code (String)

      • :national_drug_unit_count (String)

      • :measurement_unit_code (CandidApiClient::ServiceLines::V2::Types::MeasurementUnitCode)

      • :link_sequence_number (String)

      • :pharmacy_prescription_number (String)

      • :conversion_formula (String)

      • :drug_description (String)

    • :description (String)

    • :modifiers (Array<CandidApiClient::Commons::Types::ProcedureModifier>)

  • request_options (CandidApiClient::RequestOptions) (defaults to: nil)

Returns:



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.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
    req.url "#{@request_client.get_url(environment: CandidApi,
                                       request_options: request_options)}/api/medication-dispense/v1"
  end
  CandidApiClient::Encounters::V4::Types::Encounter.from_json(json_object: response.body)
end