candidhealth 0.21.0 → 0.24.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (439) hide show
  1. checksums.yaml +4 -4
  2. data/lib/candidhealth/auth/client.rb +8 -6
  3. data/lib/candidhealth/auth/v_2/client.rb +86 -38
  4. data/lib/candidhealth/auth/v_2/types/auth_get_token_response.rb +61 -43
  5. data/lib/candidhealth/auth/v_2/types/too_many_requests_error_type.rb +44 -33
  6. data/lib/candidhealth/billing_notes/client.rb +8 -6
  7. data/lib/candidhealth/billing_notes/v_2/client.rb +43 -21
  8. data/lib/candidhealth/billing_notes/v_2/types/billing_note.rb +95 -72
  9. data/lib/candidhealth/billing_notes/v_2/types/billing_note_base.rb +44 -33
  10. data/lib/candidhealth/claim_submission/v_1/types/claim_frequency_type_code.rb +6 -4
  11. data/lib/candidhealth/claim_submission/v_1/types/claim_submission_record_create.rb +80 -59
  12. data/lib/candidhealth/claim_submission/v_1/types/external_claim_submission_create.rb +78 -56
  13. data/lib/candidhealth/claims/types/claim.rb +114 -86
  14. data/lib/candidhealth/claims/types/claim_status.rb +19 -17
  15. data/lib/candidhealth/commons/types/claim_adjustment_group_codes.rb +14 -12
  16. data/lib/candidhealth/commons/types/claim_submission_payer_responsibility_type.rb +6 -4
  17. data/lib/candidhealth/commons/types/date_range_optional_end.rb +57 -40
  18. data/lib/candidhealth/commons/types/delay_reason_code.rb +19 -17
  19. data/lib/candidhealth/commons/types/emr_payer_crosswalk.rb +6 -4
  20. data/lib/candidhealth/commons/types/entity_conflict_error_message.rb +45 -34
  21. data/lib/candidhealth/commons/types/entity_not_found_error_message.rb +45 -34
  22. data/lib/candidhealth/commons/types/facility_type_code.rb +58 -55
  23. data/lib/candidhealth/commons/types/http_service_unavailable_error_message.rb +47 -34
  24. data/lib/candidhealth/commons/types/insurance_type_code.rb +76 -73
  25. data/lib/candidhealth/commons/types/intended_submission_medium.rb +9 -5
  26. data/lib/candidhealth/commons/types/network_type.rb +23 -21
  27. data/lib/candidhealth/commons/types/organization_not_authorized_error_message.rb +46 -34
  28. data/lib/candidhealth/commons/types/patient_relationship_to_insured_code_all.rb +28 -26
  29. data/lib/candidhealth/commons/types/phone_number.rb +55 -39
  30. data/lib/candidhealth/commons/types/phone_number_type.rb +7 -5
  31. data/lib/candidhealth/commons/types/procedure_modifier.rb +391 -389
  32. data/lib/candidhealth/commons/types/qualifier_code.rb +14 -0
  33. data/lib/candidhealth/commons/types/region_national.rb +39 -29
  34. data/lib/candidhealth/commons/types/region_states.rb +45 -34
  35. data/lib/candidhealth/commons/types/regions.rb +78 -72
  36. data/lib/candidhealth/commons/types/removable_date_range_optional_end.rb +77 -71
  37. data/lib/candidhealth/commons/types/request_validation_error.rb +57 -39
  38. data/lib/candidhealth/commons/types/resource_page.rb +57 -40
  39. data/lib/candidhealth/commons/types/service_line_units.rb +6 -4
  40. data/lib/candidhealth/commons/types/sort_direction.rb +6 -4
  41. data/lib/candidhealth/commons/types/source_of_payment_code.rb +28 -26
  42. data/lib/candidhealth/commons/types/state.rb +66 -64
  43. data/lib/candidhealth/commons/types/street_address_base.rb +84 -61
  44. data/lib/candidhealth/commons/types/street_address_long_zip.rb +93 -68
  45. data/lib/candidhealth/commons/types/street_address_short_zip.rb +93 -68
  46. data/lib/candidhealth/commons/types/unauthorized_error_message.rb +47 -34
  47. data/lib/candidhealth/commons/types/unprocessable_entity_error_message.rb +47 -34
  48. data/lib/candidhealth/commons/types/updates_disabled_due_to_external_system_integration_error_message.rb +49 -34
  49. data/lib/candidhealth/contracts/client.rb +8 -6
  50. data/lib/candidhealth/contracts/v_2/client.rb +251 -127
  51. data/lib/candidhealth/contracts/v_2/types/authorized_signatory.rb +92 -67
  52. data/lib/candidhealth/contracts/v_2/types/authorized_signatory_update.rb +76 -70
  53. data/lib/candidhealth/contracts/v_2/types/contract.rb +178 -141
  54. data/lib/candidhealth/contracts/v_2/types/contract_base.rb +134 -106
  55. data/lib/candidhealth/contracts/v_2/types/contract_is_linked_to_fee_schedule_error.rb +44 -33
  56. data/lib/candidhealth/contracts/v_2/types/contract_status.rb +6 -4
  57. data/lib/candidhealth/contracts/v_2/types/contract_with_providers.rb +191 -152
  58. data/lib/candidhealth/contracts/v_2/types/contracts_page.rb +70 -47
  59. data/lib/candidhealth/contracts/v_2/types/date_update.rb +76 -71
  60. data/lib/candidhealth/contracts/v_2/types/insurance_types.rb +86 -80
  61. data/lib/candidhealth/contracts/v_2/types/regions_update.rb +76 -70
  62. data/lib/candidhealth/diagnoses/types/diagnosis.rb +126 -91
  63. data/lib/candidhealth/diagnoses/types/diagnosis_create.rb +88 -58
  64. data/lib/candidhealth/diagnoses/types/diagnosis_type_code.rb +14 -12
  65. data/lib/candidhealth/diagnoses/types/standalone_diagnosis_create.rb +100 -64
  66. data/lib/candidhealth/eligibility/client.rb +8 -6
  67. data/lib/candidhealth/eligibility/v_2/client.rb +210 -124
  68. data/lib/candidhealth/encounter_providers/v_2/types/billing_provider.rb +126 -86
  69. data/lib/candidhealth/encounter_providers/v_2/types/encounter_provider.rb +128 -85
  70. data/lib/candidhealth/encounter_providers/v_2/types/encounter_provider_base.rb +73 -44
  71. data/lib/candidhealth/encounter_providers/v_2/types/initial_referring_provider.rb +132 -0
  72. data/lib/candidhealth/encounter_providers/v_2/types/ordering_provider.rb +123 -0
  73. data/lib/candidhealth/encounter_providers/v_2/types/referring_provider.rb +105 -73
  74. data/lib/candidhealth/encounter_providers/v_2/types/rendering_provider.rb +105 -73
  75. data/lib/candidhealth/encounter_providers/v_2/types/supervising_provider.rb +123 -0
  76. data/lib/candidhealth/encounters/client.rb +8 -6
  77. data/lib/candidhealth/encounters/v_4/client.rb +1021 -476
  78. data/lib/candidhealth/encounters/v_4/types/billable_status_type.rb +5 -3
  79. data/lib/candidhealth/encounters/v_4/types/cash_pay_payer_error_message.rb +44 -33
  80. data/lib/candidhealth/encounters/v_4/types/clinical_note.rb +76 -50
  81. data/lib/candidhealth/encounters/v_4/types/clinical_note_category.rb +70 -45
  82. data/lib/candidhealth/encounters/v_4/types/clinical_note_category_create.rb +57 -40
  83. data/lib/candidhealth/encounters/v_4/types/coding_attribution_type.rb +7 -5
  84. data/lib/candidhealth/encounters/v_4/types/encounter.rb +719 -482
  85. data/lib/candidhealth/encounters/v_4/types/encounter_base.rb +304 -223
  86. data/lib/candidhealth/encounters/v_4/types/encounter_external_id_uniqueness_error_type.rb +47 -34
  87. data/lib/candidhealth/encounters/v_4/types/encounter_guarantor_missing_contact_info_error_type.rb +46 -33
  88. data/lib/candidhealth/encounters/v_4/types/encounter_owner_of_next_action_type.rb +7 -5
  89. data/lib/candidhealth/encounters/v_4/types/encounter_page.rb +70 -47
  90. data/lib/candidhealth/encounters/v_4/types/encounter_patient_control_number_uniqueness_error_type.rb +46 -33
  91. data/lib/candidhealth/encounters/v_4/types/encounter_sort_options.rb +7 -5
  92. data/lib/candidhealth/encounters/v_4/types/encounter_submission_origin_type.rb +5 -3
  93. data/lib/candidhealth/encounters/v_4/types/intake_follow_up.rb +63 -44
  94. data/lib/candidhealth/encounters/v_4/types/intake_question.rb +66 -46
  95. data/lib/candidhealth/encounters/v_4/types/intake_response_and_follow_ups.rb +59 -40
  96. data/lib/candidhealth/encounters/v_4/types/intervention.rb +92 -66
  97. data/lib/candidhealth/encounters/v_4/types/intervention_category.rb +7 -5
  98. data/lib/candidhealth/encounters/v_4/types/lab.rb +63 -43
  99. data/lib/candidhealth/encounters/v_4/types/lab_code_type.rb +5 -3
  100. data/lib/candidhealth/encounters/v_4/types/medication.rb +92 -68
  101. data/lib/candidhealth/encounters/v_4/types/note_category.rb +17 -15
  102. data/lib/candidhealth/encounters/v_4/types/patient_history_category.rb +57 -40
  103. data/lib/candidhealth/encounters/v_4/types/patient_history_category_enum.rb +7 -5
  104. data/lib/candidhealth/encounters/v_4/types/responsible_party_type.rb +6 -4
  105. data/lib/candidhealth/encounters/v_4/types/service_authorization_exception_code.rb +14 -10
  106. data/lib/candidhealth/encounters/v_4/types/synchronicity_type.rb +5 -3
  107. data/lib/candidhealth/encounters/v_4/types/vitals.rb +84 -62
  108. data/lib/candidhealth/era/types/era.rb +62 -46
  109. data/lib/candidhealth/era/types/era_base.rb +55 -40
  110. data/lib/candidhealth/era/types/era_not_fully_processed_error_message.rb +55 -40
  111. data/lib/candidhealth/era_commons/types/claim_status_code_create.rb +14 -12
  112. data/lib/candidhealth/expected_network_status/client.rb +16 -10
  113. data/lib/candidhealth/expected_network_status/v_1/client.rb +76 -29
  114. data/lib/candidhealth/expected_network_status/v_1/types/expected_network_status.rb +6 -4
  115. data/lib/candidhealth/expected_network_status/v_1/types/expected_network_status_response.rb +69 -49
  116. data/lib/candidhealth/expected_network_status/v_2/client.rb +108 -69
  117. data/lib/candidhealth/expected_network_status/v_2/types/compute_all_in_network_providers_request.rb +129 -96
  118. data/lib/candidhealth/expected_network_status/v_2/types/compute_all_in_network_providers_response.rb +62 -47
  119. data/lib/candidhealth/expected_network_status/v_2/types/compute_all_in_network_rendering_providers_result.rb +89 -82
  120. data/lib/candidhealth/expected_network_status/v_2/types/expected_network_status_check_error_message.rb +45 -33
  121. data/lib/candidhealth/expected_network_status/v_2/types/expected_network_status_request_v_2.rb +129 -96
  122. data/lib/candidhealth/expected_network_status/v_2/types/expected_network_status_response_v_2.rb +59 -44
  123. data/lib/candidhealth/expected_network_status/v_2/types/expected_network_status_subscriber_information.rb +68 -49
  124. data/lib/candidhealth/expected_network_status/v_2/types/expected_network_status_v_2.rb +88 -82
  125. data/lib/candidhealth/expected_network_status/v_2/types/explanation.rb +11 -9
  126. data/lib/candidhealth/expected_network_status/v_2/types/in_network_rendering_providers_detail.rb +66 -51
  127. data/lib/candidhealth/expected_network_status/v_2/types/in_network_status.rb +57 -41
  128. data/lib/candidhealth/expected_network_status/v_2/types/indeterminate_network_status.rb +76 -57
  129. data/lib/candidhealth/expected_network_status/v_2/types/insurance_type.rb +59 -43
  130. data/lib/candidhealth/expected_network_status/v_2/types/insurance_type_codes.rb +86 -80
  131. data/lib/candidhealth/expected_network_status/v_2/types/line_of_business.rb +6 -4
  132. data/lib/candidhealth/expected_network_status/v_2/types/out_of_network_status.rb +65 -50
  133. data/lib/candidhealth/expected_network_status/v_2/types/service_type.rb +44 -42
  134. data/lib/candidhealth/exports/client.rb +8 -6
  135. data/lib/candidhealth/exports/v_3/client.rb +88 -48
  136. data/lib/candidhealth/exports/v_3/types/get_exports_response.rb +79 -58
  137. data/lib/candidhealth/external_payment_account_config/client.rb +30 -0
  138. data/lib/candidhealth/external_payment_account_config/v_1/client.rb +89 -0
  139. data/lib/candidhealth/external_payment_account_config/v_1/types/external_payment_account_config.rb +70 -0
  140. data/lib/candidhealth/external_payment_account_config/v_1/types/external_payment_account_config_page.rb +88 -0
  141. data/lib/candidhealth/fee_schedules/client.rb +8 -6
  142. data/lib/candidhealth/fee_schedules/v_3/client.rb +429 -181
  143. data/lib/candidhealth/fee_schedules/v_3/types/dimension_match.rb +159 -130
  144. data/lib/candidhealth/fee_schedules/v_3/types/dimension_name.rb +7 -5
  145. data/lib/candidhealth/fee_schedules/v_3/types/dimensions.rb +146 -117
  146. data/lib/candidhealth/fee_schedules/v_3/types/dimensions_page.rb +70 -51
  147. data/lib/candidhealth/fee_schedules/v_3/types/match_cpt_code.rb +62 -44
  148. data/lib/candidhealth/fee_schedules/v_3/types/match_date.rb +65 -44
  149. data/lib/candidhealth/fee_schedules/v_3/types/match_facility_type_code.rb +64 -44
  150. data/lib/candidhealth/fee_schedules/v_3/types/match_geo.rb +76 -49
  151. data/lib/candidhealth/fee_schedules/v_3/types/match_license_type.rb +64 -44
  152. data/lib/candidhealth/fee_schedules/v_3/types/match_modifiers.rb +67 -48
  153. data/lib/candidhealth/fee_schedules/v_3/types/match_network_types.rb +67 -48
  154. data/lib/candidhealth/fee_schedules/v_3/types/match_payer.rb +62 -45
  155. data/lib/candidhealth/fee_schedules/v_3/types/match_provider.rb +64 -45
  156. data/lib/candidhealth/fee_schedules/v_3/types/match_result.rb +59 -43
  157. data/lib/candidhealth/fee_schedules/v_3/types/match_test_result.rb +63 -46
  158. data/lib/candidhealth/fee_schedules/v_3/types/new_rate.rb +61 -44
  159. data/lib/candidhealth/fee_schedules/v_3/types/new_rate_version.rb +70 -46
  160. data/lib/candidhealth/fee_schedules/v_3/types/optional_dimensions.rb +148 -117
  161. data/lib/candidhealth/fee_schedules/v_3/types/overlapping_rate_entries_error.rb +71 -52
  162. data/lib/candidhealth/fee_schedules/v_3/types/payer_threshold.rb +77 -50
  163. data/lib/candidhealth/fee_schedules/v_3/types/payer_thresholds_page.rb +70 -51
  164. data/lib/candidhealth/fee_schedules/v_3/types/rate.rb +100 -75
  165. data/lib/candidhealth/fee_schedules/v_3/types/rate_entry.rb +79 -55
  166. data/lib/candidhealth/fee_schedules/v_3/types/rate_upload.rb +77 -71
  167. data/lib/candidhealth/fee_schedules/v_3/types/rate_upload_with_possible_errors.rb +79 -55
  168. data/lib/candidhealth/fee_schedules/v_3/types/rates_page.rb +70 -47
  169. data/lib/candidhealth/fee_schedules/v_3/types/threshold_match.rb +79 -54
  170. data/lib/candidhealth/fee_schedules/v_3/types/validation_error.rb +108 -102
  171. data/lib/candidhealth/financials/types/account_type.rb +6 -4
  172. data/lib/candidhealth/financials/types/allocation.rb +60 -43
  173. data/lib/candidhealth/financials/types/allocation_create.rb +63 -45
  174. data/lib/candidhealth/financials/types/allocation_target.rb +102 -95
  175. data/lib/candidhealth/financials/types/allocation_target_create.rb +113 -110
  176. data/lib/candidhealth/financials/types/billing_provider_allocation_target.rb +45 -35
  177. data/lib/candidhealth/financials/types/claim_allocation_target.rb +55 -41
  178. data/lib/candidhealth/financials/types/invoice_update.rb +77 -72
  179. data/lib/candidhealth/financials/types/note_update.rb +77 -71
  180. data/lib/candidhealth/financials/types/patient_transaction_source.rb +11 -9
  181. data/lib/candidhealth/financials/types/refund_reason.rb +5 -3
  182. data/lib/candidhealth/financials/types/refund_reason_update.rb +77 -71
  183. data/lib/candidhealth/financials/types/service_line_allocation_target.rb +62 -48
  184. data/lib/candidhealth/guarantor/client.rb +8 -6
  185. data/lib/candidhealth/guarantor/v_1/client.rb +136 -63
  186. data/lib/candidhealth/guarantor/v_1/types/encounter_has_existing_guarantor_error_type.rb +45 -33
  187. data/lib/candidhealth/guarantor/v_1/types/guarantor.rb +131 -100
  188. data/lib/candidhealth/guarantor/v_1/types/guarantor_base.rb +89 -65
  189. data/lib/candidhealth/guarantor/v_1/types/guarantor_create.rb +123 -93
  190. data/lib/candidhealth/identifiers/types/identifier.rb +85 -64
  191. data/lib/candidhealth/identifiers/types/identifier_base.rb +77 -53
  192. data/lib/candidhealth/identifiers/types/identifier_code.rb +6 -4
  193. data/lib/candidhealth/identifiers/types/identifier_create.rb +77 -53
  194. data/lib/candidhealth/identifiers/types/identifier_update.rb +86 -65
  195. data/lib/candidhealth/identifiers/types/identifier_value.rb +78 -72
  196. data/lib/candidhealth/identifiers/types/medicaid_provider_identifier.rb +55 -39
  197. data/lib/candidhealth/identifiers/types/medicare_provider_identifier.rb +55 -39
  198. data/lib/candidhealth/identifiers/types/updatable_identifier.rb +89 -84
  199. data/lib/candidhealth/import_invoice/client.rb +8 -6
  200. data/lib/candidhealth/import_invoice/v_1/client.rb +182 -86
  201. data/lib/candidhealth/import_invoice/v_1/types/create_import_invoice_request.rb +123 -83
  202. data/lib/candidhealth/import_invoice/v_1/types/import_invoice.rb +145 -110
  203. data/lib/candidhealth/import_invoice/v_1/types/import_invoice_update_request.rb +89 -65
  204. data/lib/candidhealth/import_invoice/v_1/types/import_invoices_page.rb +70 -47
  205. data/lib/candidhealth/import_invoice/v_1/types/invoice_item_info_update.rb +61 -42
  206. data/lib/candidhealth/import_invoice/v_1/types/invoice_item_update_type.rb +5 -3
  207. data/lib/candidhealth/individual/types/gender.rb +9 -7
  208. data/lib/candidhealth/individual/types/individual_base.rb +62 -44
  209. data/lib/candidhealth/individual/types/patient.rb +145 -108
  210. data/lib/candidhealth/individual/types/patient_base.rb +101 -73
  211. data/lib/candidhealth/individual/types/patient_create.rb +137 -101
  212. data/lib/candidhealth/individual/types/subscriber.rb +119 -91
  213. data/lib/candidhealth/individual/types/subscriber_base.rb +99 -74
  214. data/lib/candidhealth/individual/types/subscriber_create.rb +111 -84
  215. data/lib/candidhealth/insurance_adjudications/client.rb +8 -6
  216. data/lib/candidhealth/insurance_adjudications/v_1/client.rb +106 -47
  217. data/lib/candidhealth/insurance_adjudications/v_1/types/claim_adjudication.rb +106 -81
  218. data/lib/candidhealth/insurance_adjudications/v_1/types/claim_adjudication_create.rb +98 -74
  219. data/lib/candidhealth/insurance_adjudications/v_1/types/insurance_adjudication.rb +104 -80
  220. data/lib/candidhealth/insurance_adjudications/v_1/types/insurance_adjudication_create.rb +113 -87
  221. data/lib/candidhealth/insurance_adjudications/v_1/types/service_line_adjudication.rb +121 -91
  222. data/lib/candidhealth/insurance_adjudications/v_1/types/service_line_adjudication_create.rb +113 -84
  223. data/lib/candidhealth/insurance_cards/v_2/types/insurance_card.rb +140 -105
  224. data/lib/candidhealth/insurance_cards/v_2/types/insurance_card_base.rb +76 -55
  225. data/lib/candidhealth/insurance_cards/v_2/types/insurance_card_create.rb +140 -104
  226. data/lib/candidhealth/insurance_payments/client.rb +8 -6
  227. data/lib/candidhealth/insurance_payments/v_1/client.rb +214 -102
  228. data/lib/candidhealth/insurance_payments/v_1/types/insurance_payment.rb +101 -77
  229. data/lib/candidhealth/insurance_payments/v_1/types/insurance_payment_create.rb +93 -70
  230. data/lib/candidhealth/insurance_payments/v_1/types/insurance_payment_sort_field.rb +6 -4
  231. data/lib/candidhealth/insurance_payments/v_1/types/insurance_payments_page.rb +70 -47
  232. data/lib/candidhealth/insurance_refunds/client.rb +8 -6
  233. data/lib/candidhealth/insurance_refunds/v_1/client.rb +218 -108
  234. data/lib/candidhealth/insurance_refunds/v_1/types/insurance_refund.rb +109 -83
  235. data/lib/candidhealth/insurance_refunds/v_1/types/insurance_refund_create.rb +101 -76
  236. data/lib/candidhealth/insurance_refunds/v_1/types/insurance_refund_sort_field.rb +7 -5
  237. data/lib/candidhealth/insurance_refunds/v_1/types/insurance_refunds_page.rb +70 -47
  238. data/lib/candidhealth/invoices/types/invoice.rb +152 -117
  239. data/lib/candidhealth/invoices/types/invoice_item.rb +55 -40
  240. data/lib/candidhealth/invoices/types/invoice_status.rb +10 -8
  241. data/lib/candidhealth/invoices/v_2/types/claim_invoice_item.rb +54 -39
  242. data/lib/candidhealth/invoices/v_2/types/claim_invoice_item_info.rb +66 -48
  243. data/lib/candidhealth/invoices/v_2/types/invoice.rb +151 -114
  244. data/lib/candidhealth/invoices/v_2/types/invoice_destination.rb +8 -5
  245. data/lib/candidhealth/invoices/v_2/types/invoice_destination_metadata.rb +78 -55
  246. data/lib/candidhealth/invoices/v_2/types/invoice_info.rb +66 -48
  247. data/lib/candidhealth/invoices/v_2/types/invoice_item_attribution_create.rb +88 -84
  248. data/lib/candidhealth/invoices/v_2/types/invoice_item_create.rb +59 -42
  249. data/lib/candidhealth/invoices/v_2/types/invoice_item_info.rb +59 -43
  250. data/lib/candidhealth/invoices/v_2/types/invoice_sort_field.rb +9 -7
  251. data/lib/candidhealth/invoices/v_2/types/invoice_status.rb +9 -7
  252. data/lib/candidhealth/invoices/v_2/types/service_line_invoice_item.rb +54 -39
  253. data/lib/candidhealth/invoices/v_2/types/unattributed_invoice_item.rb +44 -33
  254. data/lib/candidhealth/organization_providers/client.rb +8 -6
  255. data/lib/candidhealth/organization_providers/v_2/types/address_type.rb +4 -2
  256. data/lib/candidhealth/organization_providers/v_2/types/employment_status.rb +5 -3
  257. data/lib/candidhealth/organization_providers/v_2/types/license_type.rb +71 -69
  258. data/lib/candidhealth/organization_providers/v_2/types/organization_provider.rb +189 -138
  259. data/lib/candidhealth/organization_providers/v_2/types/organization_provider_address.rb +59 -42
  260. data/lib/candidhealth/organization_providers/v_2/types/organization_provider_base.rb +157 -112
  261. data/lib/candidhealth/organization_providers/v_2/types/organization_provider_sort_options.rb +7 -5
  262. data/lib/candidhealth/organization_providers/v_2/types/provider_type.rb +5 -3
  263. data/lib/candidhealth/organization_providers/v_3/client.rb +166 -80
  264. data/lib/candidhealth/organization_providers/v_3/types/organization_provider_create_v_2.rb +171 -124
  265. data/lib/candidhealth/organization_providers/v_3/types/organization_provider_page_v_2.rb +70 -47
  266. data/lib/candidhealth/organization_providers/v_3/types/organization_provider_update_v_2.rb +169 -121
  267. data/lib/candidhealth/organization_providers/v_3/types/organization_provider_v_2.rb +179 -131
  268. data/lib/candidhealth/organization_service_facilities/client.rb +8 -6
  269. data/lib/candidhealth/organization_service_facilities/v_2/client.rb +186 -90
  270. data/lib/candidhealth/organization_service_facilities/v_2/types/organization_service_facility.rb +149 -111
  271. data/lib/candidhealth/organization_service_facilities/v_2/types/organization_service_facility_create.rb +141 -104
  272. data/lib/candidhealth/organization_service_facilities/v_2/types/organization_service_facility_page.rb +70 -47
  273. data/lib/candidhealth/organization_service_facilities/v_2/types/organization_service_facility_update.rb +141 -104
  274. data/lib/candidhealth/organization_service_facilities/v_2/types/service_facility_mode.rb +5 -3
  275. data/lib/candidhealth/organization_service_facilities/v_2/types/service_facility_operational_status.rb +9 -7
  276. data/lib/candidhealth/organization_service_facilities/v_2/types/service_facility_physical_type.rb +17 -15
  277. data/lib/candidhealth/organization_service_facilities/v_2/types/service_facility_status.rb +6 -4
  278. data/lib/candidhealth/organization_service_facilities/v_2/types/service_facility_type.rb +126 -124
  279. data/lib/candidhealth/patient_payments/client.rb +8 -6
  280. data/lib/candidhealth/patient_payments/v_3/types/patient_payment.rb +143 -111
  281. data/lib/candidhealth/patient_payments/v_3/types/patient_payment_source.rb +12 -10
  282. data/lib/candidhealth/patient_payments/v_3/types/patient_payment_status.rb +14 -12
  283. data/lib/candidhealth/patient_payments/v_4/client.rb +230 -103
  284. data/lib/candidhealth/patient_payments/v_4/types/patient_payment.rb +129 -100
  285. data/lib/candidhealth/patient_payments/v_4/types/patient_payment_sort_field.rb +7 -5
  286. data/lib/candidhealth/patient_payments/v_4/types/patient_payments_page.rb +70 -47
  287. data/lib/candidhealth/patient_refunds/client.rb +8 -6
  288. data/lib/candidhealth/patient_refunds/v_1/client.rb +236 -107
  289. data/lib/candidhealth/patient_refunds/v_1/types/patient_refund.rb +137 -106
  290. data/lib/candidhealth/patient_refunds/v_1/types/patient_refund_sort_field.rb +8 -6
  291. data/lib/candidhealth/patient_refunds/v_1/types/patient_refunds_page.rb +70 -47
  292. data/lib/candidhealth/payers/client.rb +8 -6
  293. data/lib/candidhealth/payers/v_3/client.rb +73 -32
  294. data/lib/candidhealth/payers/v_3/types/payer.rb +61 -44
  295. data/lib/candidhealth/payers/v_3/types/payer_identifier.rb +77 -72
  296. data/lib/candidhealth/payers/v_3/types/payer_info.rb +54 -40
  297. data/lib/candidhealth/payers/v_3/types/payer_page.rb +70 -47
  298. data/lib/candidhealth/pre_encounter/client.rb +30 -0
  299. data/lib/candidhealth/pre_encounter/common/types/address.rb +123 -0
  300. data/lib/candidhealth/pre_encounter/common/types/address_use.rb +17 -0
  301. data/lib/candidhealth/pre_encounter/common/types/contact_point.rb +87 -0
  302. data/lib/candidhealth/pre_encounter/common/types/contact_point_use.rb +17 -0
  303. data/lib/candidhealth/pre_encounter/common/types/error_base.rb +60 -0
  304. data/lib/candidhealth/pre_encounter/common/types/gender.rb +16 -0
  305. data/lib/candidhealth/pre_encounter/common/types/human_name.rb +94 -0
  306. data/lib/candidhealth/pre_encounter/common/types/name_use.rb +19 -0
  307. data/lib/candidhealth/pre_encounter/common/types/not_found_error_body.rb +70 -0
  308. data/lib/candidhealth/pre_encounter/common/types/period.rb +74 -0
  309. data/lib/candidhealth/pre_encounter/common/types/relationship.rb +17 -0
  310. data/lib/candidhealth/pre_encounter/common/types/version_conflict_error_body.rb +77 -0
  311. data/lib/candidhealth/pre_encounter/coverages/client.rb +32 -0
  312. data/lib/candidhealth/pre_encounter/coverages/v_1/client.rb +34 -0
  313. data/lib/candidhealth/pre_encounter/coverages/v_1/coverages/client.rb +487 -0
  314. data/lib/candidhealth/pre_encounter/coverages/v_1/coverages/types/coverage.rb +185 -0
  315. data/lib/candidhealth/pre_encounter/coverages/v_1/coverages/types/coverage_status.rb +22 -0
  316. data/lib/candidhealth/pre_encounter/coverages/v_1/coverages/types/coverage_type.rb +18 -0
  317. data/lib/candidhealth/pre_encounter/coverages/v_1/coverages/types/insurance_plan.rb +136 -0
  318. data/lib/candidhealth/pre_encounter/coverages/v_1/coverages/types/mutable_coverage.rb +131 -0
  319. data/lib/candidhealth/pre_encounter/coverages/v_1/coverages/types/subscriber.rb +90 -0
  320. data/lib/candidhealth/pre_encounter/patients/client.rb +32 -0
  321. data/lib/candidhealth/pre_encounter/patients/v_1/client.rb +34 -0
  322. data/lib/candidhealth/pre_encounter/patients/v_1/patients/client.rb +590 -0
  323. data/lib/candidhealth/pre_encounter/patients/v_1/patients/types/contact.rb +135 -0
  324. data/lib/candidhealth/pre_encounter/patients/v_1/patients/types/external_provenance.rb +75 -0
  325. data/lib/candidhealth/pre_encounter/patients/v_1/patients/types/external_provider.rb +116 -0
  326. data/lib/candidhealth/pre_encounter/patients/v_1/patients/types/marital_status.rb +28 -0
  327. data/lib/candidhealth/pre_encounter/patients/v_1/patients/types/mutable_patient.rb +242 -0
  328. data/lib/candidhealth/pre_encounter/patients/v_1/patients/types/patient.rb +294 -0
  329. data/lib/candidhealth/remits/v_1/types/payee.rb +59 -42
  330. data/lib/candidhealth/remits/v_1/types/payee_identifier.rb +84 -80
  331. data/lib/candidhealth/service_facility/client.rb +58 -27
  332. data/lib/candidhealth/service_facility/types/encounter_service_facility.rb +87 -62
  333. data/lib/candidhealth/service_facility/types/encounter_service_facility_base.rb +87 -57
  334. data/lib/candidhealth/service_lines/v_2/types/denial_reason_content.rb +33 -31
  335. data/lib/candidhealth/service_lines/v_2/types/drug_identification.rb +92 -68
  336. data/lib/candidhealth/service_lines/v_2/types/measurement_unit_code.rb +8 -6
  337. data/lib/candidhealth/service_lines/v_2/types/service_id_qualifier.rb +10 -8
  338. data/lib/candidhealth/service_lines/v_2/types/service_line.rb +352 -222
  339. data/lib/candidhealth/service_lines/v_2/types/service_line_adjustment.rb +85 -62
  340. data/lib/candidhealth/service_lines/v_2/types/service_line_create.rb +235 -113
  341. data/lib/candidhealth/service_lines/v_2/types/service_line_denial_reason.rb +49 -35
  342. data/lib/candidhealth/service_lines/v_2/types/service_line_era_data.rb +60 -44
  343. data/lib/candidhealth/tags/types/tag.rb +69 -51
  344. data/lib/candidhealth/tags/types/tag_color_enum.rb +14 -12
  345. data/lib/candidhealth/tags/types/tag_create.rb +62 -45
  346. data/lib/candidhealth/tasks/client.rb +8 -6
  347. data/lib/candidhealth/tasks/commons/types/task_category.rb +45 -43
  348. data/lib/candidhealth/tasks/commons/types/task_status.rb +11 -9
  349. data/lib/candidhealth/tasks/commons/types/task_type.rb +16 -14
  350. data/lib/candidhealth/tasks/v_3/client.rb +208 -96
  351. data/lib/candidhealth/tasks/v_3/types/task.rb +193 -146
  352. data/lib/candidhealth/tasks/v_3/types/task_action.rb +66 -47
  353. data/lib/candidhealth/tasks/v_3/types/task_action_execution_method.rb +65 -59
  354. data/lib/candidhealth/tasks/v_3/types/task_action_type.rb +5 -3
  355. data/lib/candidhealth/tasks/v_3/types/task_actions.rb +47 -35
  356. data/lib/candidhealth/tasks/v_3/types/task_assignment.rb +59 -40
  357. data/lib/candidhealth/tasks/v_3/types/task_create_v_3.rb +100 -77
  358. data/lib/candidhealth/tasks/v_3/types/task_note.rb +83 -62
  359. data/lib/candidhealth/tasks/v_3/types/task_page.rb +70 -47
  360. data/lib/candidhealth/tasks/v_3/types/task_sort_options.rb +25 -23
  361. data/lib/candidhealth/tasks/v_3/types/task_update_v_3.rb +68 -49
  362. data/lib/candidhealth/tasks/v_3/types/task_updated_to_deprecated_status_error_type.rb +47 -33
  363. data/lib/candidhealth/write_offs/client.rb +8 -6
  364. data/lib/candidhealth/write_offs/v_1/client.rb +168 -83
  365. data/lib/candidhealth/write_offs/v_1/types/create_write_offs_response.rb +47 -35
  366. data/lib/candidhealth/write_offs/v_1/types/insurance_write_off.rb +127 -97
  367. data/lib/candidhealth/write_offs/v_1/types/insurance_write_off_create.rb +103 -78
  368. data/lib/candidhealth/write_offs/v_1/types/insurance_write_off_reason.rb +19 -17
  369. data/lib/candidhealth/write_offs/v_1/types/insurance_write_off_target.rb +84 -81
  370. data/lib/candidhealth/write_offs/v_1/types/patient_write_off.rb +111 -84
  371. data/lib/candidhealth/write_offs/v_1/types/patient_write_off_create.rb +87 -65
  372. data/lib/candidhealth/write_offs/v_1/types/patient_write_off_reason.rb +12 -10
  373. data/lib/candidhealth/write_offs/v_1/types/write_off.rb +77 -71
  374. data/lib/candidhealth/write_offs/v_1/types/write_off_create.rb +77 -71
  375. data/lib/candidhealth/write_offs/v_1/types/write_off_sort_field.rb +6 -4
  376. data/lib/candidhealth/write_offs/v_1/types/write_offs_page.rb +70 -47
  377. data/lib/candidhealth/x_12/v_1/types/carc.rb +406 -404
  378. data/lib/candidhealth/x_12/v_1/types/claim_adjustment_reason_code.rb +61 -44
  379. data/lib/candidhealth/x_12/v_1/types/rarc.rb +1063 -1061
  380. data/lib/candidhealth/x_12/v_1/types/remittance_advice_remark_code.rb +44 -33
  381. data/lib/candidhealth.rb +189 -87
  382. data/lib/core/oauth.rb +62 -0
  383. data/lib/environment.rb +8 -2
  384. data/lib/requests.rb +98 -48
  385. data/lib/types_export.rb +30 -53
  386. metadata +42 -55
  387. data/lib/candidhealth/billing_notes/v_2/types/billing_note_id.rb +0 -9
  388. data/lib/candidhealth/commons/types/claim_id.rb +0 -7
  389. data/lib/candidhealth/commons/types/date.rb +0 -7
  390. data/lib/candidhealth/commons/types/decimal.rb +0 -7
  391. data/lib/candidhealth/commons/types/email.rb +0 -7
  392. data/lib/candidhealth/commons/types/encounter_external_id.rb +0 -7
  393. data/lib/candidhealth/commons/types/encounter_id.rb +0 -7
  394. data/lib/candidhealth/commons/types/error_message.rb +0 -7
  395. data/lib/candidhealth/commons/types/invoice_id.rb +0 -7
  396. data/lib/candidhealth/commons/types/link_url.rb +0 -7
  397. data/lib/candidhealth/commons/types/npi.rb +0 -7
  398. data/lib/candidhealth/commons/types/organization_id.rb +0 -7
  399. data/lib/candidhealth/commons/types/page_token.rb +0 -7
  400. data/lib/candidhealth/commons/types/patient_external_id.rb +0 -7
  401. data/lib/candidhealth/commons/types/provider_id.rb +0 -7
  402. data/lib/candidhealth/commons/types/rate_id.rb +0 -7
  403. data/lib/candidhealth/commons/types/service_line_id.rb +0 -7
  404. data/lib/candidhealth/commons/types/task_assignment_id.rb +0 -7
  405. data/lib/candidhealth/commons/types/task_id.rb +0 -7
  406. data/lib/candidhealth/commons/types/task_note_id.rb +0 -7
  407. data/lib/candidhealth/commons/types/tax_id.rb +0 -7
  408. data/lib/candidhealth/commons/types/user_id.rb +0 -7
  409. data/lib/candidhealth/commons/types/work_queue_id.rb +0 -7
  410. data/lib/candidhealth/contracts/v_2/types/contract_id.rb +0 -9
  411. data/lib/candidhealth/contracts/v_2/types/contracting_provider_id.rb +0 -9
  412. data/lib/candidhealth/contracts/v_2/types/rendering_providerid.rb +0 -9
  413. data/lib/candidhealth/diagnoses/types/diagnosis_id.rb +0 -7
  414. data/lib/candidhealth/encounter_providers/v_2/types/provider_id.rb +0 -9
  415. data/lib/candidhealth/encounters/v_4/types/intake_follow_up_id.rb +0 -9
  416. data/lib/candidhealth/encounters/v_4/types/intake_question_id.rb +0 -9
  417. data/lib/candidhealth/encounters/v_4/types/prior_authorization_number.rb +0 -9
  418. data/lib/candidhealth/encounters/v_4/types/rx_cui.rb +0 -9
  419. data/lib/candidhealth/era/types/era_id.rb +0 -7
  420. data/lib/candidhealth/expected_network_status/v_2/types/network_status_check_id.rb +0 -9
  421. data/lib/candidhealth/guarantor/v_1/types/guarantor_id.rb +0 -9
  422. data/lib/candidhealth/identifiers/types/identifier_id.rb +0 -7
  423. data/lib/candidhealth/individual/types/individual_id.rb +0 -7
  424. data/lib/candidhealth/insurance_adjudications/v_1/types/insurance_adjudication_id.rb +0 -9
  425. data/lib/candidhealth/insurance_adjudications/v_1/types/service_line_adjudication_id.rb +0 -9
  426. data/lib/candidhealth/insurance_cards/v_2/types/insurance_card_id.rb +0 -9
  427. data/lib/candidhealth/insurance_payments/v_1/types/insurance_payment_id.rb +0 -9
  428. data/lib/candidhealth/insurance_refunds/v_1/types/insurance_refund_id.rb +0 -9
  429. data/lib/candidhealth/organization_providers/v_2/types/organization_provider_id.rb +0 -9
  430. data/lib/candidhealth/organization_service_facilities/v_2/types/organization_service_facility_id.rb +0 -9
  431. data/lib/candidhealth/patient_payments/v_3/types/patient_payment_id.rb +0 -9
  432. data/lib/candidhealth/patient_payments/v_4/types/patient_payment_id.rb +0 -9
  433. data/lib/candidhealth/patient_refunds/v_1/types/patient_refund_id.rb +0 -9
  434. data/lib/candidhealth/payers/v_3/types/payer_id.rb +0 -9
  435. data/lib/candidhealth/payers/v_3/types/payer_name.rb +0 -9
  436. data/lib/candidhealth/payers/v_3/types/payer_uuid.rb +0 -9
  437. data/lib/candidhealth/service_facility/types/service_facility_id.rb +0 -7
  438. data/lib/candidhealth/tags/types/tag_id.rb +0 -7
  439. data/lib/candidhealth/write_offs/v_1/types/write_off_id.rb +0 -9
@@ -1,48 +1,59 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "rarc"
4
+ require "ostruct"
4
5
  require "json"
5
6
 
6
7
  module CandidApiClient
7
8
  module X12
8
9
  module V1
9
- class RemittanceAdviceRemarkCode
10
- attr_reader :reason_code, :additional_properties
10
+ module Types
11
+ class RemittanceAdviceRemarkCode
12
+ # @return [CandidApiClient::X12::V1::Types::Rarc]
13
+ attr_reader :reason_code
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
11
19
 
12
- # @param reason_code [X12::V1::Rarc]
13
- # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
14
- # @return [X12::V1::RemittanceAdviceRemarkCode]
15
- def initialize(reason_code:, additional_properties: nil)
16
- # @type [X12::V1::Rarc]
17
- @reason_code = reason_code
18
- # @type [OpenStruct] Additional properties unmapped to the current class definition
19
- @additional_properties = additional_properties
20
- end
20
+ OMIT = Object.new
21
21
 
22
- # Deserialize a JSON object to an instance of RemittanceAdviceRemarkCode
23
- #
24
- # @param json_object [JSON]
25
- # @return [X12::V1::RemittanceAdviceRemarkCode]
26
- def self.from_json(json_object:)
27
- struct = JSON.parse(json_object, object_class: OpenStruct)
28
- JSON.parse(json_object)
29
- reason_code = struct.reason_code
30
- new(reason_code: reason_code, additional_properties: struct)
31
- end
22
+ # @param reason_code [CandidApiClient::X12::V1::Types::Rarc]
23
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
24
+ # @return [CandidApiClient::X12::V1::Types::RemittanceAdviceRemarkCode]
25
+ def initialize(reason_code:, additional_properties: nil)
26
+ @reason_code = reason_code
27
+ @additional_properties = additional_properties
28
+ @_field_set = { "reason_code": reason_code }
29
+ end
32
30
 
33
- # Serialize an instance of RemittanceAdviceRemarkCode to a JSON object
34
- #
35
- # @return [JSON]
36
- def to_json(*_args)
37
- { "reason_code": @reason_code }.to_json
38
- end
31
+ # Deserialize a JSON object to an instance of RemittanceAdviceRemarkCode
32
+ #
33
+ # @param json_object [String]
34
+ # @return [CandidApiClient::X12::V1::Types::RemittanceAdviceRemarkCode]
35
+ def self.from_json(json_object:)
36
+ struct = JSON.parse(json_object, object_class: OpenStruct)
37
+ reason_code = struct["reason_code"]
38
+ new(reason_code: reason_code, additional_properties: struct)
39
+ end
40
+
41
+ # Serialize an instance of RemittanceAdviceRemarkCode to a JSON object
42
+ #
43
+ # @return [String]
44
+ def to_json(*_args)
45
+ @_field_set&.to_json
46
+ end
39
47
 
40
- # Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
41
- #
42
- # @param obj [Object]
43
- # @return [Void]
44
- def self.validate_raw(obj:)
45
- obj.reason_code.is_a?(X12::V1::Rarc) != false || raise("Passed value for field obj.reason_code is not the expected type, validation failed.")
48
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
49
+ # hash and check each fields type against the current object's property
50
+ # definitions.
51
+ #
52
+ # @param obj [Object]
53
+ # @return [Void]
54
+ def self.validate_raw(obj:)
55
+ obj.reason_code.is_a?(CandidApiClient::X12::V1::Types::Rarc) != false || raise("Passed value for field obj.reason_code is not the expected type, validation failed.")
56
+ end
46
57
  end
47
58
  end
48
59
  end
data/lib/candidhealth.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative "environment"
4
4
  require_relative "types_export"
5
+ require_relative "core/oauth"
5
6
  require_relative "requests"
6
7
  require_relative "candidhealth/auth/client"
7
8
  require_relative "candidhealth/billing_notes/client"
@@ -10,7 +11,10 @@ require_relative "candidhealth/eligibility/client"
10
11
  require_relative "candidhealth/encounters/client"
11
12
  require_relative "candidhealth/expected_network_status/client"
12
13
  require_relative "candidhealth/exports/client"
14
+ require_relative "candidhealth/external_payment_account_config/client"
15
+ require_relative "candidhealth/fee_schedules/client"
13
16
  require_relative "candidhealth/guarantor/client"
17
+ require_relative "candidhealth/import_invoice/client"
14
18
  require_relative "candidhealth/insurance_adjudications/client"
15
19
  require_relative "candidhealth/insurance_payments/client"
16
20
  require_relative "candidhealth/insurance_refunds/client"
@@ -22,108 +26,206 @@ require_relative "candidhealth/payers/client"
22
26
  require_relative "candidhealth/tasks/client"
23
27
  require_relative "candidhealth/write_offs/client"
24
28
  require_relative "candidhealth/service_facility/client"
25
- require_relative "candidhealth/auth/v_2/types/auth_get_token_request"
29
+ require_relative "candidhealth/pre_encounter/client"
26
30
 
27
31
  module CandidApiClient
28
32
  class Client
29
- attr_reader :auth, :billing_notes, :contracts, :eligibility, :encounters, :expected_network_status, :exports,
30
- :guarantor, :insurance_adjudications, :insurance_payments, :insurance_refunds, :organization_service_facilities, :organization_providers, :patient_payments, :patient_refunds, :payers, :tasks, :write_offs, :service_facility
33
+ # @return [CandidApiClient::Auth::Client]
34
+ attr_reader :auth
35
+ # @return [CandidApiClient::BillingNotes::Client]
36
+ attr_reader :billing_notes
37
+ # @return [CandidApiClient::Contracts::Client]
38
+ attr_reader :contracts
39
+ # @return [CandidApiClient::Eligibility::Client]
40
+ attr_reader :eligibility
41
+ # @return [CandidApiClient::Encounters::Client]
42
+ attr_reader :encounters
43
+ # @return [CandidApiClient::ExpectedNetworkStatus::Client]
44
+ attr_reader :expected_network_status
45
+ # @return [CandidApiClient::Exports::Client]
46
+ attr_reader :exports
47
+ # @return [CandidApiClient::ExternalPaymentAccountConfig::Client]
48
+ attr_reader :external_payment_account_config
49
+ # @return [CandidApiClient::FeeSchedules::Client]
50
+ attr_reader :fee_schedules
51
+ # @return [CandidApiClient::Guarantor::Client]
52
+ attr_reader :guarantor
53
+ # @return [CandidApiClient::ImportInvoice::Client]
54
+ attr_reader :import_invoice
55
+ # @return [CandidApiClient::InsuranceAdjudications::Client]
56
+ attr_reader :insurance_adjudications
57
+ # @return [CandidApiClient::InsurancePayments::Client]
58
+ attr_reader :insurance_payments
59
+ # @return [CandidApiClient::InsuranceRefunds::Client]
60
+ attr_reader :insurance_refunds
61
+ # @return [CandidApiClient::OrganizationServiceFacilities::Client]
62
+ attr_reader :organization_service_facilities
63
+ # @return [CandidApiClient::OrganizationProviders::Client]
64
+ attr_reader :organization_providers
65
+ # @return [CandidApiClient::PatientPayments::Client]
66
+ attr_reader :patient_payments
67
+ # @return [CandidApiClient::PatientRefunds::Client]
68
+ attr_reader :patient_refunds
69
+ # @return [CandidApiClient::Payers::Client]
70
+ attr_reader :payers
71
+ # @return [CandidApiClient::Tasks::Client]
72
+ attr_reader :tasks
73
+ # @return [CandidApiClient::WriteOffs::Client]
74
+ attr_reader :write_offs
75
+ # @return [CandidApiClient::ServiceFacilityClient]
76
+ attr_reader :service_facility
77
+ # @return [CandidApiClient::PreEncounter::Client]
78
+ attr_reader :pre_encounter
31
79
 
32
- # @param environment [Environment]
80
+ # @param base_url [String]
81
+ # @param environment [CandidApiClient::Environment]
33
82
  # @param max_retries [Long] The number of times to retry a failed request, defaults to 2.
34
83
  # @param timeout_in_seconds [Long]
35
- # @param options [CandidApiAuthOptions]
36
- # @return [Client]
37
- def initialize(options: nil, environment: Environment::PRODUCTION, max_retries: nil, timeout_in_seconds: nil)
38
- token = options.get_token(environment: environment) unless options.nil?
39
-
40
- @request_client = RequestClient.new(environment: environment, max_retries: max_retries,
41
- timeout_in_seconds: timeout_in_seconds, token: token)
42
- @auth = Auth::Client.new(request_client: @request_client)
43
- @billing_notes = BillingNotes::Client.new(request_client: @request_client)
44
- @contracts = Contracts::Client.new(request_client: @request_client)
45
- @eligibility = Eligibility::Client.new(request_client: @request_client)
46
- @encounters = Encounters::Client.new(request_client: @request_client)
47
- @expected_network_status = ExpectedNetworkStatus::Client.new(request_client: @request_client)
48
- @exports = Exports::Client.new(request_client: @request_client)
49
- @guarantor = Guarantor::Client.new(request_client: @request_client)
50
- @insurance_adjudications = InsuranceAdjudications::Client.new(request_client: @request_client)
51
- @insurance_payments = InsurancePayments::Client.new(request_client: @request_client)
52
- @insurance_refunds = InsuranceRefunds::Client.new(request_client: @request_client)
53
- @organization_service_facilities = OrganizationServiceFacilities::Client.new(request_client: @request_client)
54
- @organization_providers = OrganizationProviders::Client.new(request_client: @request_client)
55
- @patient_payments = PatientPayments::Client.new(request_client: @request_client)
56
- @patient_refunds = PatientRefunds::Client.new(request_client: @request_client)
57
- @payers = Payers::Client.new(request_client: @request_client)
58
- @tasks = Tasks::Client.new(request_client: @request_client)
59
- @write_offs = WriteOffs::Client.new(request_client: @request_client)
60
- @service_facility = ServiceFacilityClient.new(request_client: @request_client)
84
+ # @param client_id [String]
85
+ # @param client_secret [String]
86
+ # @return [CandidApiClient::Client]
87
+ def initialize(client_id:, client_secret:, base_url: nil, environment: CandidApiClient::Environment::PRODUCTION, max_retries: nil,
88
+ timeout_in_seconds: nil)
89
+ @oauth_provider = CandidApiClient::OauthTokenProvider.new(
90
+ client_id: client_id,
91
+ client_secret: client_secret,
92
+ request_client: CandidApiClient::RequestClient.new(
93
+ base_url: base_url,
94
+ environment: environment,
95
+ max_retries: max_retries,
96
+ timeout_in_seconds: timeout_in_seconds
97
+ )
98
+ )
99
+ @request_client = CandidApiClient::RequestClient.new(
100
+ base_url: base_url,
101
+ environment: environment,
102
+ max_retries: max_retries,
103
+ timeout_in_seconds: timeout_in_seconds,
104
+ token: @oauth_provider.method(:token)
105
+ )
106
+ @auth = CandidApiClient::Auth::Client.new(request_client: @request_client)
107
+ @billing_notes = CandidApiClient::BillingNotes::Client.new(request_client: @request_client)
108
+ @contracts = CandidApiClient::Contracts::Client.new(request_client: @request_client)
109
+ @eligibility = CandidApiClient::Eligibility::Client.new(request_client: @request_client)
110
+ @encounters = CandidApiClient::Encounters::Client.new(request_client: @request_client)
111
+ @expected_network_status = CandidApiClient::ExpectedNetworkStatus::Client.new(request_client: @request_client)
112
+ @exports = CandidApiClient::Exports::Client.new(request_client: @request_client)
113
+ @external_payment_account_config = CandidApiClient::ExternalPaymentAccountConfig::Client.new(request_client: @request_client)
114
+ @fee_schedules = CandidApiClient::FeeSchedules::Client.new(request_client: @request_client)
115
+ @guarantor = CandidApiClient::Guarantor::Client.new(request_client: @request_client)
116
+ @import_invoice = CandidApiClient::ImportInvoice::Client.new(request_client: @request_client)
117
+ @insurance_adjudications = CandidApiClient::InsuranceAdjudications::Client.new(request_client: @request_client)
118
+ @insurance_payments = CandidApiClient::InsurancePayments::Client.new(request_client: @request_client)
119
+ @insurance_refunds = CandidApiClient::InsuranceRefunds::Client.new(request_client: @request_client)
120
+ @organization_service_facilities = CandidApiClient::OrganizationServiceFacilities::Client.new(request_client: @request_client)
121
+ @organization_providers = CandidApiClient::OrganizationProviders::Client.new(request_client: @request_client)
122
+ @patient_payments = CandidApiClient::PatientPayments::Client.new(request_client: @request_client)
123
+ @patient_refunds = CandidApiClient::PatientRefunds::Client.new(request_client: @request_client)
124
+ @payers = CandidApiClient::Payers::Client.new(request_client: @request_client)
125
+ @tasks = CandidApiClient::Tasks::Client.new(request_client: @request_client)
126
+ @write_offs = CandidApiClient::WriteOffs::Client.new(request_client: @request_client)
127
+ @service_facility = CandidApiClient::ServiceFacilityClient.new(request_client: @request_client)
128
+ @pre_encounter = CandidApiClient::PreEncounter::Client.new(request_client: @request_client)
61
129
  end
62
130
  end
63
131
 
64
132
  class AsyncClient
65
- attr_reader :auth, :billing_notes, :contracts, :eligibility, :encounters, :expected_network_status, :exports,
66
- :guarantor, :insurance_adjudications, :insurance_payments, :insurance_refunds, :organization_service_facilities, :organization_providers, :patient_payments, :patient_refunds, :payers, :tasks, :write_offs, :service_facility
133
+ # @return [CandidApiClient::Auth::AsyncClient]
134
+ attr_reader :auth
135
+ # @return [CandidApiClient::BillingNotes::AsyncClient]
136
+ attr_reader :billing_notes
137
+ # @return [CandidApiClient::Contracts::AsyncClient]
138
+ attr_reader :contracts
139
+ # @return [CandidApiClient::Eligibility::AsyncClient]
140
+ attr_reader :eligibility
141
+ # @return [CandidApiClient::Encounters::AsyncClient]
142
+ attr_reader :encounters
143
+ # @return [CandidApiClient::ExpectedNetworkStatus::AsyncClient]
144
+ attr_reader :expected_network_status
145
+ # @return [CandidApiClient::Exports::AsyncClient]
146
+ attr_reader :exports
147
+ # @return [CandidApiClient::ExternalPaymentAccountConfig::AsyncClient]
148
+ attr_reader :external_payment_account_config
149
+ # @return [CandidApiClient::FeeSchedules::AsyncClient]
150
+ attr_reader :fee_schedules
151
+ # @return [CandidApiClient::Guarantor::AsyncClient]
152
+ attr_reader :guarantor
153
+ # @return [CandidApiClient::ImportInvoice::AsyncClient]
154
+ attr_reader :import_invoice
155
+ # @return [CandidApiClient::InsuranceAdjudications::AsyncClient]
156
+ attr_reader :insurance_adjudications
157
+ # @return [CandidApiClient::InsurancePayments::AsyncClient]
158
+ attr_reader :insurance_payments
159
+ # @return [CandidApiClient::InsuranceRefunds::AsyncClient]
160
+ attr_reader :insurance_refunds
161
+ # @return [CandidApiClient::OrganizationServiceFacilities::AsyncClient]
162
+ attr_reader :organization_service_facilities
163
+ # @return [CandidApiClient::OrganizationProviders::AsyncClient]
164
+ attr_reader :organization_providers
165
+ # @return [CandidApiClient::PatientPayments::AsyncClient]
166
+ attr_reader :patient_payments
167
+ # @return [CandidApiClient::PatientRefunds::AsyncClient]
168
+ attr_reader :patient_refunds
169
+ # @return [CandidApiClient::Payers::AsyncClient]
170
+ attr_reader :payers
171
+ # @return [CandidApiClient::Tasks::AsyncClient]
172
+ attr_reader :tasks
173
+ # @return [CandidApiClient::WriteOffs::AsyncClient]
174
+ attr_reader :write_offs
175
+ # @return [CandidApiClient::AsyncServiceFacilityClient]
176
+ attr_reader :service_facility
177
+ # @return [CandidApiClient::PreEncounter::AsyncClient]
178
+ attr_reader :pre_encounter
67
179
 
68
- # @param environment [Environment]
180
+ # @param base_url [String]
181
+ # @param environment [CandidApiClient::Environment]
69
182
  # @param max_retries [Long] The number of times to retry a failed request, defaults to 2.
70
183
  # @param timeout_in_seconds [Long]
71
- # @param options [CandidApiAuthOptions]
72
- # @return [AsyncClient]
73
- def initialize(options: nil, environment: Environment::PRODUCTION, max_retries: nil, timeout_in_seconds: nil)
74
- token = options.get_token(environment: environment) unless options.nil?
75
-
76
- @async_request_client = AsyncRequestClient.new(environment: environment, max_retries: max_retries,
77
- timeout_in_seconds: timeout_in_seconds, token: token)
78
- @auth = Auth::AsyncClient.new(request_client: @async_request_client)
79
- @billing_notes = BillingNotes::AsyncClient.new(request_client: @async_request_client)
80
- @contracts = Contracts::AsyncClient.new(request_client: @async_request_client)
81
- @eligibility = Eligibility::AsyncClient.new(request_client: @async_request_client)
82
- @encounters = Encounters::AsyncClient.new(request_client: @async_request_client)
83
- @expected_network_status = ExpectedNetworkStatus::AsyncClient.new(request_client: @async_request_client)
84
- @exports = Exports::AsyncClient.new(request_client: @async_request_client)
85
- @guarantor = Guarantor::AsyncClient.new(request_client: @async_request_client)
86
- @insurance_adjudications = InsuranceAdjudications::AsyncClient.new(request_client: @async_request_client)
87
- @insurance_payments = InsurancePayments::AsyncClient.new(request_client: @async_request_client)
88
- @insurance_refunds = InsuranceRefunds::AsyncClient.new(request_client: @async_request_client)
89
- @organization_service_facilities = OrganizationServiceFacilities::AsyncClient.new(request_client: @async_request_client)
90
- @organization_providers = OrganizationProviders::AsyncClient.new(request_client: @async_request_client)
91
- @patient_payments = PatientPayments::AsyncClient.new(request_client: @async_request_client)
92
- @patient_refunds = PatientRefunds::AsyncClient.new(request_client: @async_request_client)
93
- @payers = Payers::AsyncClient.new(request_client: @async_request_client)
94
- @tasks = Tasks::AsyncClient.new(request_client: @async_request_client)
95
- @write_offs = WriteOffs::AsyncClient.new(request_client: @async_request_client)
96
- @service_facility = AsyncServiceFacilityClient.new(request_client: @async_request_client)
97
- end
98
- end
99
-
100
- class CandidApiAuthOptions
101
- attr_reader :token, :client_id, :client_secret
102
-
103
- # @param token [String]
104
184
  # @param client_id [String]
