straddle 1.0.0 → 1.1.0
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 +4 -4
- data/CHANGELOG.md +65 -0
- data/README.md +84 -89
- data/SKILL.md +4 -2
- data/api.md +26 -26
- data/lib/straddle/client.rb +24 -7
- data/lib/straddle/errors.rb +40 -0
- data/lib/straddle/file_part.rb +13 -1
- data/lib/straddle/internal/transport/base_client.rb +186 -42
- data/lib/straddle/internal/transport/connection_pool.rb +160 -0
- data/lib/straddle/internal/transport/pooled_net_requester.rb +77 -10
- data/lib/straddle/internal/type/base_model.rb +69 -18
- data/lib/straddle/internal/type/base_page.rb +14 -0
- data/lib/straddle/internal/type/boolean.rb +3 -1
- data/lib/straddle/internal/type/converter.rb +13 -3
- data/lib/straddle/internal/type/enum.rb +9 -4
- data/lib/straddle/internal/type/file_input.rb +8 -2
- data/lib/straddle/internal/type/hash_of.rb +3 -1
- data/lib/straddle/internal/type/union.rb +21 -7
- data/lib/straddle/internal/type/unknown.rb +3 -1
- data/lib/straddle/internal/util.rb +273 -15
- data/lib/straddle/internal/webhook_verifier.rb +240 -0
- data/lib/straddle/internal.rb +5 -1
- data/lib/straddle/models/capability_request_create_params.rb +18 -18
- data/lib/straddle/models/paykey.rb +3 -2
- data/lib/straddle/models/paykey_created_v1_webhook_event.rb +7 -2
- data/lib/straddle/models/paykey_event_v1_webhook_event.rb +7 -2
- data/lib/straddle/models/payout.rb +14 -14
- data/lib/straddle/models/unmasked_payout.rb +14 -14
- data/lib/straddle/models/webhook_unwrap_params.rb +2 -0
- data/lib/straddle/models.rb +30 -31
- data/lib/straddle/request_options.rb +13 -5
- data/lib/straddle/resources/accounts.rb +11 -12
- data/lib/straddle/resources/bridge.rb +8 -4
- data/lib/straddle/resources/capability_requests.rb +4 -5
- data/lib/straddle/resources/charges.rb +18 -15
- data/lib/straddle/resources/customers/review.rb +5 -6
- data/lib/straddle/resources/customers.rb +34 -35
- data/lib/straddle/resources/funding_events.rb +20 -20
- data/lib/straddle/resources/linked_bank_accounts.rb +9 -11
- data/lib/straddle/resources/organizations.rb +6 -6
- data/lib/straddle/resources/paykeys/review.rb +5 -6
- data/lib/straddle/resources/paykeys.rb +34 -39
- data/lib/straddle/resources/payments.rb +8 -7
- data/lib/straddle/resources/payouts.rb +18 -15
- data/lib/straddle/resources/representatives.rb +7 -6
- data/lib/straddle/resources/webhooks.rb +63 -6
- data/lib/straddle/version.rb +1 -1
- data/lib/straddle.rb +5 -6
- data/rbi/straddle/client.rbi +13 -0
- data/rbi/straddle/errors.rbi +25 -27
- data/rbi/straddle/internal/transport/base_client.rbi +45 -54
- data/rbi/straddle/internal/transport/connection_pool.rbi +44 -0
- data/rbi/straddle/internal/transport/pooled_net_requester.rbi +15 -16
- data/rbi/straddle/internal/type/base_model.rbi +24 -38
- data/rbi/straddle/internal/type/base_page.rbi +5 -0
- data/rbi/straddle/internal/type/converter.rbi +9 -42
- data/rbi/straddle/internal/type/enum.rbi +1 -5
- data/rbi/straddle/internal/type/request_parameters.rbi +1 -3
- data/rbi/straddle/internal/type/union.rbi +2 -11
- data/rbi/straddle/internal/util.rbi +101 -115
- data/rbi/straddle/internal/webhook_verifier.rbi +86 -0
- data/rbi/straddle/internal.rbi +1 -2
- data/rbi/straddle/models/capability_request_create_params.rbi +18 -18
- data/rbi/straddle/models/paykey.rbi +4 -2
- data/rbi/straddle/models/paykey_created_v1_webhook_event.rbi +6 -2
- data/rbi/straddle/models/paykey_event_v1_webhook_event.rbi +6 -2
- data/rbi/straddle/models/payout.rbi +18 -18
- data/rbi/straddle/models/unmasked_payout.rbi +18 -18
- data/rbi/straddle/models/webhook_unwrap_params.rbi +2 -0
- data/rbi/straddle/models.rbi +2 -0
- data/rbi/straddle/request_options.rbi +4 -10
- data/rbi/straddle/resources/accounts.rbi +2 -1
- data/rbi/straddle/resources/bridge.rbi +8 -4
- data/rbi/straddle/resources/charges.rbi +4 -2
- data/rbi/straddle/resources/customers.rbi +7 -3
- data/rbi/straddle/resources/funding_events.rbi +5 -2
- data/rbi/straddle/resources/organizations.rbi +2 -1
- data/rbi/straddle/resources/paykeys.rbi +2 -1
- data/rbi/straddle/resources/payments.rbi +3 -1
- data/rbi/straddle/resources/payouts.rbi +4 -2
- data/rbi/straddle/resources/representatives.rbi +3 -1
- data/rbi/straddle/resources/webhooks.rbi +107 -2
- data/sig/straddle/client.rbs +4 -0
- data/sig/straddle/errors.rbs +13 -0
- data/sig/straddle/internal/transport/base_client.rbs +19 -1
- data/sig/straddle/internal/transport/connection_pool.rbs +19 -0
- data/sig/straddle/internal/transport/pooled_net_requester.rbs +11 -1
- data/sig/straddle/internal/type/base_model.rbs +4 -0
- data/sig/straddle/internal/type/base_page.rbs +2 -0
- data/sig/straddle/internal/util.rbs +29 -1
- data/sig/straddle/internal/webhook_verifier.rbs +53 -0
- data/sig/straddle/models/capability_request_create_params.rbs +24 -24
- data/sig/straddle/models/payout.rbs +12 -12
- data/sig/straddle/models/unmasked_payout.rbs +12 -12
- data/sig/straddle/models/webhook_unwrap_params.rbs +4 -0
- data/sig/straddle/models.rbs +2 -0
- data/sig/straddle/resources/webhooks.rbs +59 -1
- metadata +12 -60
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 49abc41ebdbc39dc0f988c7ec00558822314094a0646e2c95ff1fb2c3b732c6f
|
|
4
|
+
data.tar.gz: de9f810d86c62037878e982e90487c17f78a246986aa80ef247dc85d15f912c3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 92016778a4dbedcd3e49ef6c3c417cc58f683023e8cbfa84c530d0118133625f7de48434ccf9953503235517ec9e1a532abfd01f2e7803286018bd1f4d1a4dbf
|
|
7
|
+
data.tar.gz: 49aca88e185a4352e4d9e8e6d4bab696f98034e7b9cd4b99979223d262a7eb6861ac6f81697b3b37b468b8e84a05137023f425f0e384f280ad0dbff7bfadb2a3
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,70 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.1.0](https://github.com/straddle-build/straddle-ruby/compare/v1.0.4...v1.1.0) (2026-12-01)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **api:** add types-classes `(top-level):WebhookParsedParams` ([d37998b](https://github.com/straddle-build/straddle-ruby/commit/d37998b82801525fea56f3c478ba41b19ac5b1e3))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **Client:** [EG-1003] send a valid User-Agent ([f49a1cf](https://github.com/straddle-build/straddle-ruby/commit/f49a1cf57846c7305b22b821667356de6e1d3450))
|
|
14
|
+
* **Client:** [EG-1003] send a valid User-Agent ([9c3d427](https://github.com/straddle-build/straddle-ruby/commit/9c3d427524917bfce8e05d4c58f32c9468f74d23))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Chores
|
|
18
|
+
|
|
19
|
+
* temporarily align conflicting files for Scalar 0.47.0 / API 1.0.6 regeneration ([4c4f3bc](https://github.com/straddle-build/straddle-ruby/commit/4c4f3bc705e0e6dc67afc89693f923d4f73480f0))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Documentation
|
|
23
|
+
|
|
24
|
+
* refresh Ruby SDK quickstart and examples ([#4](https://github.com/straddle-build/straddle-ruby/issues/4)) ([ea6875a](https://github.com/straddle-build/straddle-ruby/commit/ea6875a7413774b108ad2d092d740b95a8e142d8))
|
|
25
|
+
* restore Ruby README quickstart after 1.0.6 sync ([5e6629b](https://github.com/straddle-build/straddle-ruby/commit/5e6629bbd99e8bb5523c4ac737a15742c0949bdf))
|
|
26
|
+
|
|
27
|
+
## [1.0.4](https://github.com/straddle-build/straddle-ruby/compare/v1.0.0...v1.0.4) (2026-09-13)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### ⚠ BREAKING CHANGES
|
|
31
|
+
|
|
32
|
+
* **api:** 16 breaking changes to the SDK surface.
|
|
33
|
+
- Response content type of `bridge.createBankAccountPaykey` changed from `text/plain` to `application/json`.
|
|
34
|
+
- `400` error response of `bridge.createBankAccountPaykey` changed from `error_response` to `error_response`.
|
|
35
|
+
- Response content type of `customers.create` changed from `text/plain` to `application/json`.
|
|
36
|
+
- `400` error response of `customers.create` changed from `error_response` to `error_response`.
|
|
37
|
+
- Response content type of `charges.create` changed from `text/plain` to `application/json`.
|
|
38
|
+
- `400` error response of `charges.create` changed from `error_response` to `error_response`.
|
|
39
|
+
- Response content type of `payouts.create` changed from `text/plain` to `application/json`.
|
|
40
|
+
- `400` error response of `payouts.create` changed from `error_response` to `error_response`.
|
|
41
|
+
- Property `payout.created_at` is now required.
|
|
42
|
+
- Property `payout.created_at` type changed from `string<date-time> | null` to `string<date-time>`.
|
|
43
|
+
- Property `payout.updated_at` is now required.
|
|
44
|
+
- Property `payout.updated_at` type changed from `string<date-time> | null` to `string<date-time>`.
|
|
45
|
+
- Property `unmasked_payout.created_at` is now required.
|
|
46
|
+
- Property `unmasked_payout.created_at` type changed from `string<date-time> | null` to `string<date-time>`.
|
|
47
|
+
- Property `unmasked_payout.updated_at` is now required.
|
|
48
|
+
- Property `unmasked_payout.updated_at` type changed from `string<date-time> | null` to `string<date-time>`.
|
|
49
|
+
* **api:** 4 breaking changes to the SDK surface.
|
|
50
|
+
- Property `embed_error_response.data` type changed from `unknown | null` to `unknown`.
|
|
51
|
+
- Schema `customer_address` shape changed.
|
|
52
|
+
- Schema `unmasked_compliance_profile` shape changed.
|
|
53
|
+
- Schema `compliance_profile` shape changed.
|
|
54
|
+
|
|
55
|
+
### Features
|
|
56
|
+
|
|
57
|
+
* **api:** update property embed_error_response.data (+3 more changes) ([5831731](https://github.com/straddle-build/straddle-ruby/commit/58317314c523b64a34c612b42865ca6f1a280273))
|
|
58
|
+
* **api:** update SDK surface (17 changes) ([240b1ad](https://github.com/straddle-build/straddle-ruby/commit/240b1adb0d63f7970583a176f74edfd59ac32b9c))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
### Chores
|
|
62
|
+
|
|
63
|
+
* release 1.0.3 ([b66c899](https://github.com/straddle-build/straddle-ruby/commit/b66c899c3526406bc2c2aac0971005414c93e1f4))
|
|
64
|
+
* release 1.0.3 ([79f8e16](https://github.com/straddle-build/straddle-ruby/commit/79f8e164d9230f65874ac8b2c270899f76a0e184))
|
|
65
|
+
* release 1.0.4 ([da97155](https://github.com/straddle-build/straddle-ruby/commit/da97155f00da180a14f6f2ac3d73434a477c0a31))
|
|
66
|
+
* release 1.0.4 ([541ab1e](https://github.com/straddle-build/straddle-ruby/commit/541ab1ee99434518fc7ba6d303a7398c44d52dd6))
|
|
67
|
+
|
|
3
68
|
## [1.0.0](https://github.com/straddle-build/straddle-ruby/compare/v0.1.0...v1.0.0) (2026-09-02)
|
|
4
69
|
|
|
5
70
|
|
data/README.md
CHANGED
|
@@ -1,148 +1,143 @@
|
|
|
1
|
-
# Straddle
|
|
1
|
+
# Straddle Ruby SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Use Straddle's Pay by Bank and Embed APIs from Ruby. The SDK provides typed models, authentication, retries, and request configuration.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Use Ruby 3.2 or later. Add the gem to your application's `Gemfile`:
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
- [Usage](#usage)
|
|
13
|
-
- [API Reference](./api.md)
|
|
14
|
-
- [Authentication](#authentication)
|
|
15
|
-
- [Errors](#errors)
|
|
16
|
-
- [Client Options](#client-options)
|
|
17
|
-
- [Request Options](#request-options)
|
|
18
|
-
- [Retries and Timeouts](#retries-and-timeouts)
|
|
19
|
-
- [Helpers](#helpers)
|
|
20
|
-
- [Requirements](#requirements)
|
|
21
|
-
|
|
22
|
-
<br />
|
|
23
|
-
|
|
24
|
-
## Installation
|
|
9
|
+
```ruby
|
|
10
|
+
gem "straddle", "~> 1.1.0" # x-release-please-version
|
|
11
|
+
```
|
|
25
12
|
|
|
26
|
-
|
|
13
|
+
Install your bundle:
|
|
27
14
|
|
|
28
|
-
```
|
|
29
|
-
|
|
15
|
+
```sh
|
|
16
|
+
bundle install
|
|
30
17
|
```
|
|
31
18
|
|
|
32
|
-
|
|
19
|
+
For a standalone script, install the gem directly:
|
|
33
20
|
|
|
34
21
|
```sh
|
|
35
22
|
gem install straddle
|
|
36
23
|
```
|
|
37
24
|
|
|
38
|
-
|
|
25
|
+
The RubyGems package is [`straddle`](https://rubygems.org/gems/straddle). Its source lives in `straddle-build/straddle-ruby`.
|
|
39
26
|
|
|
40
|
-
##
|
|
27
|
+
## Make your first request
|
|
28
|
+
|
|
29
|
+
Create a sandbox API key in the [Straddle Dashboard](https://dashboard.straddle.com), then set it in your environment. See [API authentication](https://docs.straddle.com/api-reference/authentication) for the setup steps.
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
export STRADDLE_API_KEY="YOUR_SANDBOX_API_KEY"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Save the following example as `quickstart.rb`. It requests the first page of customers from the sandbox:
|
|
41
36
|
|
|
42
37
|
```ruby
|
|
43
38
|
require "straddle"
|
|
44
39
|
|
|
45
40
|
client = Straddle::Client.new(
|
|
46
|
-
bearer: ENV
|
|
41
|
+
bearer: ENV.fetch("STRADDLE_API_KEY"),
|
|
42
|
+
base_url: "https://sandbox.straddle.com"
|
|
47
43
|
)
|
|
48
44
|
|
|
49
|
-
|
|
45
|
+
page = client.customers.list(page_number: 1, page_size: 10)
|
|
46
|
+
puts "Customers on this page: #{page.data.length}"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
For a SaaS platform key, add `straddle_account_id: "YOUR_EMBEDDED_ACCOUNT_ID"` to the `list` arguments before running the example. This selects the embedded account whose customers you want to read. Direct accounts and marketplaces list customers without that header. See [platform account scoping](https://docs.straddle.com/guides/embed/api-headers).
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
Run the example from your application:
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
bundle exec ruby quickstart.rb
|
|
52
55
|
```
|
|
53
56
|
|
|
54
|
-
|
|
57
|
+
If you installed the gem directly, use `ruby quickstart.rb`.
|
|
55
58
|
|
|
56
|
-
|
|
59
|
+
A successful request prints the number of customers on the page. `Customers on this page: 0` is valid for an empty account. Customer records are in `page.data`; pagination and request metadata are in `page.meta`.
|
|
57
60
|
|
|
58
|
-
|
|
61
|
+
The remaining examples use this `client`.
|
|
59
62
|
|
|
60
|
-
##
|
|
63
|
+
## Configure authentication and environments
|
|
61
64
|
|
|
62
|
-
|
|
65
|
+
The example passes `STRADDLE_API_KEY` explicitly as `bearer`. If you omit `bearer`, the client reads `BEARER`.
|
|
63
66
|
|
|
64
|
-
|
|
65
|
-
| --- | --- | --- | --- |
|
|
66
|
-
| `bearer` | `String \| nil` | - | Send the API key as a bearer token in the `Authorization` header. Defaults to BEARER. |
|
|
67
|
+
Set `base_url` explicitly to select an environment. If you omit it, the client reads `STRADDLE_BASE_URL`, then defaults to `https://sandbox.straddle.com`. Production uses `https://production.straddle.com` and a production API key. See [environments](https://docs.straddle.com/api-reference/environments).
|
|
67
68
|
|
|
68
|
-
|
|
69
|
+
## Read additional pages
|
|
69
70
|
|
|
70
|
-
|
|
71
|
+
List methods return one response page. Choose the next `page_number` using `page.meta.total_pages`, and keep your filters and account scope the same between requests:
|
|
71
72
|
|
|
72
|
-
|
|
73
|
+
```ruby
|
|
74
|
+
next_page = client.customers.list(page_number: 2, page_size: 10)
|
|
75
|
+
```
|
|
73
76
|
|
|
74
|
-
|
|
77
|
+
Models expose response fields as attributes. Methods accept a plain hash or the corresponding parameter model. The gem also includes Sorbet `.rbi` and Steep `.rbs` signatures. See the [method reference](./api.md) for filters and response types.
|
|
75
78
|
|
|
76
|
-
|
|
79
|
+
## Handle errors
|
|
80
|
+
|
|
81
|
+
Catch `Straddle::Errors::APIError` to inspect the status, headers, and body of a failed request. Connection errors also inherit from this class and have no HTTP status.
|
|
77
82
|
|
|
78
83
|
```ruby
|
|
79
84
|
begin
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
puts response.inspect
|
|
85
|
+
page = client.customers.list(page_size: 10)
|
|
83
86
|
rescue Straddle::Errors::APIError => error
|
|
84
|
-
|
|
87
|
+
warn "#{error.status}: #{error.message}"
|
|
85
88
|
raise
|
|
86
89
|
end
|
|
87
90
|
```
|
|
88
91
|
|
|
89
|
-
|
|
92
|
+
For a `401`, check that the key matches the selected environment. For a `403`, check the key's permissions and account scope. See [API errors](https://docs.straddle.com/api-reference/errors) for response details.
|
|
90
93
|
|
|
91
|
-
|
|
94
|
+
## Set retries and timeouts
|
|
92
95
|
|
|
93
|
-
|
|
96
|
+
The client retries connection errors, `408`, `409`, `429`, and `5xx` responses twice by default. It uses exponential backoff and honors supported `Retry-After` values. The default timeout is 60 seconds; retries can extend the total request duration.
|
|
94
97
|
|
|
95
|
-
|
|
98
|
+
Set `max_retries` and `timeout` in the constructor, or pass `request_options` for an individual request:
|
|
96
99
|
|
|
97
100
|
```ruby
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
timeout: 60.0,
|
|
102
|
-
max_retries: 2,
|
|
101
|
+
page = client.customers.list(
|
|
102
|
+
page_size: 10,
|
|
103
|
+
request_options: {max_retries: 0, timeout: 30.0}
|
|
103
104
|
)
|
|
104
105
|
```
|
|
105
106
|
|
|
106
|
-
|
|
107
|
-
| --- | --- | --- | --- |
|
|
108
|
-
| `bearer` | `String \| nil` | `ENV["BEARER"]` | Send the API key as a bearer token in the `Authorization` header. |
|
|
109
|
-
| `webhook_secret` | `String \| nil` | `ENV["STRADDLE_WEBHOOK_SECRET"]` | Secret used to verify incoming webhook signatures. |
|
|
110
|
-
| `base_url` | `String \| nil` | `ENV["STRADDLE_BASE_URL"]` | Override the default API base URL. |
|
|
111
|
-
| `max_retries` | `Integer` | `2` | Max number of retries to attempt after a failed retryable request. |
|
|
112
|
-
| `timeout` | `Float` | `60.0` | Seconds to wait for a response before timing out. |
|
|
113
|
-
| `initial_retry_delay` | `Float` | `0.5` | Seconds to wait before the first retry; later retries back off exponentially. |
|
|
114
|
-
| `max_retry_delay` | `Float` | `8.0` | Upper bound, in seconds, on the delay between retries. |
|
|
115
|
-
|
|
116
|
-
<br />
|
|
117
|
-
|
|
118
|
-
## Request Options
|
|
119
|
-
|
|
120
|
-
| Option | Type | Default | Description |
|
|
121
|
-
| --- | --- | --- | --- |
|
|
122
|
-
| `idempotency_key` | `String` | - | Idempotency key for one request, sent when the SDK configures an idempotency header. |
|
|
123
|
-
| `extra_query` | `Hash` | - | Additional query parameters for one request. |
|
|
124
|
-
| `extra_headers` | `Hash` | - | Additional headers for one request. |
|
|
125
|
-
| `extra_body` | `Hash` | - | Additional body fields for one request. |
|
|
126
|
-
| `max_retries` | `Integer` | - | Override retry count for one request. |
|
|
127
|
-
| `timeout` | `Float` | - | Override timeout for one request. |
|
|
128
|
-
|
|
129
|
-
<br />
|
|
107
|
+
For write operations that accept an idempotency key, pass the operation's `idempotency_key` argument. Reuse that value when retrying the same operation. See [idempotency](https://docs.straddle.com/api-reference/idempotency).
|
|
130
108
|
|
|
131
|
-
##
|
|
109
|
+
## Client and request options
|
|
132
110
|
|
|
133
|
-
|
|
111
|
+
Set these options in the client constructor.
|
|
134
112
|
|
|
135
|
-
|
|
113
|
+
| Option | Purpose | Default |
|
|
114
|
+
| --- | --- | --- |
|
|
115
|
+
| `bearer` | API key | `BEARER` |
|
|
116
|
+
| `base_url` | API base URL | `STRADDLE_BASE_URL`, then sandbox |
|
|
117
|
+
| `webhook_secret` | Secret for webhook signature verification | `STRADDLE_WEBHOOK_SECRET` |
|
|
118
|
+
| `max_retries` | Retry count | `2` |
|
|
119
|
+
| `timeout` | Timeout in seconds | `60.0` |
|
|
120
|
+
| `initial_retry_delay` | Initial retry delay in seconds | `0.5` |
|
|
121
|
+
| `max_retry_delay` | Maximum backoff delay in seconds | `8.0` |
|
|
136
122
|
|
|
137
|
-
|
|
123
|
+
Pass these values inside a method's `request_options` hash.
|
|
138
124
|
|
|
139
|
-
|
|
140
|
-
|
|
125
|
+
| Option | Purpose |
|
|
126
|
+
| --- | --- |
|
|
127
|
+
| `extra_query` | Add query parameters |
|
|
128
|
+
| `extra_headers` | Add headers |
|
|
129
|
+
| `extra_body` | Add body fields |
|
|
130
|
+
| `max_retries` | Override the retry count |
|
|
131
|
+
| `timeout` | Override the timeout in seconds |
|
|
141
132
|
|
|
142
|
-
|
|
133
|
+
## Reference and support
|
|
143
134
|
|
|
144
|
-
|
|
135
|
+
Use the following resources as you build your integration:
|
|
145
136
|
|
|
146
|
-
-
|
|
137
|
+
- [SDK method reference](./api.md) and [operation signatures](./reference.md).
|
|
138
|
+
- [Straddle guides](https://docs.straddle.com): payment flows, sandbox testing, and API concepts.
|
|
139
|
+
- [GitHub issues](https://github.com/straddle-build/straddle-ruby/issues): SDK bugs and feature requests.
|
|
140
|
+
- [Local development](./CONTRIBUTING.md) and [versioning](./VERSIONING.md): submit customizations against `scalar-next` so Scalar carries them through regeneration.
|
|
141
|
+
- [Security policy](./SECURITY.md) and [Apache 2.0 license](./LICENSE).
|
|
147
142
|
|
|
148
|
-
|
|
143
|
+
Straddle generates this SDK with Scalar and maintains repository customizations through the workflow in `VERSIONING.md`.
|
data/SKILL.md
CHANGED
|
@@ -12,7 +12,7 @@ Generated Ruby client for Straddle API, published as `straddle`. Use the generat
|
|
|
12
12
|
Add the gem to your application's `Gemfile`:
|
|
13
13
|
|
|
14
14
|
```ruby
|
|
15
|
-
gem "straddle", "~> 1.
|
|
15
|
+
gem "straddle", "~> 1.1.0" # x-release-please-version
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
Or install it directly:
|
|
@@ -62,6 +62,8 @@ begin
|
|
|
62
62
|
puts response.inspect
|
|
63
63
|
rescue Straddle::Errors::APIError => error
|
|
64
64
|
puts "#{error.status}: #{error.message}"
|
|
65
|
+
puts error.request_id if error.request_id
|
|
66
|
+
puts error.problem_details if error.problem_details
|
|
65
67
|
raise
|
|
66
68
|
end
|
|
67
69
|
```
|
|
@@ -72,5 +74,5 @@ end
|
|
|
72
74
|
|
|
73
75
|
## Reference files
|
|
74
76
|
|
|
75
|
-
- [README.md](./README.md) — full feature tour: client options, request options, retries and timeouts.
|
|
77
|
+
- [README.md](./README.md) — full feature tour: client options, request options, retries and timeouts, webhooks, file uploads, enums, undocumented requests.
|
|
76
78
|
- [api.md](./api.md) — complete catalogue of every operation with request and response types.
|
data/api.md
CHANGED
|
@@ -106,7 +106,7 @@ Accounts represent businesses that use Straddle through a platform.
|
|
|
106
106
|
|
|
107
107
|
### Get an account
|
|
108
108
|
|
|
109
|
-
Returns the account with the specified
|
|
109
|
+
Returns the account with the specified `account_id`. Includes the account's status, business profile, capabilities, settings, and access level.
|
|
110
110
|
|
|
111
111
|
| Direction | Type |
|
|
112
112
|
| --- | --- |
|
|
@@ -129,7 +129,7 @@ Updates an account's business profile, metadata, and external ID, then returns t
|
|
|
129
129
|
| Response | [`AccountResponse`](././lib/straddle/models/account_response.rb) |
|
|
130
130
|
|
|
131
131
|
```ruby
|
|
132
|
-
response = client.accounts.update("7c9e6679-7425-40de-944b-e07fc1f90ae7", { business_profile:
|
|
132
|
+
response = client.accounts.update("7c9e6679-7425-40de-944b-e07fc1f90ae7", { business_profile: { "name" => "", "website" => "https://example.com" }, external_id: "", metadata: { } })
|
|
133
133
|
|
|
134
134
|
puts response.inspect
|
|
135
135
|
```
|
|
@@ -144,7 +144,7 @@ Creates a business account in the specified organization and returns the account
|
|
|
144
144
|
| Response | [`AccountResponse`](././lib/straddle/models/account_response.rb) |
|
|
145
145
|
|
|
146
146
|
```ruby
|
|
147
|
-
response = client.accounts.create({ access_level: "standard", account_type: "business", business_profile:
|
|
147
|
+
response = client.accounts.create({ access_level: "standard", account_type: "business", business_profile: { "name" => "", "website" => "https://example.com" }, organization_id: "7c9e6679-7425-40de-944b-e07fc1f90ae7", external_id: "", metadata: { } })
|
|
148
148
|
|
|
149
149
|
puts response.inspect
|
|
150
150
|
```
|
|
@@ -242,7 +242,7 @@ Creates a linked bank account for an account or platform, assigns its payment pu
|
|
|
242
242
|
| Response | [`LinkedBankAccountResponse`](././lib/straddle/models/linked_bank_account_response.rb) |
|
|
243
243
|
|
|
244
244
|
```ruby
|
|
245
|
-
response = client.linked_bank_accounts.create({ bank_account: { "account_holder" => "", "routing_number" => "xxxxxxxxx", "account_number" => "" }, account_id: "7c9e6679-7425-40de-944b-e07fc1f90ae7", description: "", metadata: { }, platform_id: "7c9e6679-7425-40de-944b-e07fc1f90ae7", purposes: [] })
|
|
245
|
+
response = client.linked_bank_accounts.create({ bank_account: { "account_holder" => "", "routing_number" => "xxxxxxxxx", "account_number" => "" }, account_id: "7c9e6679-7425-40de-944b-e07fc1f90ae7", description: "", metadata: { }, platform_id: "7c9e6679-7425-40de-944b-e07fc1f90ae7", purposes: ["charges"] })
|
|
246
246
|
|
|
247
247
|
puts response.inspect
|
|
248
248
|
```
|
|
@@ -358,7 +358,7 @@ puts response.inspect
|
|
|
358
358
|
|
|
359
359
|
### Get an organization
|
|
360
360
|
|
|
361
|
-
Returns the organization with the specified
|
|
361
|
+
Returns the organization with the specified `organization_id`. Includes the organization's name, `external_id`, metadata, and timestamps.
|
|
362
362
|
|
|
363
363
|
| Direction | Type |
|
|
364
364
|
| --- | --- |
|
|
@@ -422,7 +422,7 @@ puts response.inspect
|
|
|
422
422
|
|
|
423
423
|
### Get a representative
|
|
424
424
|
|
|
425
|
-
Returns the representative with the specified
|
|
425
|
+
Returns the representative with the specified `representative_id`. Includes personal details, verification status, and ownership or control relationship flags.
|
|
426
426
|
|
|
427
427
|
| Direction | Type |
|
|
428
428
|
| --- | --- |
|
|
@@ -456,7 +456,7 @@ Bridge connects customer bank accounts and creates paykeys from supported provid
|
|
|
456
456
|
|
|
457
457
|
### Create a paykey from bank account details
|
|
458
458
|
|
|
459
|
-
Creates a paykey from a
|
|
459
|
+
Creates a paykey directly from a customer's `routing_number`, `account_number`, and `account_type`. Returns the new paykey with its status and bank details.
|
|
460
460
|
|
|
461
461
|
| Direction | Type |
|
|
462
462
|
| --- | --- |
|
|
@@ -471,7 +471,7 @@ puts response.inspect
|
|
|
471
471
|
|
|
472
472
|
### Create a paykey from a Plaid token
|
|
473
473
|
|
|
474
|
-
Creates a paykey from a
|
|
474
|
+
Creates a paykey from a customer's `plaid_token`. Returns the created paykey with its status, institution name, and bank details.
|
|
475
475
|
|
|
476
476
|
| Direction | Type |
|
|
477
477
|
| --- | --- |
|
|
@@ -486,7 +486,7 @@ puts response.inspect
|
|
|
486
486
|
|
|
487
487
|
### Create a Bridge widget session token
|
|
488
488
|
|
|
489
|
-
Creates a
|
|
489
|
+
Creates a `bridge_token` for a customer to initialize the Bridge widget. Use this token to connect bank accounts and create paykeys.
|
|
490
490
|
|
|
491
491
|
| Direction | Type |
|
|
492
492
|
| --- | --- |
|
|
@@ -501,7 +501,7 @@ puts response.inspect
|
|
|
501
501
|
|
|
502
502
|
### Create a paykey from a Quiltt token
|
|
503
503
|
|
|
504
|
-
Creates a paykey from a
|
|
504
|
+
Creates a paykey from a customer's `quiltt_token`. Returns the created paykey with its unmasked `paykey` value, status, and bank details.
|
|
505
505
|
|
|
506
506
|
| Direction | Type |
|
|
507
507
|
| --- | --- |
|
|
@@ -520,7 +520,7 @@ Customers are individuals or businesses that send or receive payments through yo
|
|
|
520
520
|
|
|
521
521
|
### Get a customer
|
|
522
522
|
|
|
523
|
-
Returns a customer by `id`.
|
|
523
|
+
Returns a customer by its unique `id`. Includes the customer's profile, verification status, compliance profile, and metadata.
|
|
524
524
|
|
|
525
525
|
| Direction | Type |
|
|
526
526
|
| --- | --- |
|
|
@@ -535,7 +535,7 @@ puts response.inspect
|
|
|
535
535
|
|
|
536
536
|
### Update a customer
|
|
537
537
|
|
|
538
|
-
Updates an existing customer's profile, status, and metadata.
|
|
538
|
+
Updates an existing customer's profile, status, compliance profile, and metadata. Returns the updated customer record.
|
|
539
539
|
|
|
540
540
|
| Direction | Type |
|
|
541
541
|
| --- | --- |
|
|
@@ -543,7 +543,7 @@ Updates an existing customer's profile, status, and metadata.
|
|
|
543
543
|
| Response | [`CustomerResponse`](././lib/straddle/models/customer_response.rb) |
|
|
544
544
|
|
|
545
545
|
```ruby
|
|
546
|
-
response = client.customers.update("7c9e6679-7425-40de-944b-e07fc1f90ae7", { device: { "ip_address" => "192.168.1.1" }, email: "user@example.com", name: "", phone: "", status: "verified", address: { "address1" => "123 Main St", "city" => "Anytown", "state" => "CA", "zip" => "12345" }, compliance_profile:
|
|
546
|
+
response = client.customers.update("7c9e6679-7425-40de-944b-e07fc1f90ae7", { device: { "ip_address" => "192.168.1.1" }, email: "user@example.com", name: "", phone: "", status: "verified", address: { "address1" => "123 Main St", "city" => "Anytown", "state" => "CA", "zip" => "12345" }, compliance_profile: { "ssn" => "123-45-6789", "dob" => "1969-04-20" }, external_id: "", metadata: { } })
|
|
547
547
|
|
|
548
548
|
puts response.inspect
|
|
549
549
|
```
|
|
@@ -580,7 +580,7 @@ puts response.inspect
|
|
|
580
580
|
|
|
581
581
|
### Create a customer
|
|
582
582
|
|
|
583
|
-
Creates a customer and starts identity, fraud, and risk assessments.
|
|
583
|
+
Creates a customer record and starts identity, fraud, and risk assessments. Returns the created customer with its status, profile details, compliance profile, and configuration.
|
|
584
584
|
|
|
585
585
|
| Direction | Type |
|
|
586
586
|
| --- | --- |
|
|
@@ -588,7 +588,7 @@ Creates a customer and starts identity, fraud, and risk assessments.
|
|
|
588
588
|
| Response | [`CustomerResponse`](././lib/straddle/models/customer_response.rb) |
|
|
589
589
|
|
|
590
590
|
```ruby
|
|
591
|
-
response = client.customers.create({ device: { "ip_address" => "192.168.1.1" }, email: "ron.swanson@pawnee.com", name: "Ron Swanson", phone: "+12128675309", type: "individual", address: { "address1" => "123 Main St", "city" => "Anytown", "state" => "CA", "zip" => "
|
|
591
|
+
response = client.customers.create({ device: { "ip_address" => "192.168.1.1" }, email: "ron.swanson@pawnee.com", name: "Ron Swanson", phone: "+12128675309", type: "individual", address: { "address1" => "123 Main St", "city" => "Anytown", "state" => "CA", "zip" => "12345" }, compliance_profile: { "ssn" => "123-45-6789", "dob" => "1969-04-20" }, config: { }, external_id: "customer_123", metadata: { } })
|
|
592
592
|
|
|
593
593
|
puts response.inspect
|
|
594
594
|
```
|
|
@@ -723,7 +723,7 @@ puts response.inspect
|
|
|
723
723
|
|
|
724
724
|
### Cancel a paykey
|
|
725
725
|
|
|
726
|
-
Cancels a paykey so it cannot be used for new payments.
|
|
726
|
+
Cancels a paykey by `id` so it cannot be used for new payments. Accepts an optional cancellation `reason` and returns the updated paykey.
|
|
727
727
|
|
|
728
728
|
| Direction | Type |
|
|
729
729
|
| --- | --- |
|
|
@@ -821,7 +821,7 @@ Charges debit a customer's bank account through a paykey.
|
|
|
821
821
|
|
|
822
822
|
### Get a charge
|
|
823
823
|
|
|
824
|
-
Returns a charge by its unique
|
|
824
|
+
Returns a charge by its unique `id`. Includes payment amount, status history, customer and paykey details, funding IDs, and trace IDs.
|
|
825
825
|
|
|
826
826
|
| Direction | Type |
|
|
827
827
|
| --- | --- |
|
|
@@ -911,7 +911,7 @@ puts response.inspect
|
|
|
911
911
|
|
|
912
912
|
### Get an unmasked charge
|
|
913
913
|
|
|
914
|
-
|
|
914
|
+
Returns a charge by `id` with sensitive fields unmasked, including the full `paykey` value. Includes payment status history, funding IDs, and trace IDs.
|
|
915
915
|
|
|
916
916
|
| Direction | Type |
|
|
917
917
|
| --- | --- |
|
|
@@ -964,7 +964,7 @@ Uploads a proof-of-authorization document for a charge. A later upload adds anot
|
|
|
964
964
|
| Response | [`ChargeResponse`](././lib/straddle/models/charge_response.rb) |
|
|
965
965
|
|
|
966
966
|
```ruby
|
|
967
|
-
response = client.charges.upload_authorization_proof("7c9e6679-7425-40de-944b-e07fc1f90ae7", { file: "" })
|
|
967
|
+
response = client.charges.upload_authorization_proof("7c9e6679-7425-40de-944b-e07fc1f90ae7", { file: "file" })
|
|
968
968
|
|
|
969
969
|
puts response.inspect
|
|
970
970
|
```
|
|
@@ -975,7 +975,7 @@ Funding events group charge and payout activity into transfers between Straddle
|
|
|
975
975
|
|
|
976
976
|
### List funding events
|
|
977
977
|
|
|
978
|
-
Returns a paginated list of funding
|
|
978
|
+
Returns a paginated list of funding event summaries matching the specified filters. Supports filtering by direction, event type, status, trace ID, and creation dates.
|
|
979
979
|
|
|
980
980
|
| Direction | Type |
|
|
981
981
|
| --- | --- |
|
|
@@ -983,7 +983,7 @@ Returns a paginated list of funding events that match the specified filters.
|
|
|
983
983
|
| Response | [`FundingEventSummaryList`](././lib/straddle/models/funding_event_summary_list.rb) |
|
|
984
984
|
|
|
985
985
|
```ruby
|
|
986
|
-
response = client.funding_events.list({ page_number: 1, page_size: 100, sort_order: "asc" })
|
|
986
|
+
response = client.funding_events.list({ page_number: 1, page_size: 100, sort_by: "id", sort_order: "asc" })
|
|
987
987
|
|
|
988
988
|
puts response.inspect
|
|
989
989
|
```
|
|
@@ -1020,7 +1020,7 @@ puts response.inspect
|
|
|
1020
1020
|
|
|
1021
1021
|
### List funding event payments
|
|
1022
1022
|
|
|
1023
|
-
Returns a paginated list of payments included in the funding event.
|
|
1023
|
+
Returns a paginated list of payments included in the specified funding event `id`. Includes each payment's type, status, amounts, and trace IDs.
|
|
1024
1024
|
|
|
1025
1025
|
| Direction | Type |
|
|
1026
1026
|
| --- | --- |
|
|
@@ -1039,7 +1039,7 @@ Payments provide a combined view of charges and payouts.
|
|
|
1039
1039
|
|
|
1040
1040
|
### List payments
|
|
1041
1041
|
|
|
1042
|
-
Returns a
|
|
1042
|
+
Returns a paginated list of charges and payouts matching the specified filters. Supports filtering by payment type, status, customer, paykey, amount range, and dates.
|
|
1043
1043
|
|
|
1044
1044
|
| Direction | Type |
|
|
1045
1045
|
| --- | --- |
|
|
@@ -1058,7 +1058,7 @@ Payouts send money to a customer's bank account through a paykey.
|
|
|
1058
1058
|
|
|
1059
1059
|
### Get a payout
|
|
1060
1060
|
|
|
1061
|
-
Returns a payout by its unique
|
|
1061
|
+
Returns a payout by its unique `id`. Includes payment amount, status history, customer and paykey details, funding IDs, and trace IDs.
|
|
1062
1062
|
|
|
1063
1063
|
| Direction | Type |
|
|
1064
1064
|
| --- | --- |
|
|
@@ -1148,7 +1148,7 @@ puts response.inspect
|
|
|
1148
1148
|
|
|
1149
1149
|
### Get an unmasked payout
|
|
1150
1150
|
|
|
1151
|
-
|
|
1151
|
+
Returns a payout by `id` with sensitive fields unmasked, including the full `paykey` value. Includes payment status history, funding IDs, and trace IDs.
|
|
1152
1152
|
|
|
1153
1153
|
| Direction | Type |
|
|
1154
1154
|
| --- | --- |
|
|
@@ -1186,7 +1186,7 @@ Uploads a proof-of-authorization document for a payout. A later upload adds anot
|
|
|
1186
1186
|
| Response | [`PayoutResponse`](././lib/straddle/models/payout_response.rb) |
|
|
1187
1187
|
|
|
1188
1188
|
```ruby
|
|
1189
|
-
response = client.payouts.upload_authorization_proof("7c9e6679-7425-40de-944b-e07fc1f90ae7", { file: "" })
|
|
1189
|
+
response = client.payouts.upload_authorization_proof("7c9e6679-7425-40de-944b-e07fc1f90ae7", { file: "file" })
|
|
1190
1190
|
|
|
1191
1191
|
puts response.inspect
|
|
1192
1192
|
```
|
data/lib/straddle/client.rb
CHANGED
|
@@ -23,6 +23,15 @@ module Straddle
|
|
|
23
23
|
# @return [String, nil]
|
|
24
24
|
attr_reader :webhook_secret
|
|
25
25
|
|
|
26
|
+
# @api private
|
|
27
|
+
#
|
|
28
|
+
# The `webhook_secret` passed to the constructor, or `nil` when it was left to
|
|
29
|
+
# default to `ENV["STRADDLE_WEBHOOK_SECRET"]`. The webhook helpers read that
|
|
30
|
+
# variable again on every call, so only a value passed here outranks it.
|
|
31
|
+
#
|
|
32
|
+
# @return [String, nil]
|
|
33
|
+
attr_reader :explicit_webhook_secret
|
|
34
|
+
|
|
26
35
|
# Accounts represent businesses that use Straddle through a platform.
|
|
27
36
|
# @return [Straddle::Resources::Accounts]
|
|
28
37
|
attr_reader :accounts
|
|
@@ -93,6 +102,11 @@ module Straddle
|
|
|
93
102
|
{"authorization" => "Bearer #{@bearer}"}
|
|
94
103
|
end
|
|
95
104
|
|
|
105
|
+
# @api private
|
|
106
|
+
#
|
|
107
|
+
# @return [Array<String>]
|
|
108
|
+
private def auth_header_keys = ["authorization"]
|
|
109
|
+
|
|
96
110
|
# Creates and returns a new client for interacting with the API.
|
|
97
111
|
#
|
|
98
112
|
# @param bearer [String, nil] Send the API key as a bearer token in the `Authorization` header. Defaults to
|
|
@@ -113,7 +127,7 @@ module Straddle
|
|
|
113
127
|
# @param max_retry_delay [Float]
|
|
114
128
|
def initialize(
|
|
115
129
|
bearer: ENV["BEARER"],
|
|
116
|
-
webhook_secret: ENV["STRADDLE_WEBHOOK_SECRET"],
|
|
130
|
+
webhook_secret: (webhook_secret_from_env = ENV["STRADDLE_WEBHOOK_SECRET"]),
|
|
117
131
|
base_url: ENV["STRADDLE_BASE_URL"],
|
|
118
132
|
max_retries: self.class::DEFAULT_MAX_RETRIES,
|
|
119
133
|
timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS,
|
|
@@ -122,23 +136,26 @@ module Straddle
|
|
|
122
136
|
)
|
|
123
137
|
base_url ||= "https://sandbox.straddle.com"
|
|
124
138
|
|
|
125
|
-
|
|
139
|
+
if bearer.nil?
|
|
140
|
+
raise ArgumentError.new("bearer is required, and can be set via environ: \"BEARER\"")
|
|
141
|
+
end
|
|
126
142
|
|
|
127
143
|
headers = {}
|
|
128
144
|
custom_headers_env = ENV["STRADDLE_CUSTOM_HEADERS"]
|
|
129
145
|
unless custom_headers_env.nil?
|
|
130
146
|
parsed = {}
|
|
131
|
-
custom_headers_env
|
|
132
|
-
.
|
|
133
|
-
.
|
|
134
|
-
colon = line
|
|
135
|
-
parsed[line[0...colon].strip] = line[(colon + 1)..].strip unless colon.nil?
|
|
147
|
+
custom_headers_env.split("\n").each do |line|
|
|
148
|
+
colon = line.index(":")
|
|
149
|
+
unless colon.nil?
|
|
150
|
+
parsed[line[0...colon].strip] = line[(colon + 1)..].strip
|
|
136
151
|
end
|
|
152
|
+
end
|
|
137
153
|
headers = parsed.merge(headers)
|
|
138
154
|
end
|
|
139
155
|
|
|
140
156
|
@bearer = bearer.to_s
|
|
141
157
|
@webhook_secret = webhook_secret&.to_s
|
|
158
|
+
@explicit_webhook_secret = webhook_secret_from_env.nil? ? @webhook_secret : nil
|
|
142
159
|
|
|
143
160
|
super(
|
|
144
161
|
base_url: base_url,
|