candidhealth 0.30.0 → 0.32.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/lib/candidhealth/encounters/v_4/client.rb +45 -106
  3. data/lib/candidhealth/encounters/v_4/types/vitals_update.rb +116 -0
  4. data/lib/candidhealth/expected_network_status/v_2/client.rb +4 -4
  5. data/lib/candidhealth/financials/types/allocation_target_create.rb +10 -9
  6. data/lib/candidhealth/financials/types/appointment_allocation_target.rb +13 -3
  7. data/lib/candidhealth/financials/types/appointment_by_id_and_patient_external_id.rb +68 -0
  8. data/lib/candidhealth/import_invoice/v_1/client.rb +4 -4
  9. data/lib/candidhealth/individual/types/patient.rb +14 -2
  10. data/lib/candidhealth/individual/types/patient_create.rb +10 -2
  11. data/lib/candidhealth/insurance_adjudications/v_1/client.rb +2 -2
  12. data/lib/candidhealth/insurance_payments/v_1/client.rb +2 -2
  13. data/lib/candidhealth/insurance_refunds/v_1/client.rb +2 -2
  14. data/lib/candidhealth/medication_dispense/client.rb +30 -0
  15. data/lib/candidhealth/medication_dispense/v_1/client.rb +112 -0
  16. data/lib/candidhealth/medication_dispense/v_1/types/medication_dispense_create.rb +142 -0
  17. data/lib/candidhealth/non_insurance_payer_payments/v_1/client.rb +2 -2
  18. data/lib/candidhealth/non_insurance_payer_refunds/v_1/client.rb +2 -2
  19. data/lib/candidhealth/organization_providers/v_3/client.rb +2 -2
  20. data/lib/candidhealth/pre_encounter/appointments/v_1/client.rb +4 -4
  21. data/lib/candidhealth/pre_encounter/coverages/v_1/client.rb +4 -4
  22. data/lib/candidhealth/pre_encounter/patients/v_1/client.rb +6 -6
  23. data/lib/candidhealth/service_lines/v_2/client.rb +20 -4
  24. data/lib/candidhealth/service_lines/v_2/types/service_line.rb +15 -40
  25. data/lib/candidhealth/service_lines/v_2/types/service_line_create.rb +1 -65
  26. data/lib/candidhealth/service_lines/v_2/types/service_line_update.rb +15 -1
  27. data/lib/candidhealth/third_party_payer_payments/v_1/client.rb +2 -2
  28. data/lib/candidhealth/third_party_payer_refunds/v_1/client.rb +2 -2
  29. data/lib/candidhealth.rb +7 -0
  30. data/lib/requests.rb +2 -2
  31. data/lib/types_export.rb +3 -0
  32. metadata +7 -2
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module CandidApiClient
7
+ module Financials
8
+ module Types
9
+ class AppointmentByIdAndPatientExternalId
10
+ # @return [String]
11
+ attr_reader :appointment_id
12
+ # @return [String]
13
+ attr_reader :patient_external_id
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 appointment_id [String]
23
+ # @param patient_external_id [String]
24
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
25
+ # @return [CandidApiClient::Financials::Types::AppointmentByIdAndPatientExternalId]
26
+ def initialize(appointment_id:, patient_external_id:, additional_properties: nil)
27
+ @appointment_id = appointment_id
28
+ @patient_external_id = patient_external_id
29
+ @additional_properties = additional_properties
30
+ @_field_set = { "appointment_id": appointment_id, "patient_external_id": patient_external_id }
31
+ end
32
+
33
+ # Deserialize a JSON object to an instance of AppointmentByIdAndPatientExternalId
34
+ #
35
+ # @param json_object [String]
36
+ # @return [CandidApiClient::Financials::Types::AppointmentByIdAndPatientExternalId]
37
+ def self.from_json(json_object:)
38
+ struct = JSON.parse(json_object, object_class: OpenStruct)
39
+ appointment_id = struct["appointment_id"]
40
+ patient_external_id = struct["patient_external_id"]
41
+ new(
42
+ appointment_id: appointment_id,
43
+ patient_external_id: patient_external_id,
44
+ additional_properties: struct
45
+ )
46
+ end
47
+
48
+ # Serialize an instance of AppointmentByIdAndPatientExternalId to a JSON object
49
+ #
50
+ # @return [String]
51
+ def to_json(*_args)
52
+ @_field_set&.to_json
53
+ end
54
+
55
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
56
+ # hash and check each fields type against the current object's property
57
+ # definitions.
58
+ #
59
+ # @param obj [Object]
60
+ # @return [Void]
61
+ def self.validate_raw(obj:)
62
+ obj.appointment_id.is_a?(String) != false || raise("Passed value for field obj.appointment_id is not the expected type, validation failed.")
63
+ obj.patient_external_id.is_a?(String) != false || raise("Passed value for field obj.patient_external_id is not the expected type, validation failed.")
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -41,7 +41,7 @@ module CandidApiClient
41
41
  # @return [CandidApiClient::ImportInvoice::V1::Types::ImportInvoice]
