Class: CandidApiClient::ServiceFacilityClient

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ CandidApiClient::ServiceFacilityClient

Parameters:



15
16
17
# File 'lib/candidhealth/service_facility/client.rb', line 15

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientCandidApiClient::RequestClient (readonly)



11
12
13
# File 'lib/candidhealth/service_facility/client.rb', line 11

def request_client
  @request_client
end

Instance Method Details

#update(service_facility_id:, request:, request_options: nil) ⇒ CandidApiClient::ServiceFacility::Types::EncounterServiceFacility

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.service_facility.update(service_facility_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", request: { organization_name: "Test Organization", address: { address_1: "123 Main St", address_2: "Apt 1", city: "New York", state: NY, zip_code: "10001", zip_plus_four_code: "1234" } })

Parameters:

  • service_facility_id (String)
  • request (Hash)

    Request of type CandidApiClient::ServiceFacility::Types::EncounterServiceFacilityUpdate, as a Hash

    • :organization_name (String)

    • :npi (String)

    • :address (Hash)

      • :zip_plus_four_code (String)

      • :address_1 (String)

      • :address_2 (String)

      • :city (String)

      • :state (CandidApiClient::Commons::Types::State)

      • :zip_code (String)

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

Returns:



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

def update(service_facility_id:, request:, 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 || {}), **(request_options&.additional_body_parameters || {}) }.compact
    req.url "#{@request_client.get_url(environment: CandidApi,
                                       request_options: request_options)}/api/service_facility/v2/#{service_facility_id}"
  end
  CandidApiClient::ServiceFacility::Types::EncounterServiceFacility.from_json(json_object: response.body)
end