Class: CandidApiClient::Payers::V3::AsyncV3Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ CandidApiClient::Payers::V3::AsyncV3Client

Parameters:



81
82
83
# File 'lib/candidhealth/payers/v_3/client.rb', line 81

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientCandidApiClient::AsyncRequestClient (readonly)



77
78
79
# File 'lib/candidhealth/payers/v_3/client.rb', line 77

def request_client
  @request_client
end

Instance Method Details

#get(payer_uuid:, request_options: nil) ⇒ CandidApiClient::Payers::V3::Types::Payer

Examples:

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

Parameters:

Returns:



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/candidhealth/payers/v_3/client.rb', line 91

def get(payer_uuid:, request_options: nil)
  Async do
    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/payers/v3/#{payer_uuid}"
    end
    CandidApiClient::Payers::V3::Types::Payer.from_json(json_object: response.body)
  end
end

#get_all(limit: nil, search_term: nil, page_token: nil, request_options: nil) ⇒ CandidApiClient::Payers::V3::Types::PayerPage

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.payers.v_3.get_all(
  limit: 100,
  search_term: "john",
  page_token: "eyJ0b2tlbiI6IjEiLCJwYWdlX3Rva2VuIjoiMiJ9"
)

Parameters:

  • limit (Integer) (defaults to: nil)

    Maximum number of entities per page, defaults to 100.

  • search_term (String) (defaults to: nil)
  • page_token (String) (defaults to: nil)
  • request_options (CandidApiClient::RequestOptions) (defaults to: nil)

Returns:



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/candidhealth/payers/v_3/client.rb', line 120

def get_all(limit: nil, search_term: nil, page_token: nil, request_options: nil)
  Async do
    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 || {}),
        "limit": limit,
        "search_term": search_term,
        "page_token": page_token
      }.compact
      req.url "#{@request_client.get_url(environment: CandidApi,
                                         request_options: request_options)}/api/payers/v3"
    end
    CandidApiClient::Payers::V3::Types::PayerPage.from_json(json_object: response.body)
  end
end