42
42
  # @example
43
43
  # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
44
- # api.import_invoice.v_1.import_invoice(request: { external_payment_account_config_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", patient_external_id: "string", external_customer_identifier: "string", note: "string", due_date: DateTime.parse(2023-01-15), items: [{ }], status: DRAFT, external_identifier: "string", customer_invoice_url: "string" })
44
+ # api.import_invoice.v_1.import_invoice(request: { external_payment_account_config_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", patient_external_id: "string", external_customer_identifier: "string", note: "string", due_date: DateTime.parse(2023-01-15), items: [{ amount_cents: 1 }], status: DRAFT, external_identifier: "string", customer_invoice_url: "string" })
45
45
  def import_invoice(request:, request_options: nil)
46
46
  response = @request_client.conn.post do |req|
47
47
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -154,7 +154,7 @@ module CandidApiClient
154
154
  # @return [CandidApiClient::ImportInvoice::V1::Types::ImportInvoice]
155
155
  # @example
156
156
  # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
157
- # api.import_invoice.v_1.update(invoice_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", request: { customer_invoice_url: "string", status: DRAFT, note: "string", due_date: DateTime.parse(2023-01-15), items: { update_type: APPEND, items: [{ }] } })
157
+ # api.import_invoice.v_1.update(invoice_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", request: { customer_invoice_url: "string", status: DRAFT, note: "string", due_date: DateTime.parse(2023-01-15), items: { update_type: APPEND, items: [{ amount_cents: 1 }] } })
158
158
  def update(invoice_id:, request:, request_options: nil)
159
159
  response = @request_client.conn.patch do |req|
160
160
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -199,7 +199,7 @@ module CandidApiClient
199
199
  # @return [CandidApiClient::ImportInvoice::V1::Types::ImportInvoice]
200
200
  # @example
201
201
  # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
202
- # api.import_invoice.v_1.import_invoice(request: { external_payment_account_config_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", patient_external_id: "string", external_customer_identifier: "string", note: "string", due_date: DateTime.parse(2023-01-15), items: [{ }], status: DRAFT, external_identifier: "string", customer_invoice_url: "string" })
202
+ # api.import_invoice.v_1.import_invoice(request: { external_payment_account_config_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", patient_external_id: "string", external_customer_identifier: "string", note: "string", due_date: DateTime.parse(2023-01-15), items: [{ amount_cents: 1 }], status: DRAFT, external_identifier: "string", customer_invoice_url: "string" })
203
203
  def import_invoice(request:, request_options: nil)
204
204
  Async do
205
205
  response = @request_client.conn.post do |req|
@@ -318,7 +318,7 @@ module CandidApiClient
318
318
  # @return [CandidApiClient::ImportInvoice::V1::Types::ImportInvoice]
319
319
  # @example
320
320
  # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
321
- # api.import_invoice.v_1.update(invoice_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", request: { customer_invoice_url: "string", status: DRAFT, note: "string", due_date: DateTime.parse(2023-01-15), items: { update_type: APPEND, items: [{ }] } })
321
+ # api.import_invoice.v_1.update(invoice_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", request: { customer_invoice_url: "string", status: DRAFT, note: "string", due_date: DateTime.parse(2023-01-15), items: { update_type: APPEND, items: [{ amount_cents: 1 }] } })
322
322
  def update(invoice_id:, request:, request_options: nil)
323
323
  Async do
324
324
  response = @request_client.conn.patch do |req|
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "../../commons/types/phone_number"
4
+ require_relative "../../non_insurance_payers/v_1/types/non_insurance_payer"
4
5
  require "date"
5
6
  require_relative "../../commons/types/street_address_short_zip"
6
7
  require_relative "gender"
@@ -21,6 +22,8 @@ module CandidApiClient
21
22
  attr_reader :email
22
23
  # @return [Boolean]
23
24
  attr_reader :email_consent
25
+ # @return [Array<CandidApiClient::NonInsurancePayers::V1::Types::NonInsurancePayer>]
26
+ attr_reader :non_insurance_payers
24
27
  # @return [String] The ID used to identify this individual in your system. For example, your
25
28
  # internal patient ID or an EHR patient ID.
26
29
  attr_reader :external_id
@@ -48,6 +51,7 @@ module CandidApiClient
48
51
  # @param phone_consent [Boolean]
49
52
  # @param email [String]
50
53
  # @param email_consent [Boolean]
54
+ # @param non_insurance_payers [Array<CandidApiClient::NonInsurancePayers::V1::Types::NonInsurancePayer>]
51
55
  # @param external_id [String] The ID used to identify this individual in your system. For example, your
