29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/candid/external_payment_account_config/v_1/client.rb', line 29
def get_multi(request_options: {}, **params)
params = Candid::Internal::Types::Utils.normalize_keys(params)
query_param_names = %i[limit page_token]
query_params = {}
query_params["limit"] = params[:limit] if params.key?(:limit)
query_params["page_token"] = params[:page_token] if params.key?(:page_token)
params.except(*query_param_names)
request = Candid::Internal::JSON::Request.new(
base_url: request_options[:base_url] || @base_url || @environment&.dig(:candid_api),
method: "GET",
path: "/api/external-payment-account-config/v1",
query: query_params,
request_options: request_options
)
begin
response = @client.send(request)
rescue Net::HTTPRequestTimeout
raise Candid::Errors::TimeoutError
end
code = response.code.to_i
if code.between?(200, 299)
Candid::ExternalPaymentAccountConfig::V1::Types::ExternalPaymentAccountConfigPage.load(response.body)
else
error_class = Candid::Errors::ResponseError.subclass_for_code(code)
raise error_class.new(response.body, code: code)
end
end
|