nb_api_client 0.3.0 → 0.3.1
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 +4 -0
- data/README.md +1 -2
- data/lib/nb_api_client/url_builder.rb +2 -1
- data/lib/nb_api_client/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f412b933b609da683b5885317338a0d6c09a86ae8614207a2eebd27a4aea6450
|
|
4
|
+
data.tar.gz: 90778567fd7a94e88a3daf97b50320d8919b9436afb4ed0abb9f85146a4791f3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c53d7b630005c8ab3819ccc85194a865296fc1bb38707c36dc06d474aaa55536d350717428a25d2ef78f599777ba9db37710426a621801110567fbffac217978
|
|
7
|
+
data.tar.gz: 3ee2477602ef28d7ca26d4432e1694ec33f148e2458c2476a42872c0f63c0cc62f1e11f3e16a2b5199485ee2b80e055df3bdae2ee0221e6c832fbd80b6b454e5
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.3.1] - 2026-07-16
|
|
8
|
+
|
|
9
|
+
- Updated `UrlBuilder` to build nation's URL based on it's slug, instead of requirng a separate `url` argument.
|
|
10
|
+
|
|
7
11
|
## [0.3.0] - 2026-07-16
|
|
8
12
|
|
|
9
13
|
- `NbApiClient::RateLimiter` now enforces an exact sliding window via a Redis
|
data/README.md
CHANGED
|
@@ -34,9 +34,8 @@ NbApiClient::Request.call(nation, :post, "/api/v2/signups", "data": {"type": "si
|
|
|
34
34
|
|
|
35
35
|
| Method | Returns |
|
|
36
36
|
| --------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
37
|
-
| `slug` | A string uniquely identifying the account (used as a cache-key/log prefix).
|
|
37
|
+
| `slug` | A string uniquely identifying the account (used as a cache-key/log prefix, and to build the account's base URL, e.g. `"myorg"` becomes `"https://myorg.nationbuilder.com"`). |
|
|
38
38
|
| `active?` | Whether requests should be allowed (checked before every call, except `/oauth/token`). |
|
|
39
|
-
| `url` | The base URL for the account, e.g. `"https://myorg.nationbuilder.com"`. |
|
|
40
39
|
| `token` | The current OAuth access token, appended as a query param on every request. |
|
|
41
40
|
| `refresh_oauth_token` | Refreshes the OAuth token in place; returns truthy on success, falsy on failure. |
|
|
42
41
|
| `deauthorize` | Called after too many consecutive "unauthorized" responses (see `unauthorized_error_threshold` below). |
|
|
@@ -10,10 +10,11 @@ module NbApiClient
|
|
|
10
10
|
@path = path
|
|
11
11
|
|
|
12
12
|
raise ArgumentError, "Path cannot be empty" if @path.blank?
|
|
13
|
+
raise ArgumentError, "Path must start with /" unless @path.start_with?("/")
|
|
13
14
|
end
|
|
14
15
|
|
|
15
16
|
def url
|
|
16
|
-
url_string =
|
|
17
|
+
url_string = "https://#{@nation.slug}.nationbuilder.com#{@path}"
|
|
17
18
|
|
|
18
19
|
uri = URI.parse(url_string)
|
|
19
20
|
new_query_ar = if @path.start_with?("/oauth/")
|