Class: CandidApiClient::Payers::V3::V3Client

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

Parameters:



17
18
19
# File 'lib/candidhealth/payers/v_3/client.rb', line 17

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientCandidApiClient::RequestClient (readonly)



13
14
15
# File 'lib/candidhealth/payers/v_3/client.rb', line 13

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:



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/candidhealth/payers/v_3/client.rb', line 27

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



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/candidhealth/payers/v_3/client.rb', line 54

def get_all(limit: nil, search_term: nil, page_token: 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 || {}),
      "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