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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03ba7132dde127d46367c5a7e9731862657586a3a16da516a951a108ab1b89ed
4
- data.tar.gz: 4d6e1c174a2ff5a1efe821ab92cbad01902271a18bfdc6c87724c83d1e79ef43
3
+ metadata.gz: f412b933b609da683b5885317338a0d6c09a86ae8614207a2eebd27a4aea6450
4
+ data.tar.gz: 90778567fd7a94e88a3daf97b50320d8919b9436afb4ed0abb9f85146a4791f3
5
5
  SHA512:
6
- metadata.gz: 03efb68afa45a268187f5d464d6f46f049c8c206400da5d9effcfb26ffaa3f901cae7e3ec40505f6a267b27ca3c3e332c110ce074006dd34ee87ec37ec541fb7
7
- data.tar.gz: 928da3e0894dc85da016d3a35e1cc8c75614e5a863119a9aef40d6ca54d01c158f4b163aecf75942f93c4cb017baa506981c6db4996b2446a8c4b13eb620b430
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 = @path.start_with?("http") ? @path : @nation.url + @path
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/")
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NbApiClient
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nb_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Flint