52
56
  # internal patient ID or an EHR patient ID.
53
57
  # @param date_of_birth [Date] Box 3 on the CMS-1500 claim form. The date format should be in ISO 8601 date;
@@ -58,13 +62,14 @@ module CandidApiClient
58
62
  # @param gender [CandidApiClient::Individual::Types::Gender]
59
63
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
60
64
  # @return [CandidApiClient::Individual::Types::Patient]
61
- def initialize(individual_id:, phone_numbers:, phone_consent:, email_consent:, external_id:, date_of_birth:,
62
- address:, first_name:, last_name:, gender:, email: OMIT, additional_properties: nil)
65
+ def initialize(individual_id:, phone_numbers:, phone_consent:, email_consent:, non_insurance_payers:,
66
+ external_id:, date_of_birth:, address:, first_name:, last_name:, gender:, email: OMIT, additional_properties: nil)
63
67
  @individual_id = individual_id
64
68
  @phone_numbers = phone_numbers
65
69
  @phone_consent = phone_consent
66
70
  @email = email if email != OMIT
67
71
  @email_consent = email_consent
72
+ @non_insurance_payers = non_insurance_payers
68
73
  @external_id = external_id
69
74
  @date_of_birth = date_of_birth
70
75
  @address = address
@@ -78,6 +83,7 @@ module CandidApiClient
78
83
  "phone_consent": phone_consent,
79
84
  "email": email,
80
85
  "email_consent": email_consent,
86
+ "non_insurance_payers": non_insurance_payers,
81
87
  "external_id": external_id,
82
88
  "date_of_birth": date_of_birth,
83
89
  "address": address,
@@ -104,6 +110,10 @@ module CandidApiClient
104
110
  phone_consent = struct["phone_consent"]
105
111
  email = struct["email"]
106
112
  email_consent = struct["email_consent"]
113
+ non_insurance_payers = parsed_json["non_insurance_payers"]&.map do |item|
114
+ item = item.to_json
115
+ CandidApiClient::NonInsurancePayers::V1::Types::NonInsurancePayer.from_json(json_object: item)
116
+ end
107
117
  external_id = struct["external_id"]
108
118
  date_of_birth = (Date.parse(parsed_json["date_of_birth"]) unless parsed_json["date_of_birth"].nil?)
109
119
  if parsed_json["address"].nil?
@@ -121,6 +131,7 @@ module CandidApiClient
121
131
  phone_consent: phone_consent,
122
132
  email: email,
123
133
  email_consent: email_consent,
134
+ non_insurance_payers: non_insurance_payers,
124
135
  external_id: external_id,
125
136
  date_of_birth: date_of_birth,
126
137
  address: address,
@@ -150,6 +161,7 @@ module CandidApiClient
150
161
  obj.phone_consent.is_a?(Boolean) != false || raise("Passed value for field obj.phone_consent is not the expected type, validation failed.")
151
162
  obj.email&.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.")
152
163
  obj.email_consent.is_a?(Boolean) != false || raise("Passed value for field obj.email_consent is not the expected type, validation failed.")
164
+ obj.non_insurance_payers.is_a?(Array) != false || raise("Passed value for field obj.non_insurance_payers is not the expected type, validation failed.")
153
165
  obj.external_id.is_a?(String) != false || raise("Passed value for field obj.external_id is not the expected type, validation failed.")
154
166
  obj.date_of_birth.is_a?(Date) != false || raise("Passed value for field obj.date_of_birth is not the expected type, validation failed.")
155
167
  CandidApiClient::Commons::Types::StreetAddressShortZip.validate_raw(obj: obj.address)
@@ -17,6 +17,8 @@ module CandidApiClient
17
17
  attr_reader :phone_consent
18
18
  # @return [String]
19
19
  attr_reader :email
20
+ # @return [Array<String>]
21
+ attr_reader :non_insurance_payers
20
22
  # @return [Boolean] Defaults to false
21
23
  attr_reader :email_consent
22
24
  # @return [String] The ID used to identify this individual in your system. For example, your
@@ -44,6 +46,7 @@ module CandidApiClient
44
46
  # @param phone_numbers [Array<CandidApiClient::Commons::Types::PhoneNumber>]
45
47
  # @param phone_consent [Boolean] Defaults to false
46
48
  # @param email [String]
49
+ # @param non_insurance_payers [Array<String>]
47
50
  # @param email_consent [Boolean] Defaults to false
48
51
  # @param external_id [String] The ID used to identify this individual in your system. For example, your
49
52
  # internal patient ID or an EHR patient ID.
@@ -55,11 +58,12 @@ module CandidApiClient
55
58
  # @param gender [CandidApiClient::Individual::Types::Gender]
56
59
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
57
60
  # @return [CandidApiClient::Individual::Types::PatientCreate]
