voltaria_sdk 2.34.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rubocop.yml +69 -0
- data/README.md +202 -0
- data/Rakefile +20 -0
- data/custom.gemspec.rb +16 -0
- data/lib/voltaria/accounts/client.rb +168 -0
- data/lib/voltaria/accounts/types/get_client_account_request.rb +12 -0
- data/lib/voltaria/accounts/types/list_client_account_fields_request.rb +11 -0
- data/lib/voltaria/accounts/types/list_client_accounts_request.rb +14 -0
- data/lib/voltaria/accounts/types/partner_client_account_create_request.rb +23 -0
- data/lib/voltaria/accounts/types/partner_client_account_create_request_status.rb +14 -0
- data/lib/voltaria/client.rb +74 -0
- data/lib/voltaria/clients/client.rb +557 -0
- data/lib/voltaria/clients/types/approve_onboarding_request.rb +11 -0
- data/lib/voltaria/clients/types/client_create_payload.rb +16 -0
- data/lib/voltaria/clients/types/client_data_create_payload.rb +12 -0
- data/lib/voltaria/clients/types/client_user_invite_request.rb +16 -0
- data/lib/voltaria/clients/types/delete_client_request.rb +11 -0
- data/lib/voltaria/clients/types/get_client_by_id_request.rb +11 -0
- data/lib/voltaria/clients/types/get_limit_request_request.rb +11 -0
- data/lib/voltaria/clients/types/limit_request_create_payload.rb +14 -0
- data/lib/voltaria/clients/types/limit_request_create_payload_requested_limit.rb +15 -0
- data/lib/voltaria/clients/types/list_client_checklist_summaries_request.rb +13 -0
- data/lib/voltaria/clients/types/list_client_waivers_request.rb +15 -0
- data/lib/voltaria/clients/types/list_clients_request.rb +14 -0
- data/lib/voltaria/clients/types/list_limit_requests_request.rb +15 -0
- data/lib/voltaria/clients/types/list_onboarding_clients_request.rb +12 -0
- data/lib/voltaria/clients/types/reject_onboarding_request.rb +11 -0
- data/lib/voltaria/documents/client.rb +221 -0
- data/lib/voltaria/documents/types/delete_document_request.rb +11 -0
- data/lib/voltaria/documents/types/document_create_payload.rb +14 -0
- data/lib/voltaria/documents/types/get_document_by_id_request.rb +11 -0
- data/lib/voltaria/documents/types/list_documents_request.rb +18 -0
- data/lib/voltaria/drawdowns/client.rb +141 -0
- data/lib/voltaria/drawdowns/types/drawdown_create_payload.rb +12 -0
- data/lib/voltaria/drawdowns/types/drawdown_create_payload_amount.rb +15 -0
- data/lib/voltaria/drawdowns/types/list_drawdown_checklists_request.rb +15 -0
- data/lib/voltaria/drawdowns/types/list_drawdowns_request.rb +14 -0
- data/lib/voltaria/environment.rb +8 -0
- data/lib/voltaria/errors/api_error.rb +8 -0
- data/lib/voltaria/errors/client_error.rb +17 -0
- data/lib/voltaria/errors/redirect_error.rb +8 -0
- data/lib/voltaria/errors/response_error.rb +42 -0
- data/lib/voltaria/errors/server_error.rb +11 -0
- data/lib/voltaria/errors/timeout_error.rb +8 -0
- data/lib/voltaria/installments/client.rb +292 -0
- data/lib/voltaria/installments/types/delete_installment_request.rb +11 -0
- data/lib/voltaria/installments/types/get_installment_by_id_request.rb +11 -0
- data/lib/voltaria/installments/types/installment_create_payload.rb +12 -0
- data/lib/voltaria/installments/types/installment_edit_payload.rb +13 -0
- data/lib/voltaria/installments/types/installment_edit_payload_amount.rb +15 -0
- data/lib/voltaria/installments/types/list_installments_request.rb +16 -0
- data/lib/voltaria/installments/types/list_payment_promises_request.rb +16 -0
- data/lib/voltaria/installments/types/payment_promise_create_payload.rb +14 -0
- data/lib/voltaria/installments/types/payment_promise_create_payload_amount.rb +15 -0
- data/lib/voltaria/internal/errors/constraint_error.rb +10 -0
- data/lib/voltaria/internal/errors/type_error.rb +10 -0
- data/lib/voltaria/internal/http/base_request.rb +51 -0
- data/lib/voltaria/internal/http/raw_client.rb +214 -0
- data/lib/voltaria/internal/iterators/cursor_item_iterator.rb +28 -0
- data/lib/voltaria/internal/iterators/cursor_page_iterator.rb +51 -0
- data/lib/voltaria/internal/iterators/item_iterator.rb +59 -0
- data/lib/voltaria/internal/iterators/offset_item_iterator.rb +30 -0
- data/lib/voltaria/internal/iterators/offset_page_iterator.rb +83 -0
- data/lib/voltaria/internal/json/request.rb +41 -0
- data/lib/voltaria/internal/json/serializable.rb +25 -0
- data/lib/voltaria/internal/multipart/multipart_encoder.rb +141 -0
- data/lib/voltaria/internal/multipart/multipart_form_data.rb +78 -0
- data/lib/voltaria/internal/multipart/multipart_form_data_part.rb +51 -0
- data/lib/voltaria/internal/multipart/multipart_request.rb +40 -0
- data/lib/voltaria/internal/types/array.rb +47 -0
- data/lib/voltaria/internal/types/boolean.rb +34 -0
- data/lib/voltaria/internal/types/enum.rb +56 -0
- data/lib/voltaria/internal/types/hash.rb +36 -0
- data/lib/voltaria/internal/types/model/field.rb +38 -0
- data/lib/voltaria/internal/types/model.rb +208 -0
- data/lib/voltaria/internal/types/type.rb +35 -0
- data/lib/voltaria/internal/types/union.rb +161 -0
- data/lib/voltaria/internal/types/unknown.rb +15 -0
- data/lib/voltaria/internal/types/utils.rb +116 -0
- data/lib/voltaria/investors/client.rb +312 -0
- data/lib/voltaria/investors/types/investor_get_client_request.rb +11 -0
- data/lib/voltaria/investors/types/investor_get_installment_request.rb +11 -0
- data/lib/voltaria/investors/types/investor_get_loan_request.rb +11 -0
- data/lib/voltaria/investors/types/investor_list_clients_request.rb +14 -0
- data/lib/voltaria/investors/types/investor_list_installments_request.rb +16 -0
- data/lib/voltaria/investors/types/investor_list_loans_request.rb +15 -0
- data/lib/voltaria/investors/types/investor_list_repayments_request.rb +17 -0
- data/lib/voltaria/loans/client.rb +271 -0
- data/lib/voltaria/loans/types/bulk_loan_create_payload.rb +11 -0
- data/lib/voltaria/loans/types/delete_loan_request.rb +11 -0
- data/lib/voltaria/loans/types/get_bulk_loan_status_request.rb +11 -0
- data/lib/voltaria/loans/types/get_loan_by_id_request.rb +11 -0
- data/lib/voltaria/loans/types/list_loans_request.rb +15 -0
- data/lib/voltaria/loans/types/loan_create_payload.rb +17 -0
- data/lib/voltaria/loans/types/loan_create_payload_amount.rb +15 -0
- data/lib/voltaria/loans/types/loan_default_payload.rb +13 -0
- data/lib/voltaria/loans/types/loan_default_payload_sold_amount.rb +15 -0
- data/lib/voltaria/partners/client.rb +129 -0
- data/lib/voltaria/partners/types/list_partner_waterfalls_request.rb +14 -0
- data/lib/voltaria/partners/types/partner_data_create_payload.rb +11 -0
- data/lib/voltaria/prefix_routing.rb +80 -0
- data/lib/voltaria/repayments/client.rb +183 -0
- data/lib/voltaria/repayments/types/bulk_repayment_create_payload.rb +11 -0
- data/lib/voltaria/repayments/types/get_bulk_repayment_status_request.rb +11 -0
- data/lib/voltaria/repayments/types/list_repayment_logs_request.rb +17 -0
- data/lib/voltaria/repayments/types/repayment_create_payload.rb +17 -0
- data/lib/voltaria/repayments/types/repayment_create_payload_amount.rb +15 -0
- data/lib/voltaria/sandbox/client.rb +124 -0
- data/lib/voltaria/sandbox/types/client_update_sandbox.rb +13 -0
- data/lib/voltaria/sandbox/types/client_update_sandbox_limit.rb +15 -0
- data/lib/voltaria/sandbox/types/loan_update_sandbox.rb +12 -0
- data/lib/voltaria/sandbox/types/webhook_test_sandbox.rb +12 -0
- data/lib/voltaria/types/account_address.rb +14 -0
- data/lib/voltaria/types/account_holder_type_enum.rb +12 -0
- data/lib/voltaria/types/account_status_enum.rb +13 -0
- data/lib/voltaria/types/available_document_categories_response.rb +9 -0
- data/lib/voltaria/types/available_funding.rb +15 -0
- data/lib/voltaria/types/bulk_loan_item_payload.rb +15 -0
- data/lib/voltaria/types/bulk_loan_item_payload_amount.rb +13 -0
- data/lib/voltaria/types/bulk_loan_item_result.rb +15 -0
- data/lib/voltaria/types/bulk_loan_result.rb +13 -0
- data/lib/voltaria/types/bulk_loan_task_response.rb +11 -0
- data/lib/voltaria/types/bulk_loan_task_status.rb +14 -0
- data/lib/voltaria/types/bulk_repayment_item_payload.rb +15 -0
- data/lib/voltaria/types/bulk_repayment_item_payload_amount.rb +13 -0
- data/lib/voltaria/types/bulk_repayment_item_result.rb +15 -0
- data/lib/voltaria/types/bulk_repayment_result.rb +13 -0
- data/lib/voltaria/types/bulk_repayment_task_response.rb +11 -0
- data/lib/voltaria/types/bulk_repayment_task_status.rb +14 -0
- data/lib/voltaria/types/checklist_summary_partner_response.rb +14 -0
- data/lib/voltaria/types/checklist_type_enum.rb +12 -0
- data/lib/voltaria/types/client_account_response.rb +21 -0
- data/lib/voltaria/types/client_base_info.rb +13 -0
- data/lib/voltaria/types/client_data_response.rb +12 -0
- data/lib/voltaria/types/client_investor_response.rb +17 -0
- data/lib/voltaria/types/client_limit_response.rb +16 -0
- data/lib/voltaria/types/client_response.rb +19 -0
- data/lib/voltaria/types/client_status_enum.rb +18 -0
- data/lib/voltaria/types/client_type_enum.rb +12 -0
- data/lib/voltaria/types/client_user_response.rb +24 -0
- data/lib/voltaria/types/client_user_status_enum.rb +13 -0
- data/lib/voltaria/types/currency_enum.rb +16 -0
- data/lib/voltaria/types/currency_field_spec.rb +10 -0
- data/lib/voltaria/types/document_response.rb +20 -0
- data/lib/voltaria/types/drawdown_checklist_response.rb +16 -0
- data/lib/voltaria/types/drawdown_response.rb +15 -0
- data/lib/voltaria/types/drawdown_status_enum.rb +13 -0
- data/lib/voltaria/types/http_validation_error.rb +9 -0
- data/lib/voltaria/types/installment_response.rb +24 -0
- data/lib/voltaria/types/installment_response_with_client_info.rb +25 -0
- data/lib/voltaria/types/installment_status_enum.rb +19 -0
- data/lib/voltaria/types/jurisdiction_enum.rb +13 -0
- data/lib/voltaria/types/kyc_status_enum.rb +14 -0
- data/lib/voltaria/types/limit_request_response.rb +16 -0
- data/lib/voltaria/types/limit_request_status_enum.rb +13 -0
- data/lib/voltaria/types/loan_installment_create_payload.rb +10 -0
- data/lib/voltaria/types/loan_installment_create_payload_amount.rb +13 -0
- data/lib/voltaria/types/loan_installment_response.rb +15 -0
- data/lib/voltaria/types/loan_investor_response.rb +27 -0
- data/lib/voltaria/types/loan_payment_status_enum.rb +12 -0
- data/lib/voltaria/types/loan_response_with_client_info.rb +26 -0
- data/lib/voltaria/types/loan_response_with_installments.rb +26 -0
- data/lib/voltaria/types/loan_status_enum.rb +21 -0
- data/lib/voltaria/types/paginated_response_checklist_summary_partner_response.rb +16 -0
- data/lib/voltaria/types/paginated_response_client_account_response.rb +16 -0
- data/lib/voltaria/types/paginated_response_client_investor_response.rb +16 -0
- data/lib/voltaria/types/paginated_response_client_response.rb +16 -0
- data/lib/voltaria/types/paginated_response_document_response.rb +16 -0
- data/lib/voltaria/types/paginated_response_drawdown_checklist_response.rb +16 -0
- data/lib/voltaria/types/paginated_response_drawdown_response.rb +16 -0
- data/lib/voltaria/types/paginated_response_installment_response_with_client_info.rb +16 -0
- data/lib/voltaria/types/paginated_response_limit_request_response.rb +16 -0
- data/lib/voltaria/types/paginated_response_loan_investor_response.rb +16 -0
- data/lib/voltaria/types/paginated_response_loan_response_with_client_info.rb +16 -0
- data/lib/voltaria/types/paginated_response_payment_promise_response.rb +16 -0
- data/lib/voltaria/types/paginated_response_repayment_response_with_client_info.rb +16 -0
- data/lib/voltaria/types/paginated_response_waiver_response.rb +16 -0
- data/lib/voltaria/types/paginated_response_waterfall_response.rb +16 -0
- data/lib/voltaria/types/paginated_response_webhook_log_response.rb +16 -0
- data/lib/voltaria/types/paginated_response_webhook_subscription_response.rb +16 -0
- data/lib/voltaria/types/partner_data_response.rb +11 -0
- data/lib/voltaria/types/payment_promise_response.rb +19 -0
- data/lib/voltaria/types/payment_promise_status_enum.rb +14 -0
- data/lib/voltaria/types/repayment_response.rb +21 -0
- data/lib/voltaria/types/repayment_response_with_client_info.rb +22 -0
- data/lib/voltaria/types/role_response.rb +11 -0
- data/lib/voltaria/types/validation_error.rb +13 -0
- data/lib/voltaria/types/validation_error_loc_item.rb +12 -0
- data/lib/voltaria/types/waiver_response.rb +18 -0
- data/lib/voltaria/types/waiver_status_enum.rb +14 -0
- data/lib/voltaria/types/waterfall_response.rb +19 -0
- data/lib/voltaria/types/waterfall_status_enum.rb +12 -0
- data/lib/voltaria/types/webhook_event_type_enum.rb +15 -0
- data/lib/voltaria/types/webhook_log_response.rb +19 -0
- data/lib/voltaria/types/webhook_log_response_request_body.rb +13 -0
- data/lib/voltaria/types/webhook_status_enum.rb +13 -0
- data/lib/voltaria/types/webhook_subscription_response.rb +17 -0
- data/lib/voltaria/version.rb +5 -0
- data/lib/voltaria/webhooks/client.rb +241 -0
- data/lib/voltaria/webhooks/types/delete_webhook_subscription_request.rb +11 -0
- data/lib/voltaria/webhooks/types/get_webhook_subscription_request.rb +11 -0
- data/lib/voltaria/webhooks/types/list_webhook_logs_request.rb +13 -0
- data/lib/voltaria/webhooks/types/list_webhook_subscriptions_request.rb +13 -0
- data/lib/voltaria/webhooks/types/webhook_create_payload.rb +16 -0
- data/lib/voltaria/webhooks/types/webhook_update_payload.rb +17 -0
- data/lib/voltaria.rb +205 -0
- data/reference.md +5135 -0
- metadata +250 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 7323267929d363a6ed23706221d2733e2fd02bbd16fd399f88114c704cda41f3
|
|
4
|
+
data.tar.gz: 0e3e178f4802b5b34998b5d71a16672cf6f004d8c4b89d7dba07aa222e82b4b5
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 8cf08fb7772427072cb4d94bea6841886fa2aee3aba9df689e0d2fd987969c99feed56d12b4f4fca01bc499ac37dca94f2508270881beb9d9fbb7d0775aaf3e6
|
|
7
|
+
data.tar.gz: 6c6251ab6926ff847e6b7b3371052137150047b4a9e54fd4804fa60cb3f0fd696c17d51229bb8bfd266e3f1c0e1f7d5044ec7f6b770680c525d28278beae64f0
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
plugins:
|
|
2
|
+
- rubocop-minitest
|
|
3
|
+
|
|
4
|
+
AllCops:
|
|
5
|
+
TargetRubyVersion: 3.3
|
|
6
|
+
NewCops: enable
|
|
7
|
+
|
|
8
|
+
Style/StringLiterals:
|
|
9
|
+
EnforcedStyle: double_quotes
|
|
10
|
+
|
|
11
|
+
Style/StringLiteralsInInterpolation:
|
|
12
|
+
EnforcedStyle: double_quotes
|
|
13
|
+
|
|
14
|
+
Style/AccessModifierDeclarations:
|
|
15
|
+
Enabled: false
|
|
16
|
+
|
|
17
|
+
Lint/ConstantDefinitionInBlock:
|
|
18
|
+
Enabled: false
|
|
19
|
+
|
|
20
|
+
Metrics/AbcSize:
|
|
21
|
+
Enabled: false
|
|
22
|
+
|
|
23
|
+
Metrics/BlockLength:
|
|
24
|
+
Enabled: false
|
|
25
|
+
|
|
26
|
+
Metrics/ClassLength:
|
|
27
|
+
Enabled: false
|
|
28
|
+
|
|
29
|
+
Metrics/MethodLength:
|
|
30
|
+
Enabled: false
|
|
31
|
+
|
|
32
|
+
Metrics/ParameterLists:
|
|
33
|
+
Enabled: false
|
|
34
|
+
|
|
35
|
+
Metrics/PerceivedComplexity:
|
|
36
|
+
Enabled: false
|
|
37
|
+
|
|
38
|
+
Metrics/CyclomaticComplexity:
|
|
39
|
+
Enabled: false
|
|
40
|
+
|
|
41
|
+
Metrics/ModuleLength:
|
|
42
|
+
Enabled: false
|
|
43
|
+
|
|
44
|
+
Layout/LineLength:
|
|
45
|
+
Enabled: false
|
|
46
|
+
|
|
47
|
+
Naming/VariableNumber:
|
|
48
|
+
EnforcedStyle: normalcase
|
|
49
|
+
|
|
50
|
+
Style/Documentation:
|
|
51
|
+
Enabled: false
|
|
52
|
+
|
|
53
|
+
Style/Lambda:
|
|
54
|
+
EnforcedStyle: literal
|
|
55
|
+
|
|
56
|
+
Minitest/MultipleAssertions:
|
|
57
|
+
Enabled: false
|
|
58
|
+
|
|
59
|
+
Minitest/UselessAssertion:
|
|
60
|
+
Enabled: false
|
|
61
|
+
|
|
62
|
+
# Dynamic snippets are code samples for documentation, not standalone Ruby files.
|
|
63
|
+
Style/FrozenStringLiteralComment:
|
|
64
|
+
Exclude:
|
|
65
|
+
- "dynamic-snippets/**/*"
|
|
66
|
+
|
|
67
|
+
Layout/FirstHashElementIndentation:
|
|
68
|
+
Exclude:
|
|
69
|
+
- "dynamic-snippets/**/*"
|
data/README.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
<!-- voltaria-readme-assembled -->
|
|
2
|
+
# Voltaria Ruby Library
|
|
3
|
+
|
|
4
|
+
## Quickstart
|
|
5
|
+
|
|
6
|
+
Install the gem:
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
gem install voltaria_sdk
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Then load it with `require "voltaria"`.
|
|
13
|
+
|
|
14
|
+
Construct a client with `Voltaria.new`, passing your API key. The base URL is derived automatically from the key prefix:
|
|
15
|
+
|
|
16
|
+
```ruby
|
|
17
|
+
require "voltaria"
|
|
18
|
+
|
|
19
|
+
# Production
|
|
20
|
+
client = Voltaria.new("live_...")
|
|
21
|
+
|
|
22
|
+
# Sandbox
|
|
23
|
+
# client = Voltaria.new("sandbox_...")
|
|
24
|
+
|
|
25
|
+
# List loans
|
|
26
|
+
loans = client.loans.list_loans
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
| Key prefix | Environment | Base URL |
|
|
30
|
+
| ---------- | ----------- | --------------------------------- |
|
|
31
|
+
| `live_` | Production | `https://api.voltaria.io` |
|
|
32
|
+
| `sandbox_` | Sandbox | `https://api.sandbox.voltaria.io` |
|
|
33
|
+
|
|
34
|
+
Passing an explicit `base_url:` overrides prefix routing.
|
|
35
|
+
|
|
36
|
+
See [reference.md](./reference.md) for the full API reference.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=Voltaria%2FRuby)
|
|
41
|
+
|
|
42
|
+
The Voltaria Ruby library provides convenient access to the Voltaria APIs from Ruby.
|
|
43
|
+
|
|
44
|
+
## Table of Contents
|
|
45
|
+
|
|
46
|
+
- [Reference](#reference)
|
|
47
|
+
- [Usage](#usage)
|
|
48
|
+
- [Environments](#environments)
|
|
49
|
+
- [Errors](#errors)
|
|
50
|
+
- [Advanced](#advanced)
|
|
51
|
+
- [Retries](#retries)
|
|
52
|
+
- [Timeouts](#timeouts)
|
|
53
|
+
- [Additional Headers](#additional-headers)
|
|
54
|
+
- [Additional Query Parameters](#additional-query-parameters)
|
|
55
|
+
- [Contributing](#contributing)
|
|
56
|
+
|
|
57
|
+
## Reference
|
|
58
|
+
|
|
59
|
+
A full reference for this library is available [here](./reference.md).
|
|
60
|
+
|
|
61
|
+
## Usage
|
|
62
|
+
|
|
63
|
+
Instantiate and use the client with the following:
|
|
64
|
+
|
|
65
|
+
```ruby
|
|
66
|
+
require "voltaria"
|
|
67
|
+
|
|
68
|
+
client = Voltaria::Client.new(token: "<token>")
|
|
69
|
+
|
|
70
|
+
client.clients.create_client(
|
|
71
|
+
name: "ACME Corp",
|
|
72
|
+
jurisdiction: "eu"
|
|
73
|
+
)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Environments
|
|
77
|
+
|
|
78
|
+
This SDK allows you to configure different environments or custom URLs for API requests. You can either use the predefined environments or specify your own custom URL.
|
|
79
|
+
### Environments
|
|
80
|
+
```ruby
|
|
81
|
+
require "voltaria"
|
|
82
|
+
|
|
83
|
+
voltaria = Voltaria::Client.new(
|
|
84
|
+
base_url: Voltaria::Environment::SANDBOX
|
|
85
|
+
)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Custom URL
|
|
89
|
+
```ruby
|
|
90
|
+
require "voltaria"
|
|
91
|
+
|
|
92
|
+
client = Voltaria::Client.new(
|
|
93
|
+
base_url: "https://example.com"
|
|
94
|
+
)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Errors
|
|
98
|
+
|
|
99
|
+
Failed API calls will raise errors that can be rescued from granularly.
|
|
100
|
+
|
|
101
|
+
```ruby
|
|
102
|
+
require "voltaria"
|
|
103
|
+
|
|
104
|
+
client = Voltaria::Client.new(
|
|
105
|
+
base_url: "https://example.com"
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
begin
|
|
109
|
+
result = client.clients.create_client
|
|
110
|
+
rescue Voltaria::Errors::TimeoutError
|
|
111
|
+
puts "API didn't respond before our timeout elapsed"
|
|
112
|
+
rescue Voltaria::Errors::ServiceUnavailableError
|
|
113
|
+
puts "API returned status 503, is probably overloaded, try again later"
|
|
114
|
+
rescue Voltaria::Errors::ServerError
|
|
115
|
+
puts "API returned some other 5xx status, this is probably a bug"
|
|
116
|
+
rescue Voltaria::Errors::ResponseError => e
|
|
117
|
+
puts "API returned an unexpected status other than 5xx: #{e.code} #{e.message}"
|
|
118
|
+
rescue Voltaria::Errors::ApiError => e
|
|
119
|
+
puts "Some other error occurred when calling the API: #{e.message}"
|
|
120
|
+
end
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Advanced
|
|
124
|
+
|
|
125
|
+
### Retries
|
|
126
|
+
|
|
127
|
+
The SDK is instrumented with automatic retries. A request will be retried as long as the request is deemed
|
|
128
|
+
retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2).
|
|
129
|
+
|
|
130
|
+
A request is deemed retryable when any of the following HTTP status codes is returned:
|
|
131
|
+
|
|
132
|
+
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
|
|
133
|
+
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
|
|
134
|
+
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
|
|
135
|
+
|
|
136
|
+
Use the `max_retries` option to configure this behavior.
|
|
137
|
+
|
|
138
|
+
```ruby
|
|
139
|
+
require "voltaria"
|
|
140
|
+
|
|
141
|
+
client = Voltaria::Client.new(
|
|
142
|
+
base_url: "https://example.com",
|
|
143
|
+
max_retries: 3 # Configure max retries (default is 2)
|
|
144
|
+
)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Timeouts
|
|
148
|
+
|
|
149
|
+
The SDK defaults to a 60 second timeout. Use the `timeout` option to configure this behavior.
|
|
150
|
+
|
|
151
|
+
```ruby
|
|
152
|
+
require "voltaria"
|
|
153
|
+
|
|
154
|
+
response = client.clients.create_client(
|
|
155
|
+
...,
|
|
156
|
+
timeout: 30 # 30 second timeout
|
|
157
|
+
)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Additional Headers
|
|
161
|
+
|
|
162
|
+
If you would like to send additional headers as part of the request, use the `additional_headers` request option.
|
|
163
|
+
|
|
164
|
+
```ruby
|
|
165
|
+
require "voltaria"
|
|
166
|
+
|
|
167
|
+
response = client.clients.create_client(
|
|
168
|
+
...,
|
|
169
|
+
request_options: {
|
|
170
|
+
additional_headers: {
|
|
171
|
+
"X-Custom-Header" => "custom-value"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Additional Query Parameters
|
|
178
|
+
|
|
179
|
+
If you would like to send additional query parameters as part of the request, use the `additional_query_parameters` request option.
|
|
180
|
+
|
|
181
|
+
```ruby
|
|
182
|
+
require "voltaria"
|
|
183
|
+
|
|
184
|
+
response = client.clients.create_client(
|
|
185
|
+
...,
|
|
186
|
+
request_options: {
|
|
187
|
+
additional_query_parameters: {
|
|
188
|
+
"custom_param" => "custom-value"
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Contributing
|
|
195
|
+
|
|
196
|
+
While we value open-source contributions to this SDK, this library is generated programmatically.
|
|
197
|
+
Additions made directly to this library would have to be moved over to our generation code,
|
|
198
|
+
otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
|
|
199
|
+
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
|
|
200
|
+
an issue first to discuss with us!
|
|
201
|
+
|
|
202
|
+
On the other hand, contributions to the README are always very welcome!
|
data/Rakefile
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "bundler/gem_tasks"
|
|
4
|
+
require "minitest/test_task"
|
|
5
|
+
|
|
6
|
+
Minitest::TestTask.create
|
|
7
|
+
|
|
8
|
+
require "rubocop/rake_task"
|
|
9
|
+
|
|
10
|
+
RuboCop::RakeTask.new
|
|
11
|
+
|
|
12
|
+
task default: %i[test]
|
|
13
|
+
|
|
14
|
+
task lint: %i[rubocop]
|
|
15
|
+
|
|
16
|
+
# Run only the custom test file
|
|
17
|
+
Minitest::TestTask.create(:customtest) do |t|
|
|
18
|
+
t.libs << "test"
|
|
19
|
+
t.test_globs = ["test/custom.test.rb"]
|
|
20
|
+
end
|
data/custom.gemspec.rb
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Custom gemspec configuration file
|
|
4
|
+
# This file is automatically loaded by the main gemspec file. The 'spec' variable is available
|
|
5
|
+
# in this context from the main gemspec file. You can modify this file to add custom metadata,
|
|
6
|
+
# dependencies, or other gemspec configurations. If you do make changes to this file, you will
|
|
7
|
+
# need to add it to the .fernignore file to prevent your changes from being overwritten.
|
|
8
|
+
|
|
9
|
+
def add_custom_gemspec_data(spec)
|
|
10
|
+
# Example custom configurations (uncomment and modify as needed)
|
|
11
|
+
|
|
12
|
+
# spec.authors = ["Your name"]
|
|
13
|
+
# spec.email = ["your.email@example.com"]
|
|
14
|
+
# spec.homepage = "https://github.com/your-org/voltaria-ruby"
|
|
15
|
+
# spec.license = "Your license"
|
|
16
|
+
end
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Voltaria
|
|
4
|
+
module Accounts
|
|
5
|
+
class Client
|
|
6
|
+
# @param client [Voltaria::Internal::Http::RawClient]
|
|
7
|
+
#
|
|
8
|
+
# @return [void]
|
|
9
|
+
def initialize(client:)
|
|
10
|
+
@client = client
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Return the required and optional bank account fields for each supported currency. Fetch once and cache; use it
|
|
14
|
+
# to build the create-account request.
|
|
15
|
+
#
|
|
16
|
+
# @param request_options [Hash]
|
|
17
|
+
# @param params [Hash]
|
|
18
|
+
# @option request_options [String] :base_url
|
|
19
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
20
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
21
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
22
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
23
|
+
# @option params [String] :client_id
|
|
24
|
+
#
|
|
25
|
+
# @return [Hash[String, Voltaria::Types::CurrencyFieldSpec]]
|
|
26
|
+
def list_client_account_fields(request_options: {}, **params)
|
|
27
|
+
params = Voltaria::Internal::Types::Utils.normalize_keys(params)
|
|
28
|
+
request = Voltaria::Internal::JSON::Request.new(
|
|
29
|
+
base_url: request_options[:base_url],
|
|
30
|
+
method: "GET",
|
|
31
|
+
path: "v2/clients/#{URI.encode_uri_component(params[:client_id].to_s)}/accounts/fields",
|
|
32
|
+
request_options: request_options
|
|
33
|
+
)
|
|
34
|
+
begin
|
|
35
|
+
response = @client.send(request)
|
|
36
|
+
rescue Net::HTTPRequestTimeout
|
|
37
|
+
raise Voltaria::Errors::TimeoutError
|
|
38
|
+
end
|
|
39
|
+
code = response.code.to_i
|
|
40
|
+
return if code.between?(200, 299)
|
|
41
|
+
|
|
42
|
+
error_class = Voltaria::Errors::ResponseError.subclass_for_code(code)
|
|
43
|
+
raise error_class.new(response.body, code: code)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Retrieve all bank accounts for one of your clients.
|
|
47
|
+
#
|
|
48
|
+
# @param request_options [Hash]
|
|
49
|
+
# @param params [Hash]
|
|
50
|
+
# @option request_options [String] :base_url
|
|
51
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
52
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
53
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
54
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
55
|
+
# @option params [String] :client_id
|
|
56
|
+
# @option params [Integer, nil] :page
|
|
57
|
+
# @option params [Integer, nil] :page_size
|
|
58
|
+
# @option params [String, nil] :order_by
|
|
59
|
+
#
|
|
60
|
+
# @return [Voltaria::Types::PaginatedResponseClientAccountResponse]
|
|
61
|
+
def list_client_accounts(request_options: {}, **params)
|
|
62
|
+
params = Voltaria::Internal::Types::Utils.normalize_keys(params)
|
|
63
|
+
query_param_names = %i[page page_size order_by]
|
|
64
|
+
query_params = {}
|
|
65
|
+
query_params["page"] = params[:page] if params.key?(:page)
|
|
66
|
+
query_params["page_size"] = params[:page_size] if params.key?(:page_size)
|
|
67
|
+
query_params["order_by"] = params[:order_by] if params.key?(:order_by)
|
|
68
|
+
params = params.except(*query_param_names)
|
|
69
|
+
|
|
70
|
+
request = Voltaria::Internal::JSON::Request.new(
|
|
71
|
+
base_url: request_options[:base_url],
|
|
72
|
+
method: "GET",
|
|
73
|
+
path: "v2/clients/#{URI.encode_uri_component(params[:client_id].to_s)}/accounts",
|
|
74
|
+
query: query_params,
|
|
75
|
+
request_options: request_options
|
|
76
|
+
)
|
|
77
|
+
begin
|
|
78
|
+
response = @client.send(request)
|
|
79
|
+
rescue Net::HTTPRequestTimeout
|
|
80
|
+
raise Voltaria::Errors::TimeoutError
|
|
81
|
+
end
|
|
82
|
+
code = response.code.to_i
|
|
83
|
+
if code.between?(200, 299)
|
|
84
|
+
Voltaria::Types::PaginatedResponseClientAccountResponse.load(response.body)
|
|
85
|
+
else
|
|
86
|
+
error_class = Voltaria::Errors::ResponseError.subclass_for_code(code)
|
|
87
|
+
raise error_class.new(response.body, code: code)
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Create a bank account for one of your clients. The account is registered with the payment provider immediately.
|
|
92
|
+
# Use the `status` field to create it as `active` (default; demotes any existing active account in the same
|
|
93
|
+
# currency to `passive`) or `passive`.
|
|
94
|
+
#
|
|
95
|
+
# @param request_options [Hash]
|
|
96
|
+
# @param params [Voltaria::Accounts::Types::PartnerClientAccountCreateRequest]
|
|
97
|
+
# @option request_options [String] :base_url
|
|
98
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
99
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
100
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
101
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
102
|
+
# @option params [String] :client_id
|
|
103
|
+
#
|
|
104
|
+
# @return [Voltaria::Types::ClientAccountResponse]
|
|
105
|
+
def create_client_account(request_options: {}, **params)
|
|
106
|
+
params = Voltaria::Internal::Types::Utils.normalize_keys(params)
|
|
107
|
+
request_data = Voltaria::Accounts::Types::PartnerClientAccountCreateRequest.new(params).to_h
|
|
108
|
+
non_body_param_names = ["client_id"]
|
|
109
|
+
body = request_data.except(*non_body_param_names)
|
|
110
|
+
|
|
111
|
+
request = Voltaria::Internal::JSON::Request.new(
|
|
112
|
+
base_url: request_options[:base_url],
|
|
113
|
+
method: "POST",
|
|
114
|
+
path: "v2/clients/#{URI.encode_uri_component(params[:client_id].to_s)}/accounts",
|
|
115
|
+
body: body,
|
|
116
|
+
request_options: request_options
|
|
117
|
+
)
|
|
118
|
+
begin
|
|
119
|
+
response = @client.send(request)
|
|
120
|
+
rescue Net::HTTPRequestTimeout
|
|
121
|
+
raise Voltaria::Errors::TimeoutError
|
|
122
|
+
end
|
|
123
|
+
code = response.code.to_i
|
|
124
|
+
if code.between?(200, 299)
|
|
125
|
+
Voltaria::Types::ClientAccountResponse.load(response.body)
|
|
126
|
+
else
|
|
127
|
+
error_class = Voltaria::Errors::ResponseError.subclass_for_code(code)
|
|
128
|
+
raise error_class.new(response.body, code: code)
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Retrieve a specific bank account for one of your clients.
|
|
133
|
+
#
|
|
134
|
+
# @param request_options [Hash]
|
|
135
|
+
# @param params [Hash]
|
|
136
|
+
# @option request_options [String] :base_url
|
|
137
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
138
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
139
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
140
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
141
|
+
# @option params [String] :client_id
|
|
142
|
+
# @option params [String] :account_id
|
|
143
|
+
#
|
|
144
|
+
# @return [Voltaria::Types::ClientAccountResponse]
|
|
145
|
+
def get_client_account(request_options: {}, **params)
|
|
146
|
+
params = Voltaria::Internal::Types::Utils.normalize_keys(params)
|
|
147
|
+
request = Voltaria::Internal::JSON::Request.new(
|
|
148
|
+
base_url: request_options[:base_url],
|
|
149
|
+
method: "GET",
|
|
150
|
+
path: "v2/clients/#{URI.encode_uri_component(params[:client_id].to_s)}/accounts/#{URI.encode_uri_component(params[:account_id].to_s)}",
|
|
151
|
+
request_options: request_options
|
|
152
|
+
)
|
|
153
|
+
begin
|
|
154
|
+
response = @client.send(request)
|
|
155
|
+
rescue Net::HTTPRequestTimeout
|
|
156
|
+
raise Voltaria::Errors::TimeoutError
|
|
157
|
+
end
|
|
158
|
+
code = response.code.to_i
|
|
159
|
+
if code.between?(200, 299)
|
|
160
|
+
Voltaria::Types::ClientAccountResponse.load(response.body)
|
|
161
|
+
else
|
|
162
|
+
error_class = Voltaria::Errors::ResponseError.subclass_for_code(code)
|
|
163
|
+
raise error_class.new(response.body, code: code)
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Voltaria
|
|
4
|
+
module Accounts
|
|
5
|
+
module Types
|
|
6
|
+
class GetClientAccountRequest < Internal::Types::Model
|
|
7
|
+
field :client_id, -> { String }, optional: false, nullable: false
|
|
8
|
+
field :account_id, -> { String }, optional: false, nullable: false
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Voltaria
|
|
4
|
+
module Accounts
|
|
5
|
+
module Types
|
|
6
|
+
class ListClientAccountsRequest < Internal::Types::Model
|
|
7
|
+
field :client_id, -> { String }, optional: false, nullable: false
|
|
8
|
+
field :page, -> { Integer }, optional: true, nullable: false
|
|
9
|
+
field :page_size, -> { Integer }, optional: true, nullable: false
|
|
10
|
+
field :order_by, -> { String }, optional: true, nullable: false
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Voltaria
|
|
4
|
+
module Accounts
|
|
5
|
+
module Types
|
|
6
|
+
class PartnerClientAccountCreateRequest < Internal::Types::Model
|
|
7
|
+
field :client_id, -> { String }, optional: false, nullable: false
|
|
8
|
+
field :account_holder_name, -> { String }, optional: false, nullable: false
|
|
9
|
+
field :label, -> { String }, optional: true, nullable: false
|
|
10
|
+
field :account_holder_type, -> { Voltaria::Types::AccountHolderTypeEnum }, optional: false, nullable: false
|
|
11
|
+
field :currency, -> { Voltaria::Types::CurrencyEnum }, optional: false, nullable: false
|
|
12
|
+
field :sort_code, -> { String }, optional: true, nullable: false
|
|
13
|
+
field :account_number, -> { String }, optional: true, nullable: false
|
|
14
|
+
field :iban, -> { String }, optional: true, nullable: false
|
|
15
|
+
field :bic, -> { String }, optional: true, nullable: false
|
|
16
|
+
field :routing_number, -> { String }, optional: true, nullable: false
|
|
17
|
+
field :account_type, -> { String }, optional: true, nullable: false
|
|
18
|
+
field :address, -> { Voltaria::Types::AccountAddress }, optional: true, nullable: false
|
|
19
|
+
field :status, -> { Voltaria::Accounts::Types::PartnerClientAccountCreateRequestStatus }, optional: true, nullable: false
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Voltaria
|
|
4
|
+
class Client
|
|
5
|
+
# @param base_url [String, nil]
|
|
6
|
+
# @param token [String]
|
|
7
|
+
#
|
|
8
|
+
# @return [void]
|
|
9
|
+
def initialize(token:, base_url: nil)
|
|
10
|
+
@raw_client = Voltaria::Internal::Http::RawClient.new(
|
|
11
|
+
base_url: base_url || Voltaria::Environment::SANDBOX,
|
|
12
|
+
headers: {
|
|
13
|
+
"X-Fern-Language" => "Ruby",
|
|
14
|
+
Authorization: "Bearer #{token}"
|
|
15
|
+
}
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# @return [Voltaria::Clients::Client]
|
|
20
|
+
def clients
|
|
21
|
+
@clients ||= Voltaria::Clients::Client.new(client: @raw_client)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# @return [Voltaria::Sandbox::Client]
|
|
25
|
+
def sandbox
|
|
26
|
+
@sandbox ||= Voltaria::Sandbox::Client.new(client: @raw_client)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# @return [Voltaria::Accounts::Client]
|
|
30
|
+
def accounts
|
|
31
|
+
@accounts ||= Voltaria::Accounts::Client.new(client: @raw_client)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# @return [Voltaria::Documents::Client]
|
|
35
|
+
def documents
|
|
36
|
+
@documents ||= Voltaria::Documents::Client.new(client: @raw_client)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# @return [Voltaria::Investors::Client]
|
|
40
|
+
def investors
|
|
41
|
+
@investors ||= Voltaria::Investors::Client.new(client: @raw_client)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# @return [Voltaria::Installments::Client]
|
|
45
|
+
def installments
|
|
46
|
+
@installments ||= Voltaria::Installments::Client.new(client: @raw_client)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# @return [Voltaria::Loans::Client]
|
|
50
|
+
def loans
|
|
51
|
+
@loans ||= Voltaria::Loans::Client.new(client: @raw_client)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# @return [Voltaria::Partners::Client]
|
|
55
|
+
def partners
|
|
56
|
+
@partners ||= Voltaria::Partners::Client.new(client: @raw_client)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# @return [Voltaria::Webhooks::Client]
|
|
60
|
+
def webhooks
|
|
61
|
+
@webhooks ||= Voltaria::Webhooks::Client.new(client: @raw_client)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# @return [Voltaria::Repayments::Client]
|
|
65
|
+
def repayments
|
|
66
|
+
@repayments ||= Voltaria::Repayments::Client.new(client: @raw_client)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# @return [Voltaria::Drawdowns::Client]
|
|
70
|
+
def drawdowns
|
|
71
|
+
@drawdowns ||= Voltaria::Drawdowns::Client.new(client: @raw_client)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|