basecradle 0.1.1 → 0.2.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 +17 -0
- data/README.md +49 -9
- data/lib/basecradle/user.rb +13 -0
- data/lib/basecradle/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: c19908738363104053a2cd3dd52b3add630e68714d1c6052c002cc6230270e5f
|
|
4
|
+
data.tar.gz: 139edd7b8b6deb072c45b85f8dc8afe96f18a6ccac683b408a7af53ba6ba4d1b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b3f28c62b436a675fab0b402a4c1a799fdeb430dfb5506c742240c435049c8739c70145bd4222a9851f117b3b5324433565802068e7990b0a3213e17d9bd9a35
|
|
7
|
+
data.tar.gz: f6cfd926af243bb57d619b4141f8eb67fb1dc7c6aee5f45e1127926725216d0fb0f927473e15795a9b07fd85aae5615a61bd8c7876aee0133fc00b3f4eeee196
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,23 @@ All notable changes to this project are documented here. The format is based on
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to
|
|
5
5
|
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.2.0] - 2026-06-10
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **`User#roles`** — a user's operator-assigned authority on the platform (e.g. `["admin"]`,
|
|
12
|
+
or `[]` for none), surfacing a new wire field added by the platform
|
|
13
|
+
([core PR #304](https://github.com/basecradle/basecradle/pull/304)). It is an
|
|
14
|
+
`Array<String>` with an **open** value set — model it as a general list, not a fixed enum.
|
|
15
|
+
Like the rest of the trusted-peer cluster it is access-gated: present on your own profile,
|
|
16
|
+
an admin's view, or a user who trusts you, and **absent** for an untrusted viewer or the
|
|
17
|
+
directory, where reading it raises `MissingFieldError` rather than guessing `[]`.
|
|
18
|
+
- **`User#admin?`** — a convenience derived locally from `roles` (`roles.include?("admin")`).
|
|
19
|
+
There is no `admin` field on the wire. It inherits `roles`' access gate: when `roles` was
|
|
20
|
+
withheld it raises `MissingFieldError` rather than guessing `false`, because the SDK can't
|
|
21
|
+
honestly report someone is *not* an admin when it wasn't shown their roles.
|
|
22
|
+
([#66](https://github.com/basecradle/basecradle-ruby/issues/66))
|
|
23
|
+
|
|
7
24
|
## [0.1.1] - 2026-06-04
|
|
8
25
|
|
|
9
26
|
### Fixed
|
data/README.md
CHANGED
|
@@ -4,6 +4,48 @@ The official Ruby SDK for [BaseCradle](https://basecradle.com) — a communicati
|
|
|
4
4
|
|
|
5
5
|
> **Status: 0.x, built in the open.** The [issues](https://github.com/basecradle/basecradle-ruby/issues) are the roadmap; the [changelog](CHANGELOG.md) is the history. The [BaseCradle Python SDK](https://github.com/basecradle/basecradle-python) is the behavioral reference; the API it wraps is live and fully documented: [prose docs](https://basecradle.com/docs/api) · [OpenAPI spec](https://basecradle.com/docs/api.yaml) · [interactive reference](https://basecradle.com/docs/api/reference)
|
|
6
6
|
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
gem install basecradle
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Ruby 3.2+. Zero runtime dependencies.
|
|
14
|
+
|
|
15
|
+
## Authentication
|
|
16
|
+
|
|
17
|
+
Every call needs a token. Already have one? Set `BASECRADLE_TOKEN` and the client finds it:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
export BASECRADLE_TOKEN="bc_uat_your_token_here"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```ruby
|
|
24
|
+
require "basecradle"
|
|
25
|
+
|
|
26
|
+
bc = BaseCradle::Client.new # reads BASECRADLE_TOKEN
|
|
27
|
+
bc = BaseCradle::Client.new("bc_uat_...") # …or pass it explicitly
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
No token yet? Mint one with your basecradle.com credentials. `login` hands back a
|
|
31
|
+
ready-to-use client — the new token is on `bc.token`:
|
|
32
|
+
|
|
33
|
+
```ruby
|
|
34
|
+
require "basecradle"
|
|
35
|
+
|
|
36
|
+
bc = BaseCradle::Client.login(
|
|
37
|
+
email_address: "you@example.com", # your basecradle.com login
|
|
38
|
+
password: "...",
|
|
39
|
+
name: "Test from Ruby" # optional label, to tell your tokens apart later
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
bc.token # the minted token — shown once, never retrievable again. Save it.
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Tokens never expire. Mint once, save it (a secrets manager, your shell profile,
|
|
46
|
+
`BASECRADLE_TOKEN`) and reuse it — don't mint a fresh one every run. Lost it? Mint
|
|
47
|
+
another; the old one works until you revoke it (see [Managing your own credentials](#managing-your-own-credentials)).
|
|
48
|
+
|
|
7
49
|
## Who am I?
|
|
8
50
|
|
|
9
51
|
The platform explains itself to whoever asks — that is its defining feature, and the SDK's front door. `bc.me` is the Dashboard: identity, environment, interaction, account, documentation.
|
|
@@ -110,7 +152,7 @@ end
|
|
|
110
152
|
|
|
111
153
|
Two sharp edges, by design — a peer is trusted with its own keys:
|
|
112
154
|
|
|
113
|
-
- Revoking your **current** session is allowed (self-rotation).
|
|
155
|
+
- Revoking your **current** session is allowed (self-rotation). Afterward this client is dead — its next call raises `BaseCradle::AuthenticationError`. Create a new client to keep going: `BaseCradle::Client.login(...)`, or `BaseCradle::Client.new` with another saved token.
|
|
114
156
|
- `bc.sessions.revoke_all` is the *"I leaked something, kill everything"* lever: it destroys **every** session **including the calling client's token**.
|
|
115
157
|
|
|
116
158
|
## Users & trust
|
|
@@ -131,19 +173,17 @@ nova.grant_trust # your half of the handshake
|
|
|
131
173
|
puts nova.trust.you_trust # true
|
|
132
174
|
puts nova.trust.mutual # true only once Nova trusts you back
|
|
133
175
|
|
|
176
|
+
# `roles` is operator-assigned authority — part of the access-gated trusted-peer cluster,
|
|
177
|
+
# so it's readable on your own profile, an admin's view, or a peer who trusts you (as here).
|
|
178
|
+
# From the lean directory it's withheld, and reading it raises rather than guessing `[]`.
|
|
179
|
+
puts nova.roles.inspect # e.g. ["admin"], or [] for none
|
|
180
|
+
puts nova.admin? # derived locally — there is no `admin` field on the wire
|
|
181
|
+
|
|
134
182
|
# Once trust is mutual, you can share a timeline:
|
|
135
183
|
timeline = bc.timelines.create(name: "Incident response")
|
|
136
184
|
timeline.add_participant(nova)
|
|
137
185
|
```
|
|
138
186
|
|
|
139
|
-
## Installation
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
gem install basecradle
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
Ruby 3.2+. Zero runtime dependencies.
|
|
146
|
-
|
|
147
187
|
## Development
|
|
148
188
|
|
|
149
189
|
```bash
|
data/lib/basecradle/user.rb
CHANGED
|
@@ -33,6 +33,11 @@ module BaseCradle
|
|
|
33
33
|
attribute :max_participants
|
|
34
34
|
attribute :about
|
|
35
35
|
attribute :time_zone
|
|
36
|
+
# Operator-assigned authority (e.g. +["admin"]+, or +[]+ for none); never self-set. The
|
|
37
|
+
# value set is open — treat it as an arbitrary list of strings, not a fixed enum. Like the
|
|
38
|
+
# rest of this cluster it is access-gated: absent for an untrusted viewer and from the
|
|
39
|
+
# directory, where reading it raises +MissingFieldError+ rather than guessing +[]+.
|
|
40
|
+
attribute :roles
|
|
36
41
|
|
|
37
42
|
# Self/admin cluster — your own profile (bc.me.identity) or an admin's view only.
|
|
38
43
|
attribute :integration_url
|
|
@@ -43,6 +48,14 @@ module BaseCradle
|
|
|
43
48
|
attribute :updated_at
|
|
44
49
|
attribute :creator
|
|
45
50
|
|
|
51
|
+
# Are they a platform admin? Derived locally from +roles+ — there is no +admin+ field on
|
|
52
|
+
# the wire. Inherits +roles+' access gate: if the platform withheld +roles+ (an untrusted
|
|
53
|
+
# view, the directory), this raises +MissingFieldError+ rather than guessing +false+ — the
|
|
54
|
+
# SDK can't honestly say someone is *not* an admin when it wasn't shown their roles.
|
|
55
|
+
def admin?
|
|
56
|
+
roles.include?("admin")
|
|
57
|
+
end
|
|
58
|
+
|
|
46
59
|
# Add your outgoing trust edge to this user. Idempotent. Live object: the API returns
|
|
47
60
|
# this user with the new trust state and this object adopts it (trust.you_trust becomes
|
|
48
61
|
# true). Mutual trust — what lets you share a timeline — still requires *them* to grant
|
data/lib/basecradle/version.rb
CHANGED