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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/smplkit/audit/events.rb +30 -10
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81fcac2865542750a3fd991640f3a45e5281e3bbcf2b86a1c8049d2a7c257d84
4
- data.tar.gz: 65283cde70a75bf79f15b93caa731fc489a9998102f727199029099c3c93fe56
3
+ metadata.gz: 30387f75831a98eef6f343ab2c4d8971826f8d01d3e90331403f99cb53d7797e
4
+ data.tar.gz: a03b4de90c32c53e84b9c902af5b45c89317b8b064629b16bf366d4a8e40c0c7
5
5
  SHA512:
6
- metadata.gz: 8430e48ac2cfd9176c69eebbdb11a26e74ec0e15261bd41f0d10d216a920c58fb60b8e538b139e8b8b831a38beb0ab97ec0b024d2f758390131d66b0ffe49c25
7
- data.tar.gz: 87ac206557166ed60a693330484eae8e44c0255a9612bab9aa79ea9f585ef328a313e14adb84172fc41a28eb446d49536f1b77e789e75411c8283b7292a11f49
6
+ metadata.gz: d4632f78bcfb874dbf478a8dfd3030c732e782ba0099810931bedac53e36aadcf62628e7ff7dc4e1f264f06e797c8fde837116731b237466a1bcf6f70604cd68
7
+ data.tar.gz: 5ab26d7a65e5849975ac3bf3c64166e3cb455dd0e59f7c593124d4e44b2127cea55488b9499f97cf2e1822296442509916ab3193701adf69db7d567fba8c6c58
@@ -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: 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[:filteraction] = action if action
61
- opts[:filterresource_type] = resource_type if resource_type
62
- opts[:filterresource_id] = resource_id if resource_id
63
- opts[:filteractor_type] = actor_type if actor_type
64
- opts[:filteractor_id] = actor_id if actor_id
65
- opts[:filteroccurred_at] = occurred_at_range if occurred_at_range
66
- opts[:pagesize] = page_size if page_size
67
- opts[:pageafter] = page_after if page_after
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) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smplkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.18
4
+ version: 1.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Smpl Solutions LLC