58
- def initialize(external_id:, date_of_birth:, address:, first_name:, last_name:, gender:, phone_numbers: OMIT,
59
- phone_consent: OMIT, email: OMIT, email_consent: OMIT, additional_properties: nil)
61
+ def initialize(external_id:, date_of_birth:, address:, first_name:, last_name:, gender:, phone_numbers: OMIT, phone_consent: OMIT, email: OMIT, non_insurance_payers: OMIT,
62
+ email_consent: OMIT, additional_properties: nil)
60
63
  @phone_numbers = phone_numbers if phone_numbers != OMIT
61
64
  @phone_consent = phone_consent if phone_consent != OMIT
62
65
  @email = email if email != OMIT
66
+ @non_insurance_payers = non_insurance_payers if non_insurance_payers != OMIT
63
67
  @email_consent = email_consent if email_consent != OMIT
64
68
  @external_id = external_id
65
69
  @date_of_birth = date_of_birth
@@ -72,6 +76,7 @@ module CandidApiClient
72
76
  "phone_numbers": phone_numbers,
73
77
  "phone_consent": phone_consent,
74
78
  "email": email,
79
+ "non_insurance_payers": non_insurance_payers,
75
80
  "email_consent": email_consent,
76
81
  "external_id": external_id,
77
82
  "date_of_birth": date_of_birth,
@@ -97,6 +102,7 @@ module CandidApiClient
97
102
  end
98
103
  phone_consent = struct["phone_consent"]
99
104
  email = struct["email"]
105
+ non_insurance_payers = struct["non_insurance_payers"]
100
106
  email_consent = struct["email_consent"]
101
107
  external_id = struct["external_id"]
102
108
  date_of_birth = (Date.parse(parsed_json["date_of_birth"]) unless parsed_json["date_of_birth"].nil?)
@@ -113,6 +119,7 @@ module CandidApiClient
113
119
  phone_numbers: phone_numbers,
114
120
  phone_consent: phone_consent,
115
121
  email: email,
122
+ non_insurance_payers: non_insurance_payers,
116
123
  email_consent: email_consent,
117
124
  external_id: external_id,
118
125
  date_of_birth: date_of_birth,
@@ -141,6 +148,7 @@ module CandidApiClient
141
148
  obj.phone_numbers&.is_a?(Array) != false || raise("Passed value for field obj.phone_numbers is not the expected type, validation failed.")
142
149
  obj.phone_consent&.is_a?(Boolean) != false || raise("Passed value for field obj.phone_consent is not the expected type, validation failed.")
143
150
  obj.email&.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.")
151
+ obj.non_insurance_payers&.is_a?(Array) != false || raise("Passed value for field obj.non_insurance_payers is not the expected type, validation failed.")
144
152
  obj.email_consent&.is_a?(Boolean) != false || raise("Passed value for field obj.email_consent is not the expected type, validation failed.")
145
153
  obj.external_id.is_a?(String) != false || raise("Passed value for field obj.external_id is not the expected type, validation failed.")
146
154
  obj.date_of_birth.is_a?(Date) != false || raise("Passed value for field obj.date_of_birth is not the expected type, validation failed.")
@@ -59,7 +59,7 @@ module CandidApiClient
59
59
  # @return [CandidApiClient::InsuranceAdjudications::V1::Types::InsuranceAdjudication]
60
60
  # @example
61
61
  # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
62
- # api.insurance_adjudications.v_1.create(request: { payee: { }, post_date: DateTime.parse(2023-01-15), check_number: "string", check_date: DateTime.parse(2023-01-15), note: "string", claims: { "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32": [{ }] } })
62
+ # api.insurance_adjudications.v_1.create(request: { payee: { payee_name: "string" }, post_date: DateTime.parse(2023-01-15), check_number: "string", check_date: DateTime.parse(2023-01-15), note: "string", claims: { "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32": [{ claim_status_code: PROCESSED_AS_PRIMARY, insurance_paid_amount_cents: {"key":"value"}, charge_amount_cents: {"key":"value"}, service_lines: { "string": {"key":"value"} }, payer_claim_number: {"key":"value"}, carcs: [{"key":"value"}] }] } })
63
63
  def create(request:, request_options: nil)
64
64
  response = @request_client.conn.post do |req|
65
65
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -153,7 +153,7 @@ module CandidApiClient
153
153
  # @return [CandidApiClient::InsuranceAdjudications::V1::Types::InsuranceAdjudication]
154
154
  # @example
155
155
  # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
