Class: Voltaria::Partners::Client
- Inherits:
-
Object
- Object
- Voltaria::Partners::Client
- Defined in:
- lib/voltaria/partners/client.rb
Instance Method Summary collapse
-
#create_partner_data(request_options: {}, **params) ⇒ Voltaria::Types::PartnerDataResponse
Upload supplementary partner information, such as bank account balance, accounting figures, or other relevant details.
-
#get_available_funding(request_options: {}, **params) ⇒ Array[Voltaria::Types::AvailableFunding]
Use this endpoint to check the available funding capacity in your dedicated lending account before initiating a new loan or submitting a drawdown request.
- #initialize(client:) ⇒ void constructor
-
#list_partner_waterfalls(request_options: {}, **params) ⇒ Voltaria::Types::PaginatedResponseWaterfallResponse
Use this endpoint to get the list of waterfalls for your dedicated lending account.
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/voltaria/partners/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#create_partner_data(request_options: {}, **params) ⇒ Voltaria::Types::PartnerDataResponse
Upload supplementary partner information, such as bank account balance, accounting figures, or other relevant details.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/voltaria/partners/client.rb', line 59 def create_partner_data(request_options: {}, **params) params = Voltaria::Internal::Types::Utils.normalize_keys(params) request = Voltaria::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "v2/partners/data", body: Voltaria::Partners::Types::PartnerDataCreatePayload.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Voltaria::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Voltaria::Types::PartnerDataResponse.load(response.body) else error_class = Voltaria::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_available_funding(request_options: {}, **params) ⇒ Array[Voltaria::Types::AvailableFunding]
Use this endpoint to check the available funding capacity in your dedicated lending account before initiating a new loan or submitting a drawdown request.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/voltaria/partners/client.rb', line 25 def get_available_funding(request_options: {}, **params) Voltaria::Internal::Types::Utils.normalize_keys(params) request = Voltaria::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "v2/partners/available-funding", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Voltaria::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) ::JSON.parse(response.body).map { |item| Voltaria::Types::AvailableFunding.load(::JSON.generate(item)) } else error_class = Voltaria::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_partner_waterfalls(request_options: {}, **params) ⇒ Voltaria::Types::PaginatedResponseWaterfallResponse
Use this endpoint to get the list of waterfalls for your dedicated lending account.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/voltaria/partners/client.rb', line 97 def list_partner_waterfalls(request_options: {}, **params) params = Voltaria::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[page page_size order_by q] query_params = {} query_params["page"] = params[:page] if params.key?(:page) query_params["page_size"] = params[:page_size] if params.key?(:page_size) query_params["order_by"] = params[:order_by] if params.key?(:order_by) query_params["q"] = params[:q] if params.key?(:q) params.except(*query_param_names) request = Voltaria::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "v2/partners/waterfalls", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Voltaria::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Voltaria::Types::PaginatedResponseWaterfallResponse.load(response.body) else error_class = Voltaria::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |