Class: CandidApiClient::AsyncServiceFacilityClient

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

Parameters:



58
59
60
# File 'lib/candidhealth/service_facility/client.rb', line 58

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientCandidApiClient::AsyncRequestClient (readonly)



54
55
56
# File 'lib/candidhealth/service_facility/client.rb', line 54

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:



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/candidhealth/service_facility/client.rb', line 78

def update(service_facility_id:, request:, request_options: nil)
  Async do
    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
end