Class: Voltaria::Clients::Client
- Inherits:
-
Object
- Object
- Voltaria::Clients::Client
- Defined in:
- lib/voltaria/clients/client.rb
Instance Method Summary collapse
-
#add_client_portal_user(request_options: {}, **params) ⇒ Voltaria::Types::ClientUserResponse
Invite a new user to a client's portal account.
-
#approve_onboarding(request_options: {}, **params) ⇒ Voltaria::Types::ClientResponse
Accept a self-onboarded client.
-
#create_client(request_options: {}, **params) ⇒ Voltaria::Types::ClientResponse
Create a new client under your partner account.
-
#create_client_data(request_options: {}, **params) ⇒ Voltaria::Types::ClientDataResponse
Upload supplementary client information, such as bank account balance, accounting figures, or other relevant details.
-
#create_limit_request(request_options: {}, **params) ⇒ Voltaria::Types::LimitRequestResponse
Create a limit review request for a client.
-
#delete_client(request_options: {}, **params) ⇒ Hash[String, Object]?
Delete a client by ID.
-
#get_client_by_id(request_options: {}, **params) ⇒ Voltaria::Types::ClientResponse
Retrieve detailed information for a specific client using their client ID.
-
#get_limit_request(request_options: {}, **params) ⇒ Voltaria::Types::LimitRequestResponse
Retrieve a specific limit request by its ID.
- #initialize(client:) ⇒ void constructor
-
#list_client_checklist_summaries(request_options: {}, **params) ⇒ Voltaria::Types::PaginatedResponseChecklistSummaryPartnerResponse
Retrieve the checklist summaries for one of your clients, including the AI description and item completion counts.
-
#list_client_waivers(request_options: {}, **params) ⇒ Voltaria::Types::PaginatedResponseWaiverResponse
Retrieve all waivers associated with a specific client.
-
#list_clients(request_options: {}, **params) ⇒ Voltaria::Types::PaginatedResponseClientResponse
Retrieve a list of all clients associated with your partner account.
-
#list_limit_requests(request_options: {}, **params) ⇒ Voltaria::Types::PaginatedResponseLimitRequestResponse
Retrieve a list of all limit requests associated with your partner account.
-
#list_onboarding_clients(request_options: {}, **params) ⇒ Voltaria::Types::PaginatedResponseClientResponse
Retrieve all clients that have self-registered via the portal and are awaiting partner approval.
-
#reject_onboarding(request_options: {}, **params) ⇒ Voltaria::Types::ClientResponse
Reject a self-onboarded client.
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/voltaria/clients/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#add_client_portal_user(request_options: {}, **params) ⇒ Voltaria::Types::ClientUserResponse
Invite a new user to a client's portal account. The invited user will receive an email with a one-time link to set their password. Partner can assign any role: 'owner', 'admin', or 'viewer'.
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
# File 'lib/voltaria/clients/client.rb', line 371 def add_client_portal_user(request_options: {}, **params) params = Voltaria::Internal::Types::Utils.normalize_keys(params) request_data = Voltaria::Clients::Types::ClientUserInviteRequest.new(params).to_h non_body_param_names = ["client_id"] body = request_data.except(*non_body_param_names) request = Voltaria::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "v2/clients/#{URI.encode_uri_component(params[:client_id].to_s)}/users", body: body, 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::ClientUserResponse.load(response.body) else error_class = Voltaria::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#approve_onboarding(request_options: {}, **params) ⇒ Voltaria::Types::ClientResponse
Accept a self-onboarded client. The client status moves to 'pending' and the owner's portal account is activated so they can begin submitting documents.
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 |
# File 'lib/voltaria/clients/client.rb', line 301 def approve_onboarding(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/clients/onboarding/#{URI.encode_uri_component(params[:client_id].to_s)}/approve", 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::ClientResponse.load(response.body) else error_class = Voltaria::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#create_client(request_options: {}, **params) ⇒ Voltaria::Types::ClientResponse
Create a new client under your partner account. The client will remain in a pending state until reviewed by Winyield.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/voltaria/clients/client.rb', line 71 def create_client(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/clients", body: Voltaria::Clients::Types::ClientCreatePayload.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::ClientResponse.load(response.body) else error_class = Voltaria::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#create_client_data(request_options: {}, **params) ⇒ Voltaria::Types::ClientDataResponse
Upload supplementary client information, such as bank account balance, accounting figures, or other relevant details.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/voltaria/clients/client.rb', line 106 def create_client_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/clients/data", body: Voltaria::Clients::Types::ClientDataCreatePayload.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::ClientDataResponse.load(response.body) else error_class = Voltaria::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#create_limit_request(request_options: {}, **params) ⇒ Voltaria::Types::LimitRequestResponse
Create a limit review request for a client. The request will remain in a pending state until reviewed by Winyield.
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
# File 'lib/voltaria/clients/client.rb', line 189 def create_limit_request(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/clients/limit-requests", body: Voltaria::Clients::Types::LimitRequestCreatePayload.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::LimitRequestResponse.load(response.body) else error_class = Voltaria::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#delete_client(request_options: {}, **params) ⇒ Hash[String, Object]?
Delete a client by ID. Only clients with 'pending' status can be deleted. All client's loans must also be in 'pending' status.
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 |
# File 'lib/voltaria/clients/client.rb', line 492 def delete_client(request_options: {}, **params) params = Voltaria::Internal::Types::Utils.normalize_keys(params) request = Voltaria::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "v2/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 return if code.between?(200, 299) error_class = Voltaria::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end |
#get_client_by_id(request_options: {}, **params) ⇒ Voltaria::Types::ClientResponse
Retrieve detailed information for a specific client using their client ID.
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 |
# File 'lib/voltaria/clients/client.rb', line 457 def get_client_by_id(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/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::ClientResponse.load(response.body) else error_class = Voltaria::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_limit_request(request_options: {}, **params) ⇒ Voltaria::Types::LimitRequestResponse
Retrieve a specific limit request by its ID.
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/voltaria/clients/client.rb', line 224 def get_limit_request(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/clients/limit-requests/#{URI.encode_uri_component(params[:request_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::LimitRequestResponse.load(response.body) else error_class = Voltaria::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_client_checklist_summaries(request_options: {}, **params) ⇒ Voltaria::Types::PaginatedResponseChecklistSummaryPartnerResponse
Retrieve the checklist summaries for one of your clients, including the AI description and item completion counts.
527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 |
# File 'lib/voltaria/clients/client.rb', line 527 def list_client_checklist_summaries(request_options: {}, **params) params = Voltaria::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[page page_size] query_params = {} query_params["page"] = params[:page] if params.key?(:page) query_params["page_size"] = params[:page_size] if params.key?(:page_size) params = params.except(*query_param_names) request = Voltaria::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "v2/clients/#{URI.encode_uri_component(params[:client_id].to_s)}/checklist-summaries", 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::PaginatedResponseChecklistSummaryPartnerResponse.load(response.body) else error_class = Voltaria::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_client_waivers(request_options: {}, **params) ⇒ Voltaria::Types::PaginatedResponseWaiverResponse
Retrieve all waivers associated with a specific client.
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 |
# File 'lib/voltaria/clients/client.rb', line 414 def list_client_waivers(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 = params.except(*query_param_names) request = Voltaria::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "v2/clients/#{URI.encode_uri_component(params[:client_id].to_s)}/waivers", 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::PaginatedResponseWaiverResponse.load(response.body) else error_class = Voltaria::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_clients(request_options: {}, **params) ⇒ Voltaria::Types::PaginatedResponseClientResponse
Retrieve a list of all clients associated with your partner account.
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/clients/client.rb', line 28 def 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/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::PaginatedResponseClientResponse.load(response.body) else error_class = Voltaria::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_limit_requests(request_options: {}, **params) ⇒ Voltaria::Types::PaginatedResponseLimitRequestResponse
Retrieve a list of all limit requests associated with your partner account.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/voltaria/clients/client.rb', line 145 def list_limit_requests(request_options: {}, **params) params = Voltaria::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[client_id page page_size order_by q] query_params = {} query_params["client_id"] = params[:client_id] if params.key?(:client_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/clients/limit-requests", 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::PaginatedResponseLimitRequestResponse.load(response.body) else error_class = Voltaria::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_onboarding_clients(request_options: {}, **params) ⇒ Voltaria::Types::PaginatedResponseClientResponse
Retrieve all clients that have self-registered via the portal and are awaiting partner approval.
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
# File 'lib/voltaria/clients/client.rb', line 259 def list_onboarding_clients(request_options: {}, **params) params = Voltaria::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[page page_size] query_params = {} query_params["page"] = params[:page] if params.key?(:page) query_params["page_size"] = params[:page_size] if params.key?(:page_size) params.except(*query_param_names) request = Voltaria::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "v2/clients/onboarding", 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::PaginatedResponseClientResponse.load(response.body) else error_class = Voltaria::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#reject_onboarding(request_options: {}, **params) ⇒ Voltaria::Types::ClientResponse
Reject a self-onboarded client. The client record is kept with 'rejected' status for audit history and is not deleted.
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
# File 'lib/voltaria/clients/client.rb', line 336 def reject_onboarding(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/clients/onboarding/#{URI.encode_uri_component(params[:client_id].to_s)}/reject", 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::ClientResponse.load(response.body) else error_class = Voltaria::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |