Class: CandidApiClient::Contracts::V2::V2Client

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/contracts/v_2/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ CandidApiClient::Contracts::V2::V2Client

Parameters:



27
28
29
# File 'lib/candidhealth/contracts/v_2/client.rb', line 27

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientCandidApiClient::RequestClient (readonly)



23
24
25
# File 'lib/candidhealth/contracts/v_2/client.rb', line 23

def request_client
  @request_client
end

Instance Method Details

#create(effective_date:, regions:, commercial_insurance_types:, medicare_insurance_types:, medicaid_insurance_types:, contracting_provider_id:, rendering_provider_ids:, payer_uuid:, expiration_date: nil, contract_status: nil, authorized_signatory: nil, additional_properties: nil, _field_set: nil, request_options: nil) ⇒ CandidApiClient::Contracts::V2::Types::ContractWithProviders

Creates a new contract within the user’s current organization

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.contracts.v_2.create(
  contracting_provider_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  rendering_provider_ids: Set["d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"],
  payer_uuid: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"
)

Parameters:

  • effective_date (String)

    The starting day upon which the contract is effective

  • expiration_date (String) (defaults to: nil)

    An optional end day upon which the contract expires

  • regions (CandidApiClient::Commons::Types::Regions)

    The state(s) to which the contract’s coverage extends. It may also be set to “national” for the entirety of the US.

  • contract_status (CandidApiClient::Contracts::V2::Types::ContractStatus) (defaults to: nil)
  • authorized_signatory (Hash) (defaults to: nil)

    Request of type CandidApiClient::Contracts::V2::Types::AuthorizedSignatory, as a Hash

    • :first_name (String)

    • :last_name (String)

    • :title (String)

    • :email (String)

    • :phone (String)

    • :fax (String)

  • commercial_insurance_types (CandidApiClient::Contracts::V2::Types::InsuranceTypes)

    The commercial plan insurance types this contract applies.

  • medicare_insurance_types (CandidApiClient::Contracts::V2::Types::InsuranceTypes)

    The Medicare plan insurance types this contract applies.

  • medicaid_insurance_types (CandidApiClient::Contracts::V2::Types::InsuranceTypes)

    The Medicaid plan insurance types this contract applies.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition

  • _field_set (Object) (defaults to: nil)
  • contracting_provider_id (String)

    The UUID of the provider under agreement to the contract

  • rendering_provider_ids (Set<String>)

    A rendering provider isn’t contracted directly with the payer but can render services under the contract held by the contracting provider. Max items is 100.

  • payer_uuid (String)

    The UUID of the insurance company under agreement to the contract

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

Returns:



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/candidhealth/contracts/v_2/client.rb', line 131

def create(effective_date:, regions:, commercial_insurance_types:, medicare_insurance_types:,
           medicaid_insurance_types:, contracting_provider_id:, rendering_provider_ids:, payer_uuid:, expiration_date: nil, contract_status: nil, authorized_signatory: nil, additional_properties: nil, _field_set: nil, request_options: nil)
  response = @request_client.conn.post do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.body = {
      **(request_options&.additional_body_parameters || {}),
      effective_date: effective_date,
      expiration_date: expiration_date,
      regions: regions,
      contract_status: contract_status,
      authorized_signatory: authorized_signatory,
      commercial_insurance_types: commercial_insurance_types,
      medicare_insurance_types: medicare_insurance_types,
      medicaid_insurance_types: medicaid_insurance_types,
      additional_properties: additional_properties,
      _field_set: _field_set,
      contracting_provider_id: contracting_provider_id,
      rendering_provider_ids: rendering_provider_ids,
      payer_uuid: payer_uuid
    }.compact
    req.url "#{@request_client.get_url(environment: CandidApi,
                                       request_options: request_options)}/api/contracts/v2"
  end
  CandidApiClient::Contracts::V2::Types::ContractWithProviders.from_json(json_object: response.body)
end

#delete(contract_id:, request_options: nil) ⇒ Void

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.contracts.v_2.delete(contract_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32")

Parameters:

Returns:

  • (Void)


169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/candidhealth/contracts/v_2/client.rb', line 169

def delete(contract_id:, request_options: nil)
  @request_client.conn.delete do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.url "#{@request_client.get_url(environment: CandidApi,
                                       request_options: request_options)}/api/contracts/v2/#{contract_id}"
  end
end

#get(contract_id:, request_options: nil) ⇒ CandidApiClient::Contracts::V2::Types::ContractWithProviders

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.contracts.v_2.get(contract_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32")

Parameters:

Returns:



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/candidhealth/contracts/v_2/client.rb', line 37

def get(contract_id:, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.url "#{@request_client.get_url(environment: CandidApi,
                                       request_options: request_options)}/api/contracts/v2/#{contract_id}"
  end
  CandidApiClient::Contracts::V2::Types::ContractWithProviders.from_json(json_object: response.body)
end

#get_multi(page_token: nil, limit: nil, contracting_provider_id: nil, rendering_provider_ids: nil, payer_names: nil, states: nil, contract_status: nil, request_options: nil) ⇒ CandidApiClient::Contracts::V2::Types::ContractsPage

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.contracts.v_2.get_multi(
  page_token: "eyJ0b2tlbiI6IjEiLCJwYWdlX3Rva2VuIjoiMiJ9",
  limit: 1,
  contracting_provider_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  rendering_provider_ids: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  payer_names: "string",
  states: AA,
  contract_status: PENDING
)

Parameters:

  • page_token (String) (defaults to: nil)
  • limit (Integer) (defaults to: nil)

    Max number of contracts returned. Defaults to 1000. Max is 1000.

  • contracting_provider_id (String) (defaults to: nil)
  • rendering_provider_ids (String) (defaults to: nil)
  • payer_names (String) (defaults to: nil)

    Filter to contracts that include any of the included payer names.

  • states (CandidApiClient::Commons::Types::State) (defaults to: nil)
  • contract_status (CandidApiClient::Contracts::V2::Types::ContractStatus) (defaults to: nil)

    The status of the contract. Defaults to ‘pending`

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

Returns:



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/candidhealth/contracts/v_2/client.rb', line 72

def get_multi(page_token: nil, limit: nil, contracting_provider_id: nil, rendering_provider_ids: nil,
              payer_names: nil, states: nil, contract_status: nil, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.params = {
      **(request_options&.additional_query_parameters || {}),
      "page_token": page_token,
      "limit": limit,
      "contracting_provider_id": contracting_provider_id,
      "rendering_provider_ids": rendering_provider_ids,
      "payer_names": payer_names,
      "states": states,
      "contract_status": contract_status
    }.compact
    req.url "#{@request_client.get_url(environment: CandidApi,
                                       request_options: request_options)}/api/contracts/v2"
  end
  CandidApiClient::Contracts::V2::Types::ContractsPage.from_json(json_object: response.body)
end

#update(contract_id:, rendering_provider_ids: nil, effective_date: nil, expiration_date: nil, regions: nil, contract_status: nil, authorized_signatory: nil, commercial_insurance_types: nil, medicare_insurance_types: nil, medicaid_insurance_types: nil, request_options: nil) ⇒ CandidApiClient::Contracts::V2::Types::ContractWithProviders

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.contracts.v_2.update(
  contract_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  rendering_provider_ids: Set["d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"],
  effective_date: "string",
  contract_status: PENDING
)

Parameters:

Returns:



206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/candidhealth/contracts/v_2/client.rb', line 206

def update(contract_id:, rendering_provider_ids: nil, effective_date: nil, expiration_date: nil, regions: nil,
           contract_status: nil, authorized_signatory: nil, commercial_insurance_types: nil, medicare_insurance_types: nil, medicaid_insurance_types: nil, request_options: nil)
  response = @request_client.conn.patch do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.body = {
      **(request_options&.additional_body_parameters || {}),
      rendering_provider_ids: rendering_provider_ids,
      effective_date: effective_date,
      expiration_date: expiration_date,
      regions: regions,
      contract_status: contract_status,
      authorized_signatory: authorized_signatory,
      commercial_insurance_types: commercial_insurance_types,
      medicare_insurance_types: medicare_insurance_types,
      medicaid_insurance_types: medicaid_insurance_types
    }.compact
    req.url "#{@request_client.get_url(environment: CandidApi,
                                       request_options: request_options)}/api/contracts/v2/#{contract_id}"
  end
  CandidApiClient::Contracts::V2::Types::ContractWithProviders.from_json(json_object: response.body)
end