Class: Voltaria::Investors::Client
- Inherits:
-
Object
- Object
- Voltaria::Investors::Client
- Defined in:
- lib/voltaria/investors/client.rb
Instance Method Summary collapse
- #initialize(client:) ⇒ void constructor
-
#investor_get_client(request_options: {}, **params) ⇒ Voltaria::Types::ClientInvestorResponse
Retrieve a specific client that has a loan funded by this investor.
-
#investor_get_installment(request_options: {}, **params) ⇒ Voltaria::Types::InstallmentResponse
Retrieve a specific installment for a loan funded by the current investor.
-
#investor_get_loan(request_options: {}, **params) ⇒ Voltaria::Types::LoanResponseWithInstallments
Retrieve a specific loan funded by the current investor, with its installments.
-
#investor_list_clients(request_options: {}, **params) ⇒ Voltaria::Types::PaginatedResponseClientInvestorResponse
Retrieve all clients with at least one loan funded by this investor.
-
#investor_list_installments(request_options: {}, **params) ⇒ Voltaria::Types::PaginatedResponseInstallmentResponseWithClientInfo
Retrieve all installments for loans funded by the current investor.
-
#investor_list_loans(request_options: {}, **params) ⇒ Voltaria::Types::PaginatedResponseLoanInvestorResponse
Retrieve all loans funded by the current investor.
-
#investor_list_repayments(request_options: {}, **params) ⇒ Voltaria::Types::PaginatedResponseRepaymentResponseWithClientInfo
Retrieve all repayment logs for loans funded by the current investor.
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/voltaria/investors/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#investor_get_client(request_options: {}, **params) ⇒ Voltaria::Types::ClientInvestorResponse
Retrieve a specific client that has a loan funded by this investor.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/voltaria/investors/client.rb', line 71 def investor_get_client(request_options: {}, **params) params = Voltaria::Internal::Types::Utils.normalize_keys(params) request = Voltaria::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "v2/investors/clients/#{URI.encode_uri_component(params[:client_id].to_s)}", 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::ClientInvestorResponse.load(response.body) else error_class = Voltaria::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#investor_get_installment(request_options: {}, **params) ⇒ Voltaria::Types::InstallmentResponse
Retrieve a specific installment for a loan funded by the current investor.
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
# File 'lib/voltaria/investors/client.rb', line 237 def investor_get_installment(request_options: {}, **params) params = Voltaria::Internal::Types::Utils.normalize_keys(params) request = Voltaria::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "v2/investors/installments/#{URI.encode_uri_component(params[:installment_id].to_s)}", 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::InstallmentResponse.load(response.body) else error_class = Voltaria::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#investor_get_loan(request_options: {}, **params) ⇒ Voltaria::Types::LoanResponseWithInstallments
Retrieve a specific loan funded by the current investor, with its installments.
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/voltaria/investors/client.rb', line 153 def investor_get_loan(request_options: {}, **params) params = Voltaria::Internal::Types::Utils.normalize_keys(params) request = Voltaria::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "v2/investors/loans/#{URI.encode_uri_component(params[:loan_id].to_s)}", 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::LoanResponseWithInstallments.load(response.body) else error_class = Voltaria::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#investor_list_clients(request_options: {}, **params) ⇒ Voltaria::Types::PaginatedResponseClientInvestorResponse
Retrieve all clients with at least one loan funded by this investor.
28 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 57 |
# File 'lib/voltaria/investors/client.rb', line 28 def investor_list_clients(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/investors/clients", 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::PaginatedResponseClientInvestorResponse.load(response.body) else error_class = Voltaria::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#investor_list_installments(request_options: {}, **params) ⇒ Voltaria::Types::PaginatedResponseInstallmentResponseWithClientInfo
Retrieve all installments for loans funded by the current investor.
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/voltaria/investors/client.rb', line 192 def investor_list_installments(request_options: {}, **params) params = Voltaria::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[page page_size client_id loan_id 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["client_id"] = params[:client_id] if params.key?(:client_id) query_params["loan_id"] = params[:loan_id] if params.key?(:loan_id) 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/investors/installments", 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::PaginatedResponseInstallmentResponseWithClientInfo.load(response.body) else error_class = Voltaria::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#investor_list_loans(request_options: {}, **params) ⇒ Voltaria::Types::PaginatedResponseLoanInvestorResponse
Retrieve all loans funded by the current investor.
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/voltaria/investors/client.rb', line 109 def investor_list_loans(request_options: {}, **params) params = Voltaria::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[page page_size client_id 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["client_id"] = params[:client_id] if params.key?(:client_id) 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/investors/loans", 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::PaginatedResponseLoanInvestorResponse.load(response.body) else error_class = Voltaria::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#investor_list_repayments(request_options: {}, **params) ⇒ Voltaria::Types::PaginatedResponseRepaymentResponseWithClientInfo
Retrieve all repayment logs for loans funded by the current investor.
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
# File 'lib/voltaria/investors/client.rb', line 277 def investor_list_repayments(request_options: {}, **params) params = Voltaria::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[client_id loan_id installment_id page page_size order_by q] query_params = {} query_params["client_id"] = params[:client_id] if params.key?(:client_id) query_params["loan_id"] = params[:loan_id] if params.key?(:loan_id) query_params["installment_id"] = params[:installment_id] if params.key?(:installment_id) 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/investors/repayments", 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::PaginatedResponseRepaymentResponseWithClientInfo.load(response.body) else error_class = Voltaria::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |