smplkit 1.0.18 → 1.0.19
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/lib/smplkit/audit/events.rb +30 -10
- 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: 30387f75831a98eef6f343ab2c4d8971826f8d01d3e90331403f99cb53d7797e
|
|
4
|
+
data.tar.gz: a03b4de90c32c53e84b9c902af5b45c89317b8b064629b16bf366d4a8e40c0c7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d4632f78bcfb874dbf478a8dfd3030c732e782ba0099810931bedac53e36aadcf62628e7ff7dc4e1f264f06e797c8fde837116731b237466a1bcf6f70604cd68
|
|
7
|
+
data.tar.gz: 5ab26d7a65e5849975ac3bf3c64166e3cb455dd0e59f7c593124d4e44b2127cea55488b9499f97cf2e1822296442509916ab3193701adf69db7d567fba8c6c58
|
data/lib/smplkit/audit/events.rb
CHANGED
|
@@ -24,13 +24,28 @@ module Smplkit
|
|
|
24
24
|
raise ArgumentError, "resource_type is required" if resource_type.nil? || resource_type.to_s.empty?
|
|
25
25
|
raise ArgumentError, "resource_id is required" if resource_id.nil? || resource_id.to_s.empty?
|
|
26
26
|
|
|
27
|
+
# Pydantic validation on the server expects an ISO-8601 string
|
|
28
|
+
# for ``occurred_at`` — Ruby's ``Time#to_s`` (which is what the
|
|
29
|
+
# generated client falls back to during JSON serialization)
|
|
30
|
+
# emits ``"2026-05-07 04:43:23 UTC"`` and trips the gate. Coerce
|
|
31
|
+
# Time/DateTime to ``.iso8601`` here so end users can pass the
|
|
32
|
+
# native Ruby type.
|
|
33
|
+
normalized_occurred_at = if occurred_at.respond_to?(:iso8601)
|
|
34
|
+
occurred_at.iso8601
|
|
35
|
+
else
|
|
36
|
+
occurred_at
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Server-side validation also rejects ``data: null`` (the field
|
|
40
|
+
# is required-non-null in the OpenAPI schema). Always default to
|
|
41
|
+
# an empty hash so users who omit ``data:`` don't trip the gate.
|
|
27
42
|
attrs = SmplkitGeneratedClient::Audit::Event.new(
|
|
28
43
|
action: action,
|
|
29
44
|
resource_type: resource_type,
|
|
30
45
|
resource_id: resource_id,
|
|
31
|
-
occurred_at:
|
|
46
|
+
occurred_at: normalized_occurred_at,
|
|
32
47
|
snapshot: snapshot,
|
|
33
|
-
data: data
|
|
48
|
+
data: data || {}
|
|
34
49
|
)
|
|
35
50
|
resource = SmplkitGeneratedClient::Audit::EventResource.new(
|
|
36
51
|
id: "",
|
|
@@ -56,15 +71,20 @@ module Smplkit
|
|
|
56
71
|
def list(action: nil, resource_type: nil, resource_id: nil,
|
|
57
72
|
actor_type: nil, actor_id: nil, occurred_at_range: nil,
|
|
58
73
|
page_size: nil, page_after: nil)
|
|
74
|
+
# Generated client opts use snake_case keys that internally map
|
|
75
|
+
# to the JSON:API ``filter[*]`` / ``page[*]`` query-string format
|
|
76
|
+
# (see default_api.rb#list_events_with_http_info). Without the
|
|
77
|
+
# underscores these silently fall through and the filters never
|
|
78
|
+
# reach the server.
|
|
59
79
|
opts = {}
|
|
60
|
-
opts[:
|
|
61
|
-
opts[:
|
|
62
|
-
opts[:
|
|
63
|
-
opts[:
|
|
64
|
-
opts[:
|
|
65
|
-
opts[:
|
|
66
|
-
opts[:
|
|
67
|
-
opts[:
|
|
80
|
+
opts[:filter_action] = action if action
|
|
81
|
+
opts[:filter_resource_type] = resource_type if resource_type
|
|
82
|
+
opts[:filter_resource_id] = resource_id if resource_id
|
|
83
|
+
opts[:filter_actor_type] = actor_type if actor_type
|
|
84
|
+
opts[:filter_actor_id] = actor_id if actor_id
|
|
85
|
+
opts[:filter_occurred_at] = occurred_at_range if occurred_at_range
|
|
86
|
+
opts[:page_size] = page_size if page_size
|
|
87
|
+
opts[:page_after] = page_after if page_after
|
|
68
88
|
|
|
69
89
|
resp = @api.list_events(opts)
|
|
70
90
|
events = (resp.data || []).map { |r| AuditEvent.from_resource(r) }
|