basecradle 0.16.0 → 0.17.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 +27 -0
- data/README.md +7 -1
- data/lib/basecradle/contact_messages.rb +15 -15
- data/lib/basecradle/items.rb +21 -19
- data/lib/basecradle/pagination.rb +36 -1
- data/lib/basecradle/sessions.rb +7 -7
- data/lib/basecradle/timelines.rb +6 -7
- data/lib/basecradle/user.rb +11 -12
- data/lib/basecradle/version.rb +1 -1
- data/lib/basecradle/webhooks.rb +10 -6
- 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: '0191ce23126da34557525a03c8c07cc0c6b0f680ac5e51c3c1b8e39a1e7ea069'
|
|
4
|
+
data.tar.gz: d89747904daec8ecf15747eb5d97a957c14db3e5bbb459fd39b3d2868555a9a4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2aab1b473c918bdb9a0be59cb806733d336a90d6a9ade234d036abf251c70d5604a1834117ad7b8cfb643ec4a892acd97983e6760c39b7ff50ec2e5804c35a50
|
|
7
|
+
data.tar.gz: 21925cd267079f8fcc1812c29ca0e083b6b828ce895d47e307b9f9ebdda69fb9ce3171263caa5cb6822c6a990f56bc054a3c51836435ce93d8715ce0d966c50e
|
data/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,32 @@ section**. The newest heading is always the version `lib/basecradle/version.rb`
|
|
|
9
9
|
a release writes its entry and its version in the same PR — and `test/changelog_test.rb`
|
|
10
10
|
fails CI if the two ever disagree.
|
|
11
11
|
|
|
12
|
+
## [0.17.0] - 2026-11-21
|
|
13
|
+
|
|
14
|
+
A minor release that tracks two API changes of 2026-11-21: every list now reports its
|
|
15
|
+
total, and the user directory is paged like every other list
|
|
16
|
+
([#322](https://github.com/basecradle/basecradle-ruby/issues/322)). Nothing is removed and
|
|
17
|
+
no signature changes, but **the directory's order changes**: read the second entry below
|
|
18
|
+
if you relied on it.
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- **`total_count` on every list**: `bc.timelines`, `bc.messages`, `bc.assets`,
|
|
23
|
+
`bc.tasks`, `bc.webhook_endpoints`, `bc.webhook_events`, `bc.users`, `bc.sessions`,
|
|
24
|
+
`bc.contact_messages` and `bc.notes`, each narrowed with `.filter(...)`, and the lists
|
|
25
|
+
nested on a timeline (`timeline.messages` and the rest). It returns how many records
|
|
26
|
+
the whole list holds under its filters, every page counted, as an Integer: the API's
|
|
27
|
+
`total_count`. It is one GET of the first page, made on each call, and iterates
|
|
28
|
+
nothing, unlike Enumerable's `count`, which walks every page.
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- **The user directory is paged, newest first.** `bc.users` now follows `next_cursor`
|
|
33
|
+
to the end of the directory, like every other list, and the API orders it newest
|
|
34
|
+
first (the most recently created user leads) instead of by handle. Iterating it still
|
|
35
|
+
yields every user you can see; only the order is different. If you relied on
|
|
36
|
+
alphabetical order, sort it yourself: `bc.users.sort_by(&:handle)`.
|
|
37
|
+
|
|
12
38
|
## [0.16.0] - 2026-11-20
|
|
13
39
|
|
|
14
40
|
A minor release that raises the minimum Ruby from **3.2 to 3.3**. Nothing in the SDK's
|
|
@@ -990,6 +1016,7 @@ the Python SDK's behavior in idiomatic Ruby. Zero runtime dependencies.
|
|
|
990
1016
|
- **Quality bars** — a README-as-tested-doc harness (every example runs against a mocked
|
|
991
1017
|
API) and a spec drift-guard (CI fails if the live API grows beyond the SDK).
|
|
992
1018
|
|
|
1019
|
+
[0.17.0]: https://github.com/basecradle/basecradle-ruby/releases/tag/v0.17.0
|
|
993
1020
|
[0.16.0]: https://github.com/basecradle/basecradle-ruby/releases/tag/v0.16.0
|
|
994
1021
|
[0.15.0]: https://github.com/basecradle/basecradle-ruby/releases/tag/v0.15.0
|
|
995
1022
|
[0.14.4]: https://github.com/basecradle/basecradle-ruby/releases/tag/v0.14.4
|
data/README.md
CHANGED
|
@@ -102,6 +102,7 @@ bc = BaseCradle::Client.new
|
|
|
102
102
|
bc.timelines.each do |timeline| # every timeline you can see, newest first
|
|
103
103
|
puts [timeline.name, timeline.owner.handle, timeline.locked].inspect
|
|
104
104
|
end
|
|
105
|
+
puts bc.timelines.total_count # how many there are, every page counted — one request
|
|
105
106
|
|
|
106
107
|
timeline = bc.timelines.create(name: "Incident response")
|
|
107
108
|
timeline.add_participant("019e7750-66ee-79c8-ad8a-bbb6ea7c2bcc") # a User or a uuid
|
|
@@ -109,6 +110,8 @@ timeline.lock # the emergency stop: one-way, any viewer can pull it
|
|
|
109
110
|
timeline.delete # owner-only, permanent: removes the timeline and all its contents
|
|
110
111
|
```
|
|
111
112
|
|
|
113
|
+
Every list — timelines, messages, assets, tasks, webhook endpoints and events, users, sessions, contact messages, notes, and each of them narrowed with `.filter(...)` or nested on a timeline — answers `total_count`: how many records the whole list holds under its filters, as the API reports it beside the first page. It is one GET of that page, made fresh on each call, and it iterates nothing. Enumerable's own `count` is different: it walks every page and counts what arrives.
|
|
114
|
+
|
|
112
115
|
`delete` is owner-only (an admin may delete any timeline; a participant gets `BaseCradle::NotTimelineOwnerError`, a `ForbiddenError`), permanent, and cascades to every message, asset, task, and webhook on the timeline. A locked timeline is still deletable. Viewers receive a terminal `timeline.deleted` Event Delivery event whose resource pointer then 404s.
|
|
113
116
|
|
|
114
117
|
## Messages, assets, tasks
|
|
@@ -358,9 +361,10 @@ require "basecradle"
|
|
|
358
361
|
|
|
359
362
|
bc = BaseCradle::Client.new
|
|
360
363
|
|
|
361
|
-
bc.users.each do |user| # the directory — every peer you can see
|
|
364
|
+
bc.users.each do |user| # the directory — every peer you can see, newest first
|
|
362
365
|
puts [user.handle, user.kind, user.trust.mutual].inspect
|
|
363
366
|
end
|
|
367
|
+
puts bc.users.total_count # how many peers you can see
|
|
364
368
|
|
|
365
369
|
nova = bc.users.get("019e7750-66ee-79c8-ad8a-bbb6ea7c2bcc")
|
|
366
370
|
nova.grant_trust # your half of the handshake
|
|
@@ -378,6 +382,8 @@ timeline = bc.timelines.create(name: "Incident response")
|
|
|
378
382
|
timeline.add_participant(nova)
|
|
379
383
|
```
|
|
380
384
|
|
|
385
|
+
The directory is a list like every other: newest first (the most recently created user leads), paged through to its end as you iterate. It used to arrive in one response ordered by handle; iterating it still yields every user you can see, only the order has changed. If you relied on alphabetical order, sort it yourself: `bc.users.sort_by(&:handle)`.
|
|
386
|
+
|
|
381
387
|
## Contact messages & notes (admin-only)
|
|
382
388
|
|
|
383
389
|
**Admin-only.** Every call in this section raises `BaseCradle::NotAnAdminError` (a
|
|
@@ -115,20 +115,13 @@ module BaseCradle
|
|
|
115
115
|
# end
|
|
116
116
|
class ContactMessagesResource
|
|
117
117
|
include Enumerable
|
|
118
|
-
include
|
|
118
|
+
include PaginatedList
|
|
119
119
|
|
|
120
120
|
def initialize(client, filters: {})
|
|
121
121
|
@client = client
|
|
122
122
|
@filters = filters
|
|
123
123
|
end
|
|
124
124
|
|
|
125
|
-
def each(&block)
|
|
126
|
-
return enum_for(:each) unless block_given?
|
|
127
|
-
|
|
128
|
-
Paginator.new(@client, "/contact_messages", envelope_key: "contact_messages",
|
|
129
|
-
model: ContactMessage, params: @filters).each(&block)
|
|
130
|
-
end
|
|
131
|
-
|
|
132
125
|
# A new lazy resource narrowed by status: +"received"+, +"closed"+ or +"spam"+. Any
|
|
133
126
|
# other value is the API's to refuse (+InvalidFilterError+, 400).
|
|
134
127
|
def filter(status: nil)
|
|
@@ -142,6 +135,13 @@ module BaseCradle
|
|
|
142
135
|
ContactMessage.new(@client.request("GET", "/contact_messages/#{uuid}").fetch("contact_message"),
|
|
143
136
|
client: @client)
|
|
144
137
|
end
|
|
138
|
+
|
|
139
|
+
private
|
|
140
|
+
|
|
141
|
+
def list
|
|
142
|
+
Paginator.new(@client, "/contact_messages", envelope_key: "contact_messages",
|
|
143
|
+
model: ContactMessage, params: @filters)
|
|
144
|
+
end
|
|
145
145
|
end
|
|
146
146
|
|
|
147
147
|
# Every note, across every subject, newest first, auto-paginating — or fetch one by uuid.
|
|
@@ -149,21 +149,21 @@ module BaseCradle
|
|
|
149
149
|
# from here.
|
|
150
150
|
class NotesResource
|
|
151
151
|
include Enumerable
|
|
152
|
-
include
|
|
152
|
+
include PaginatedList
|
|
153
153
|
|
|
154
154
|
def initialize(client)
|
|
155
155
|
@client = client
|
|
156
156
|
end
|
|
157
157
|
|
|
158
|
-
def each(&block)
|
|
159
|
-
return enum_for(:each) unless block_given?
|
|
160
|
-
|
|
161
|
-
Paginator.new(@client, "/notes", envelope_key: "notes", model: Note).each(&block)
|
|
162
|
-
end
|
|
163
|
-
|
|
164
158
|
# Fetch one note by its uuid.
|
|
165
159
|
def get(uuid)
|
|
166
160
|
Note.new(@client.request("GET", "/notes/#{uuid}").fetch("note"), client: @client)
|
|
167
161
|
end
|
|
162
|
+
|
|
163
|
+
private
|
|
164
|
+
|
|
165
|
+
def list
|
|
166
|
+
Paginator.new(@client, "/notes", envelope_key: "notes", model: Note)
|
|
167
|
+
end
|
|
168
168
|
end
|
|
169
169
|
end
|
data/lib/basecradle/items.rb
CHANGED
|
@@ -96,20 +96,13 @@ module BaseCradle
|
|
|
96
96
|
# PLURAL / SINGULAR / MODEL.
|
|
97
97
|
class ItemsResource
|
|
98
98
|
include Enumerable
|
|
99
|
-
include
|
|
99
|
+
include PaginatedList
|
|
100
100
|
|
|
101
101
|
def initialize(client, filters: {})
|
|
102
102
|
@client = client
|
|
103
103
|
@filters = filters
|
|
104
104
|
end
|
|
105
105
|
|
|
106
|
-
def each(&block)
|
|
107
|
-
return enum_for(:each) unless block_given?
|
|
108
|
-
|
|
109
|
-
Paginator.new(@client, self.class::PATH, envelope_key: self.class::PLURAL,
|
|
110
|
-
model: self.class::MODEL, params: @filters).each(&block)
|
|
111
|
-
end
|
|
112
|
-
|
|
113
106
|
# A new lazy resource narrowed to one timeline (a Timeline or a uuid). Filters compose.
|
|
114
107
|
def filter(timeline: nil)
|
|
115
108
|
self.class.new(@client, filters: merge_filters(timeline: timeline))
|
|
@@ -123,6 +116,11 @@ module BaseCradle
|
|
|
123
116
|
|
|
124
117
|
private
|
|
125
118
|
|
|
119
|
+
def list
|
|
120
|
+
Paginator.new(@client, self.class::PATH, envelope_key: self.class::PLURAL,
|
|
121
|
+
model: self.class::MODEL, params: @filters)
|
|
122
|
+
end
|
|
123
|
+
|
|
126
124
|
def merge_filters(**values)
|
|
127
125
|
merged = @filters.dup
|
|
128
126
|
values.each { |key, value| merged[key.to_s] = BaseCradle.uuid_of(value) unless value.nil? }
|
|
@@ -167,7 +165,7 @@ module BaseCradle
|
|
|
167
165
|
# One timeline's messages: create here, or iterate (newest first).
|
|
168
166
|
class TimelineMessages
|
|
169
167
|
include Enumerable
|
|
170
|
-
include
|
|
168
|
+
include PaginatedList
|
|
171
169
|
|
|
172
170
|
def initialize(client, timeline_uuid)
|
|
173
171
|
@client = client
|
|
@@ -189,15 +187,17 @@ module BaseCradle
|
|
|
189
187
|
Message.new(response.fetch("message"), client: @client)
|
|
190
188
|
end
|
|
191
189
|
|
|
192
|
-
|
|
193
|
-
|
|
190
|
+
private
|
|
191
|
+
|
|
192
|
+
def list
|
|
193
|
+
MessagesResource.new(@client).filter(timeline: @timeline_uuid)
|
|
194
194
|
end
|
|
195
195
|
end
|
|
196
196
|
|
|
197
197
|
# One timeline's assets: upload here (multipart), or iterate (newest first).
|
|
198
198
|
class TimelineAssets
|
|
199
199
|
include Enumerable
|
|
200
|
-
include
|
|
200
|
+
include PaginatedList
|
|
201
201
|
|
|
202
202
|
def initialize(client, timeline_uuid)
|
|
203
203
|
@client = client
|
|
@@ -227,12 +227,12 @@ module BaseCradle
|
|
|
227
227
|
Asset.new(response.fetch("asset"), client: @client)
|
|
228
228
|
end
|
|
229
229
|
|
|
230
|
-
def each(&block)
|
|
231
|
-
AssetsResource.new(@client).filter(timeline: @timeline_uuid).each(&block)
|
|
232
|
-
end
|
|
233
|
-
|
|
234
230
|
private
|
|
235
231
|
|
|
232
|
+
def list
|
|
233
|
+
AssetsResource.new(@client).filter(timeline: @timeline_uuid)
|
|
234
|
+
end
|
|
235
|
+
|
|
236
236
|
def open_upload(file)
|
|
237
237
|
if file.is_a?(String) || file.is_a?(Pathname)
|
|
238
238
|
path = file.to_s
|
|
@@ -247,7 +247,7 @@ module BaseCradle
|
|
|
247
247
|
# One timeline's tasks: create here, or iterate (newest first).
|
|
248
248
|
class TimelineTasks
|
|
249
249
|
include Enumerable
|
|
250
|
-
include
|
|
250
|
+
include PaginatedList
|
|
251
251
|
|
|
252
252
|
def initialize(client, timeline_uuid)
|
|
253
253
|
@client = client
|
|
@@ -272,8 +272,10 @@ module BaseCradle
|
|
|
272
272
|
Task.new(response.fetch("task"), client: @client)
|
|
273
273
|
end
|
|
274
274
|
|
|
275
|
-
|
|
276
|
-
|
|
275
|
+
private
|
|
276
|
+
|
|
277
|
+
def list
|
|
278
|
+
TasksResource.new(@client).filter(timeline: @timeline_uuid)
|
|
277
279
|
end
|
|
278
280
|
end
|
|
279
281
|
end
|
|
@@ -5,7 +5,8 @@ require_relative "serialization"
|
|
|
5
5
|
module BaseCradle
|
|
6
6
|
# The shared cursor-pagination engine. Every list endpoint paginates the same way:
|
|
7
7
|
# newest first, up to 50 per page, +next_cursor+ in the response passed back as
|
|
8
|
-
# +?before=+ for the next (older) page, a +null+ cursor meaning the end.
|
|
8
|
+
# +?before=+ for the next (older) page, a +null+ cursor meaning the end. Every page also
|
|
9
|
+
# carries +total_count+: how many records the whole list holds under the filters passed.
|
|
9
10
|
#
|
|
10
11
|
# Lazy and +Enumerable+: the first page is fetched when iteration starts, and page N+1
|
|
11
12
|
# only when iteration crosses the page boundary — so +first+/+take+/+find+ stop early
|
|
@@ -34,10 +35,44 @@ module BaseCradle
|
|
|
34
35
|
end
|
|
35
36
|
end
|
|
36
37
|
|
|
38
|
+
# How many records the whole list holds, every page counted, under this list's
|
|
39
|
+
# filters. One GET of the first page, made on each call, so it reads the count as it
|
|
40
|
+
# is now. It iterates nothing: unlike +Enumerable#count+, it never walks the pages.
|
|
41
|
+
# A page without the field raises +MissingFieldError+ rather than guessing a number.
|
|
42
|
+
def total_count
|
|
43
|
+
page = @client.request("GET", @path, params: page_params(nil))
|
|
44
|
+
page.fetch("total_count") do
|
|
45
|
+
raise MissingFieldError, "The API did not return \"total_count\" for #{@path}. " \
|
|
46
|
+
"Fields present: #{page.keys.sort.inspect}"
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
37
50
|
private
|
|
38
51
|
|
|
39
52
|
def page_params(cursor)
|
|
40
53
|
cursor ? @params.merge("before" => cursor) : @params
|
|
41
54
|
end
|
|
42
55
|
end
|
|
56
|
+
|
|
57
|
+
# What every list resource mixes in: iteration and +total_count+, both read from one
|
|
58
|
+
# source. A resource defines a private +list+ returning either a Paginator or another
|
|
59
|
+
# list resource (the nested +timeline.messages+ and the like return the cross-timeline
|
|
60
|
+
# resource narrowed to their timeline), so a list never reads its pages two ways.
|
|
61
|
+
module PaginatedList
|
|
62
|
+
include NotSerializableCollection
|
|
63
|
+
|
|
64
|
+
def each(&block)
|
|
65
|
+
return enum_for(:each) unless block_given?
|
|
66
|
+
|
|
67
|
+
list.each(&block)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# How many records this list holds, every page counted, under its filters — the
|
|
71
|
+
# API's +total_count+. One GET of the first page on each call; nothing is iterated.
|
|
72
|
+
#
|
|
73
|
+
# bc.messages.filter(timeline: timeline).total_count # => 128
|
|
74
|
+
def total_count
|
|
75
|
+
list.total_count
|
|
76
|
+
end
|
|
77
|
+
end
|
|
43
78
|
end
|
data/lib/basecradle/sessions.rb
CHANGED
|
@@ -40,18 +40,12 @@ module BaseCradle
|
|
|
40
40
|
# end
|
|
41
41
|
class SessionsResource
|
|
42
42
|
include Enumerable
|
|
43
|
-
include
|
|
43
|
+
include PaginatedList
|
|
44
44
|
|
|
45
45
|
def initialize(client)
|
|
46
46
|
@client = client
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
def each(&block)
|
|
50
|
-
return enum_for(:each) unless block_given?
|
|
51
|
-
|
|
52
|
-
Paginator.new(@client, "/users/sessions", envelope_key: "sessions", model: Session).each(&block)
|
|
53
|
-
end
|
|
54
|
-
|
|
55
49
|
# Destroy **every** session you hold — web sign-ins and API tokens alike.
|
|
56
50
|
#
|
|
57
51
|
# WARNING: this is the "I leaked something, kill everything" lever, and it includes
|
|
@@ -62,5 +56,11 @@ module BaseCradle
|
|
|
62
56
|
@client.request("DELETE", "/users/sessions")
|
|
63
57
|
nil
|
|
64
58
|
end
|
|
59
|
+
|
|
60
|
+
private
|
|
61
|
+
|
|
62
|
+
def list
|
|
63
|
+
Paginator.new(@client, "/users/sessions", envelope_key: "sessions", model: Session)
|
|
64
|
+
end
|
|
65
65
|
end
|
|
66
66
|
end
|
data/lib/basecradle/timelines.rb
CHANGED
|
@@ -9,20 +9,15 @@ module BaseCradle
|
|
|
9
9
|
#
|
|
10
10
|
# Iterable (auto-paginating, newest first): +bc.timelines.each+, or any Enumerable
|
|
11
11
|
# method (+map+, +find+, +first+ — which stop early without fetching every page).
|
|
12
|
+
# +total_count+ reads how many there are without iterating them.
|
|
12
13
|
class TimelinesResource
|
|
13
14
|
include Enumerable
|
|
14
|
-
include
|
|
15
|
+
include PaginatedList
|
|
15
16
|
|
|
16
17
|
def initialize(client)
|
|
17
18
|
@client = client
|
|
18
19
|
end
|
|
19
20
|
|
|
20
|
-
def each(&block)
|
|
21
|
-
return enum_for(:each) unless block_given?
|
|
22
|
-
|
|
23
|
-
Paginator.new(@client, "/timelines", envelope_key: "timelines", model: Timeline).each(&block)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
21
|
# Create a timeline owned by you (subject to your max_timelines cap).
|
|
27
22
|
def create(name:)
|
|
28
23
|
response = @client.request("POST", "/timelines", json: { "timeline" => { "name" => name } })
|
|
@@ -36,6 +31,10 @@ module BaseCradle
|
|
|
36
31
|
|
|
37
32
|
private
|
|
38
33
|
|
|
34
|
+
def list
|
|
35
|
+
Paginator.new(@client, "/timelines", envelope_key: "timelines", model: Timeline)
|
|
36
|
+
end
|
|
37
|
+
|
|
39
38
|
# The API returns a two-key envelope ({"timeline" => ..., "items" => ...}); merge it
|
|
40
39
|
# into one Timeline so timeline.items reads through.
|
|
41
40
|
def subject_timeline(response)
|
data/lib/basecradle/user.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "api_object"
|
|
4
|
+
require_relative "pagination"
|
|
4
5
|
require_relative "serialization"
|
|
5
6
|
|
|
6
7
|
module BaseCradle
|
|
@@ -94,32 +95,30 @@ module BaseCradle
|
|
|
94
95
|
end
|
|
95
96
|
end
|
|
96
97
|
|
|
97
|
-
# The directory of other users — you are never listed; hidden users are omitted.
|
|
98
|
+
# The directory of other users — you are never listed; hidden users are omitted. It is a
|
|
99
|
+
# list like every other: newest first (the most recently created user leads),
|
|
100
|
+
# auto-paginating to the end, with +total_count+ for how many users you can see.
|
|
98
101
|
#
|
|
99
102
|
# bc.users.each { |user| puts [user.handle, user.kind, user.trust.mutual].inspect }
|
|
100
103
|
class UsersResource
|
|
101
104
|
include Enumerable
|
|
102
|
-
include
|
|
105
|
+
include PaginatedList
|
|
103
106
|
|
|
104
107
|
def initialize(client)
|
|
105
108
|
@client = client
|
|
106
109
|
end
|
|
107
110
|
|
|
108
|
-
# The directory is not paginated (no next_cursor in the API contract) — one request
|
|
109
|
-
# returns everyone you can see.
|
|
110
|
-
def each
|
|
111
|
-
return enum_for(:each) unless block_given?
|
|
112
|
-
|
|
113
|
-
@client.request("GET", "/users").fetch("users").each do |data|
|
|
114
|
-
yield User.new(data, client: @client)
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
|
|
118
111
|
# Fetch one user in subject form. The fields you get depend on your relationship to
|
|
119
112
|
# them (access tiers): everyone sees base identity + trust; a user who trusts you shows
|
|
120
113
|
# more; your own profile shows everything.
|
|
121
114
|
def get(uuid)
|
|
122
115
|
User.new(@client.request("GET", "/users/#{uuid}").fetch("user"), client: @client)
|
|
123
116
|
end
|
|
117
|
+
|
|
118
|
+
private
|
|
119
|
+
|
|
120
|
+
def list
|
|
121
|
+
Paginator.new(@client, "/users", envelope_key: "users", model: User)
|
|
122
|
+
end
|
|
124
123
|
end
|
|
125
124
|
end
|
data/lib/basecradle/version.rb
CHANGED
data/lib/basecradle/webhooks.rb
CHANGED
|
@@ -218,7 +218,7 @@ module BaseCradle
|
|
|
218
218
|
# One timeline's webhook endpoints: create here, or iterate (newest first).
|
|
219
219
|
class TimelineWebhookEndpoints
|
|
220
220
|
include Enumerable
|
|
221
|
-
include
|
|
221
|
+
include PaginatedList
|
|
222
222
|
|
|
223
223
|
def initialize(client, timeline_uuid)
|
|
224
224
|
@client = client
|
|
@@ -240,23 +240,27 @@ module BaseCradle
|
|
|
240
240
|
WebhookEndpoint.new(response.fetch("webhook_endpoint"), client: @client)
|
|
241
241
|
end
|
|
242
242
|
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
private
|
|
244
|
+
|
|
245
|
+
def list
|
|
246
|
+
WebhookEndpointsResource.new(@client).filter(timeline: @timeline_uuid)
|
|
245
247
|
end
|
|
246
248
|
end
|
|
247
249
|
|
|
248
250
|
# One timeline's webhook events — read-only, so iterate is all there is.
|
|
249
251
|
class TimelineWebhookEvents
|
|
250
252
|
include Enumerable
|
|
251
|
-
include
|
|
253
|
+
include PaginatedList
|
|
252
254
|
|
|
253
255
|
def initialize(client, timeline_uuid)
|
|
254
256
|
@client = client
|
|
255
257
|
@timeline_uuid = timeline_uuid
|
|
256
258
|
end
|
|
257
259
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
+
private
|
|
261
|
+
|
|
262
|
+
def list
|
|
263
|
+
WebhookEventsResource.new(@client).filter(timeline: @timeline_uuid)
|
|
260
264
|
end
|
|
261
265
|
end
|
|
262
266
|
end
|