156
- # api.insurance_adjudications.v_1.create(request: { payee: { }, post_date: DateTime.parse(2023-01-15), check_number: "string", check_date: DateTime.parse(2023-01-15), note: "string", claims: { "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32": [{ }] } })
156
+ # api.insurance_adjudications.v_1.create(request: { payee: { payee_name: "string" }, post_date: DateTime.parse(2023-01-15), check_number: "string", check_date: DateTime.parse(2023-01-15), note: "string", claims: { "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32": [{ claim_status_code: PROCESSED_AS_PRIMARY, insurance_paid_amount_cents: {"key":"value"}, charge_amount_cents: {"key":"value"}, service_lines: { "string": {"key":"value"} }, payer_claim_number: {"key":"value"}, carcs: [{"key":"value"}] }] } })
157
157
  def create(request:, request_options: nil)
158
158
  Async do
159
159
  response = @request_client.conn.post do |req|
@@ -115,7 +115,7 @@ module CandidApiClient
115
115
  # @return [CandidApiClient::InsurancePayments::V1::Types::InsurancePayment]
116
116
  # @example
117
117
  # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
118
- # api.insurance_payments.v_1.create(request: { amount_cents: 1, payment_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z), payment_note: "string", allocations: [{ }] })
118
+ # api.insurance_payments.v_1.create(request: { amount_cents: 1, payment_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z), payment_note: "string", allocations: [{ amount_cents: 1 }] })
119
119
  def create(request:, request_options: nil)
120
120
  response = @request_client.conn.post do |req|
121
121
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -296,7 +296,7 @@ module CandidApiClient
296
296
  # @return [CandidApiClient::InsurancePayments::V1::Types::InsurancePayment]
297
297
  # @example
298
298
  # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
299
- # api.insurance_payments.v_1.create(request: { amount_cents: 1, payment_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z), payment_note: "string", allocations: [{ }] })
299
+ # api.insurance_payments.v_1.create(request: { amount_cents: 1, payment_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z), payment_note: "string", allocations: [{ amount_cents: 1 }] })
300
300
  def create(request:, request_options: nil)
301
301
  Async do
302
302
  response = @request_client.conn.post do |req|
@@ -118,7 +118,7 @@ module CandidApiClient
118
118
  # @return [CandidApiClient::InsuranceRefunds::V1::Types::InsuranceRefund]
119
119
  # @example
120
120
  # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
121
- # api.insurance_refunds.v_1.create(request: { amount_cents: 1, refund_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z), refund_note: "string", allocations: [{ }], refund_reason: OVERCHARGED })
121
+ # api.insurance_refunds.v_1.create(request: { amount_cents: 1, refund_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z), refund_note: "string", allocations: [{ amount_cents: 1 }], refund_reason: OVERCHARGED })
122
122
  def create(request:, request_options: nil)
123
123
  response = @request_client.conn.post do |req|
124
124
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -303,7 +303,7 @@ module CandidApiClient
303
303
  # @return [CandidApiClient::InsuranceRefunds::V1::Types::InsuranceRefund]
304
304
  # @example
305
305
  # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
306
- # api.insurance_refunds.v_1.create(request: { amount_cents: 1, refund_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z), refund_note: "string", allocations: [{ }], refund_reason: OVERCHARGED })
306
+ # api.insurance_refunds.v_1.create(request: { amount_cents: 1, refund_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z), refund_note: "string", allocations: [{ amount_cents: 1 }], refund_reason: OVERCHARGED })
307
307
  def create(request:, request_options: nil)
308
308
  Async do
309
309
  response = @request_client.conn.post do |req|
@@ -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 MedicationDispense
8
+ class Client
9
+ # @return [CandidApiClient::MedicationDispense::V1::V1Client]
10
+ attr_reader :v_1
11
+
12
+ # @param request_client [CandidApiClient::RequestClient]
13
+ # @return [CandidApiClient::MedicationDispense::Client]
14
+ def initialize(request_client:)
15
+ @v_1 = CandidApiClient::MedicationDispense::V1::V1Client.new(request_client: request_client)
16
+ end
17
+ end
18
+
19
+ class AsyncClient
20
+ # @return [CandidApiClient::MedicationDispense::V1::AsyncV1Client]
21
+ attr_reader :v_1
22
+
23
+ # @param request_client [CandidApiClient::AsyncRequestClient]
24
+ # @return [CandidApiClient::MedicationDispense::AsyncClient]
25
+ def initialize(request_client:)
26
+ @v_1 = CandidApiClient::MedicationDispense::V1::AsyncV1Client.new(request_client: request_client)
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,112 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../requests"
4
+ require_relative "types/medication_dispense_create"
5
+ require_relative "../../encounters/v_4/types/encounter"
6
+ require "async"
7
+
8
+ module CandidApiClient
9
+ module MedicationDispense
10
+ module V1
11
+ class V1Client
12
+ # @return [CandidApiClient::RequestClient]
13
+ attr_reader :request_client
14
+
15
+ # @param request_client [CandidApiClient::RequestClient]
16
+ # @return [CandidApiClient::MedicationDispense::V1::V1Client]
17
+ def initialize(request_client:)
18
+ @request_client = request_client
19
+ end
20
+
21
+ # @param request [Hash] Request of type CandidApiClient::MedicationDispense::V1::Types::MedicationDispenseCreate, as a Hash
22
+ # * :medication_dispense_external_id (String)
23
+ # * :patient_external_id (String)
24
+ # * :procedure_code (String)
25
+ # * :quantity (String)
26
+ # * :units (CandidApiClient::Commons::Types::ServiceLineUnits)
27
+ # * :date_of_service (Date)
28
+ # * :drug_identification (Hash)
29
+ # * :service_id_qualifier (CandidApiClient::ServiceLines::V2::Types::ServiceIdQualifier)
30
+ # * :national_drug_code (String)
31
+ # * :national_drug_unit_count (String)
32
+ # * :measurement_unit_code (CandidApiClient::ServiceLines::V2::Types::MeasurementUnitCode)
33
+ # * :link_sequence_number (String)
34
+ # * :pharmacy_prescription_number (String)
35
+ # * :conversion_formula (String)
36
+ # * :description (String)
37
+ # * :modifiers (Array<CandidApiClient::Commons::Types::ProcedureModifier>)
38
+ # @param request_options [CandidApiClient::RequestOptions]
39
+ # @return [CandidApiClient::Encounters::V4::Types::Encounter]
40
+ # @example
41
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
42
+ # 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" }, description: "string", modifiers: [TWENTY_TWO] })
43
+ def create(request:, request_options: nil)
44
+ response = @request_client.conn.post do |req|
45
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
46
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
47
+ req.headers = {
48
+ **(req.headers || {}),
49
+ **@request_client.get_headers,
50
+ **(request_options&.additional_headers || {})
51
+ }.compact
52
+ req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
53
+ req.url "#{@request_client.get_url(environment: CandidApi,
54
+ request_options: request_options)}/api/medication-dispense/v1"
55
+ end
56
+ CandidApiClient::Encounters::V4::Types::Encounter.from_json(json_object: response.body)
57
+ end
58
+ end
59
+
60
+ class AsyncV1Client
61
+ # @return [CandidApiClient::AsyncRequestClient]
62
+ attr_reader :request_client
63
+
64
+ # @param request_client [CandidApiClient::AsyncRequestClient]
65
+ # @return [CandidApiClient::MedicationDispense::V1::AsyncV1Client]
66
+ def initialize(request_client:)
67
+ @request_client = request_client
68
+ end
69
+
70
+ # @param request [Hash] Request of type CandidApiClient::MedicationDispense::V1::Types::MedicationDispenseCreate, as a Hash
71
+ # * :medication_dispense_external_id (String)
72
+ # * :patient_external_id (String)
73
+ # * :procedure_code (String)
74
+ # * :quantity (String)
75
+ # * :units (CandidApiClient::Commons::Types::ServiceLineUnits)
76
+ # * :date_of_service (Date)
77
+ # * :drug_identification (Hash)
78
+ # * :service_id_qualifier (CandidApiClient::ServiceLines::V2::Types::ServiceIdQualifier)
79
+ # * :national_drug_code (String)
80
+ # * :national_drug_unit_count (String)
81
+ # * :measurement_unit_code (CandidApiClient::ServiceLines::V2::Types::MeasurementUnitCode)
82
+ # * :link_sequence_number (String)
83
+ # * :pharmacy_prescription_number (String)
84
+ # * :conversion_formula (String)
85
+ # * :description (String)
86
+ # * :modifiers (Array<CandidApiClient::Commons::Types::ProcedureModifier>)
87
+ # @param request_options [CandidApiClient::RequestOptions]
88
+ # @return [CandidApiClient::Encounters::V4::Types::Encounter]
89
+ # @example
90
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
91
+ # 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" }, description: "string", modifiers: [TWENTY_TWO] })
92
+ def create(request:, request_options: nil)
93
+ Async do
94
+ response = @request_client.conn.post do |req|
95
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
96
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
97
+ req.headers = {
98
+ **(req.headers || {}),
99
+ **@request_client.get_headers,
100
+ **(request_options&.additional_headers || {})
101
+ }.compact
102
+ req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
103
+ req.url "#{@request_client.get_url(environment: CandidApi,
104
+ request_options: request_options)}/api/medication-dispense/v1"
105
+ end
106
+ CandidApiClient::Encounters::V4::Types::Encounter.from_json(json_object: response.body)
107
+ end
108
+ end
109
+ end
110
+ end
111
+ end
112
+ end
@@ -0,0 +1,142 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../commons/types/service_line_units"
4
+ require "date"
5
+ require_relative "../../../service_lines/v_2/types/drug_identification"
6
+ require_relative "../../../commons/types/procedure_modifier"
7
+ require "ostruct"
8
+ require "json"
9
+
10
+ module CandidApiClient
11
+ module MedicationDispense
12
+ module V1
13
+ module Types
14
+ class MedicationDispenseCreate
15
+ # @return [String]
16
+ attr_reader :medication_dispense_external_id
17
+ # @return [String]
18
+ attr_reader :patient_external_id
19
+ # @return [String]
20
+ attr_reader :procedure_code
21
+ # @return [String]
22
+ attr_reader :quantity
23
+ # @return [CandidApiClient::Commons::Types::ServiceLineUnits]
24
+ attr_reader :units
25
+ # @return [Date]
26
+ attr_reader :date_of_service
27
+ # @return [CandidApiClient::ServiceLines::V2::Types::DrugIdentification]
28
+ attr_reader :drug_identification
29
+ # @return [String]
30
+ attr_reader :description
31
+ # @return [Array<CandidApiClient::Commons::Types::ProcedureModifier>]
32
+ attr_reader :modifiers
33
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
34
+ attr_reader :additional_properties
35
+ # @return [Object]
36
+ attr_reader :_field_set
37
+ protected :_field_set
38
+
39
+ OMIT = Object.new
40
+
41
+ # @param medication_dispense_external_id [String]
42
+ # @param patient_external_id [String]
43
+ # @param procedure_code [String]
44
+ # @param quantity [String]
45
+ # @param units [CandidApiClient::Commons::Types::ServiceLineUnits]
46
+ # @param date_of_service [Date]
47
+ # @param drug_identification [CandidApiClient::ServiceLines::V2::Types::DrugIdentification]
48
+ # @param description [String]
49
+ # @param modifiers [Array<CandidApiClient::Commons::Types::ProcedureModifier>]
50
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
51
+ # @return [CandidApiClient::MedicationDispense::V1::Types::MedicationDispenseCreate]
52
+ def initialize(medication_dispense_external_id:, patient_external_id:, procedure_code:, quantity:, units:,
53
+ date_of_service:, drug_identification: OMIT, description: OMIT, modifiers: OMIT, additional_properties: nil)
54
+ @medication_dispense_external_id = medication_dispense_external_id
55
+ @patient_external_id = patient_external_id
56
+ @procedure_code = procedure_code
57
+ @quantity = quantity
58
+ @units = units
59
+ @date_of_service = date_of_service
60
+ @drug_identification = drug_identification if drug_identification != OMIT
61
+ @description = description if description != OMIT
62
+ @modifiers = modifiers if modifiers != OMIT
63
+ @additional_properties = additional_properties
64
+ @_field_set = {
65
+ "medication_dispense_external_id": medication_dispense_external_id,
66
+ "patient_external_id": patient_external_id,
67
+ "procedure_code": procedure_code,
68
+ "quantity": quantity,
69
+ "units": units,
70
+ "date_of_service": date_of_service,
71
+ "drug_identification": drug_identification,
72
+ "description": description,
73
+ "modifiers": modifiers
74
+ }.reject do |_k, v|
75
+ v == OMIT
76
+ end
77
+ end
78
+
79
+ # Deserialize a JSON object to an instance of MedicationDispenseCreate
80
+ #
81
+ # @param json_object [String]
82
+ # @return [CandidApiClient::MedicationDispense::V1::Types::MedicationDispenseCreate]
83
+ def self.from_json(json_object:)
84
+ struct = JSON.parse(json_object, object_class: OpenStruct)
85
+ parsed_json = JSON.parse(json_object)
86
+ medication_dispense_external_id = struct["medication_dispense_external_id"]
87
+ patient_external_id = struct["patient_external_id"]
88
+ procedure_code = struct["procedure_code"]
89
+ quantity = struct["quantity"]
90
+ units = struct["units"]
91
+ date_of_service = (Date.parse(parsed_json["date_of_service"]) unless parsed_json["date_of_service"].nil?)
92
+ if parsed_json["drug_identification"].nil?
93
+ drug_identification = nil
94
+ else
95
+ drug_identification = parsed_json["drug_identification"].to_json
96
+ drug_identification = CandidApiClient::ServiceLines::V2::Types::DrugIdentification.from_json(json_object: drug_identification)
97
+ end
98
+ description = struct["description"]
99
+ modifiers = struct["modifiers"]
100
+ new(
101
+ medication_dispense_external_id: medication_dispense_external_id,
102
+ patient_external_id: patient_external_id,
103
+ procedure_code: procedure_code,
104
+ quantity: quantity,
105
+ units: units,
106
+ date_of_service: date_of_service,
107
+ drug_identification: drug_identification,
108
+ description: description,
109
+ modifiers: modifiers,
110
+ additional_properties: struct
111
+ )
112
+ end
113
+
114
+ # Serialize an instance of MedicationDispenseCreate to a JSON object
115
+ #
116
+ # @return [String]
117
+ def to_json(*_args)
118
+ @_field_set&.to_json
119
+ end
120
+
121
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
122
+ # hash and check each fields type against the current object's property
123
+ # definitions.
124
+ #
125
+ # @param obj [Object]
126
+ # @return [Void]
127
+ def self.validate_raw(obj:)
128
+ obj.medication_dispense_external_id.is_a?(String) != false || raise("Passed value for field obj.medication_dispense_external_id is not the expected type, validation failed.")
129
+ obj.patient_external_id.is_a?(String) != false || raise("Passed value for field obj.patient_external_id is not the expected type, validation failed.")
130
+ obj.procedure_code.is_a?(String) != false || raise("Passed value for field obj.procedure_code is not the expected type, validation failed.")
131
+ obj.quantity.is_a?(String) != false || raise("Passed value for field obj.quantity is not the expected type, validation failed.")
132
+ obj.units.is_a?(CandidApiClient::Commons::Types::ServiceLineUnits) != false || raise("Passed value for field obj.units is not the expected type, validation failed.")
133
+ obj.date_of_service.is_a?(Date) != false || raise("Passed value for field obj.date_of_service is not the expected type, validation failed.")
134
+ obj.drug_identification.nil? || CandidApiClient::ServiceLines::V2::Types::DrugIdentification.validate_raw(obj: obj.drug_identification)
135
+ obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
136
+ obj.modifiers&.is_a?(Array) != false || raise("Passed value for field obj.modifiers is not the expected type, validation failed.")
137
+ end
138
+ end
139
+ end
140
+ end
141
+ end
142
+ end
@@ -108,7 +108,7 @@ module CandidApiClient
108
108
  # @return [CandidApiClient::NonInsurancePayerPayments::V1::Types::NonInsurancePayerPayment]
109
109
  # @example
110
110
  # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
111
- # api.non_insurance_payer_payments.v_1.create(request: { non_insurance_payer_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", amount_cents: 1, payment_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z), payment_note: "string", check_number: "string", allocations: [{ }], invoice_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32" })
111
+ # api.non_insurance_payer_payments.v_1.create(request: { non_insurance_payer_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", amount_cents: 1, payment_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z), payment_note: "string", check_number: "string", allocations: [{ amount_cents: 1 }], invoice_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32" })
112
112
  def create(request:, request_options: nil)
113
113
  response = @request_client.conn.post do |req|
114
114
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -278,7 +278,7 @@ module CandidApiClient
278
278
  # @return [CandidApiClient::NonInsurancePayerPayments::V1::Types::NonInsurancePayerPayment]
279
279
  # @example
280
280
  # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
281
- # api.non_insurance_payer_payments.v_1.create(request: { non_insurance_payer_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", amount_cents: 1, payment_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z), payment_note: "string", check_number: "string", allocations: [{ }], invoice_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32" })
281
+ # api.non_insurance_payer_payments.v_1.create(request: { non_insurance_payer_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", amount_cents: 1, payment_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z), payment_note: "string", check_number: "string", allocations: [{ amount_cents: 1 }], invoice_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32" })
282
282
  def create(request:, request_options: nil)
283
283
  Async do
284
284
  response = @request_client.conn.post do |req|
@@ -115,7 +115,7 @@ module CandidApiClient
115
115
  # @return [CandidApiClient::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefund]
116
116
  # @example
117
117
  # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
118
- # api.non_insurance_payer_refunds.v_1.create(request: { non_insurance_payer_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", invoice_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", amount_cents: 1, refund_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z), refund_note: "string", allocations: [{ }], refund_reason: OVERCHARGED })
118
+ # api.non_insurance_payer_refunds.v_1.create(request: { non_insurance_payer_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", invoice_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", amount_cents: 1, refund_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z), refund_note: "string", allocations: [{ amount_cents: 1 }], refund_reason: OVERCHARGED })
119
119
  def create(request:, request_options: nil)
120
120
  response = @request_client.conn.post do |req|
121
121
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -297,7 +297,7 @@ module CandidApiClient
297
297
  # @return [CandidApiClient::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefund]
298
298
  # @example
299
299
  # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
300
- # api.non_insurance_payer_refunds.v_1.create(request: { non_insurance_payer_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", invoice_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", amount_cents: 1, refund_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z), refund_note: "string", allocations: [{ }], refund_reason: OVERCHARGED })
300
+ # api.non_insurance_payer_refunds.v_1.create(request: { non_insurance_payer_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", invoice_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", amount_cents: 1, refund_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z), refund_note: "string", allocations: [{ amount_cents: 1 }], refund_reason: OVERCHARGED })
301
301
  def create(request:, request_options: nil)
302
302
  Async do
303
303
  response = @request_client.conn.post do |req|