105
185
  # @param client_secret [String]
106
- # @return [CandidApiAuthOptions]
107
- def initialize(token: nil, client_id: nil, client_secret: nil)
108
- # @type [String]
109
- @token = token
110
- # @type [string]
111
- @client_id = client_id
112
- # @type [string]
113
- @client_secret = client_secret
114
- end
115
-
116
-
117
- # @param environment [Environment]
118
- def get_token(environment:)
119
- unless @token.nil?
120
- return @token
121
- end
122
-
123
- unauthed_client = Client.new(environment:environment)
124
- response = unauthed_client.auth.v_2.get_token(request: {client_id: @client_id, client_secret: @client_secret})
125
- return response.access_token
186
+ # @return [CandidApiClient::AsyncClient]
187
+ def initialize(client_id:, client_secret:, base_url: nil, environment: CandidApiClient::Environment::PRODUCTION, max_retries: nil,
188
+ timeout_in_seconds: nil)
189
+ @oauth_provider = CandidApiClient::OauthTokenProvider.new(
190
+ client_id: client_id,
191
+ client_secret: client_secret,
192
+ request_client: CandidApiClient::RequestClient.new(
193
+ base_url: base_url,
194
+ environment: environment,
195
+ max_retries: max_retries,
196
+ timeout_in_seconds: timeout_in_seconds
197
+ )
198
+ )
199
+ @async_request_client = CandidApiClient::AsyncRequestClient.new(
200
+ base_url: base_url,
201
+ environment: environment,
202
+ max_retries: max_retries,
203
+ timeout_in_seconds: timeout_in_seconds,
204
+ token: token
205
+ )
206
+ @auth = CandidApiClient::Auth::AsyncClient.new(request_client: @async_request_client)
207
+ @billing_notes = CandidApiClient::BillingNotes::AsyncClient.new(request_client: @async_request_client)
208
+ @contracts = CandidApiClient::Contracts::AsyncClient.new(request_client: @async_request_client)
209
+ @eligibility = CandidApiClient::Eligibility::AsyncClient.new(request_client: @async_request_client)
210
+ @encounters = CandidApiClient::Encounters::AsyncClient.new(request_client: @async_request_client)
211
+ @expected_network_status = CandidApiClient::ExpectedNetworkStatus::AsyncClient.new(request_client: @async_request_client)
212
+ @exports = CandidApiClient::Exports::AsyncClient.new(request_client: @async_request_client)
213
+ @external_payment_account_config = CandidApiClient::ExternalPaymentAccountConfig::AsyncClient.new(request_client: @async_request_client)
214
+ @fee_schedules = CandidApiClient::FeeSchedules::AsyncClient.new(request_client: @async_request_client)
215
+ @guarantor = CandidApiClient::Guarantor::AsyncClient.new(request_client: @async_request_client)
216
+ @import_invoice = CandidApiClient::ImportInvoice::AsyncClient.new(request_client: @async_request_client)
217
+ @insurance_adjudications = CandidApiClient::InsuranceAdjudications::AsyncClient.new(request_client: @async_request_client)
218
+ @insurance_payments = CandidApiClient::InsurancePayments::AsyncClient.new(request_client: @async_request_client)
219
+ @insurance_refunds = CandidApiClient::InsuranceRefunds::AsyncClient.new(request_client: @async_request_client)
220
+ @organization_service_facilities = CandidApiClient::OrganizationServiceFacilities::AsyncClient.new(request_client: @async_request_client)
221
+ @organization_providers = CandidApiClient::OrganizationProviders::AsyncClient.new(request_client: @async_request_client)
222
+ @patient_payments = CandidApiClient::PatientPayments::AsyncClient.new(request_client: @async_request_client)
223
+ @patient_refunds = CandidApiClient::PatientRefunds::AsyncClient.new(request_client: @async_request_client)
224
+ @payers = CandidApiClient::Payers::AsyncClient.new(request_client: @async_request_client)
225
+ @tasks = CandidApiClient::Tasks::AsyncClient.new(request_client: @async_request_client)
226
+ @write_offs = CandidApiClient::WriteOffs::AsyncClient.new(request_client: @async_request_client)
227
+ @service_facility = CandidApiClient::AsyncServiceFacilityClient.new(request_client: @async_request_client)
228
+ @pre_encounter = CandidApiClient::PreEncounter::AsyncClient.new(request_client: @async_request_client)
126
229
  end
127
230
  end
128
-
129
231
  end
data/lib/core/oauth.rb ADDED
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../requests"
4
+ require_relative "../candidhealth/auth/v_2/client"
5
+ require_relative "oauth"
6
+
7
+ module CandidApiClient
8
+ class AccessToken
9
+ # @return [String]
10
+ attr_reader :access_token
11
+ # @return [Time]
12
+ attr_reader :expires_at
13
+
14
+ # @param access_token [String]
15
+ # @param expires_at [Time]
16
+ # @return [CandidApiClient::AccessToken]
17
+ def initialize(access_token:, expires_at: nil)
18
+ @access_token = access_token
19
+ @expires_at = expires_at
20
+ end
21
+ end
22
+
23
+ # Utility class for managing token refresh.
24
+ class OauthTokenProvider
25
+ # @return [String]
26
+ attr_reader :client_id
27
+ # @return [String]
28
+ attr_reader :client_secret
29
+ # @return [String]
30
+ attr_reader :auth_client
31
+
32
+ EXPIRY_BUFFER_MINUTES = 2
33
+
34
+ # @param client_id [String]
35
+ # @param client_secret [String]
36
+ # @param request_client [CandidApiClient::RequestClient]
37
+ # @return [CandidApiClient::OauthTokenProvider]
38
+ def initialize(client_id:, client_secret:, request_client:)
39
+ @client_id = client_id
40
+ @client_secret = client_secret
41
+ @auth_client = CandidApiClient::Auth::V2::V2Client.new(request_client: request_client)
42
+ end
43
+
44
+ # Returns a cached access token retrieved from the provided client credentials,
45
+ # refreshing if necessary.
46
+ #
47
+ # @return [String]
48
+ def token
49
+ return @token.access_token if !@token.nil? && (@token.expires_at.nil? || @token.expires_at > Time.now)
50
+
51
+ @token = refresh_token
52
+ @token.access_token
53
+ end
54
+
55
+ # @return [CandidApiClient::AccessToken]
56
+ def refresh_token
57
+ token_response = @auth_client.get_token(client_id: @client_id, client_secret: @client_secret)
58
+ CandidApiClient::AccessToken.new(access_token: token_response.access_token,
59
+ expires_at: Time.now + token_response.expires_in - (EXPIRY_BUFFER_MINUTES * 60))
60
+ end
61
+ end
62
+ end
data/lib/environment.rb CHANGED
@@ -2,7 +2,13 @@
2
2
 
3
3
  module CandidApiClient
4
4
  class Environment
5
- PRODUCTION = "https://api.joincandidhealth.com"
6
- STAGING = "https://api-staging.joincandidhealth.com"
5
+ PRODUCTION = {
6
+ CandidApi: "https://api.joincandidhealth.com",
7
+ PreEncounter: "https://pre-api.joincandidhealth.com"
8
+ }.freeze
9
+ STAGING = {
10
+ CandidApi: "https://api-staging.joincandidhealth.com",
11
+ PreEncounter: "https://pre-api-staging.joincandidhealth.com"
12
+ }.freeze
7
13
  end
8
14
  end