simple_connect-client 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a7ccdbb67c4b168087543c5244805676d3e81d7b4522396047828cba666a56a
4
- data.tar.gz: 723170ac99fdd68572c96d883337ef29715fca4741997d65b2b4a53827595ac3
3
+ metadata.gz: 80608e802aa6273143cb24d056f08abc1541dac6223371eae39c2611ed2ab99e
4
+ data.tar.gz: 9c8e9130fd84bda6b19eaccf5f57a68ff81dc186070f19ef1834114981dbb8bb
5
5
  SHA512:
6
- metadata.gz: 71a6195f53d733026560728f7c1d93774c5aa196ec54400fad876296ff387d59000166d0141e5a3a6eb661a813e0c09f2e76bf90b87bd156670f965291cfe513
7
- data.tar.gz: bb9c5d523968ae07cf3306dab93a2302f389bac9992dac0bee67b37693b06222aa1562fdc46f230db251c97d99a535f8d6566510101ecc53621f489b90e878bf
6
+ metadata.gz: ad8d5b28164c2598aeb32ee7bf0db42eec12ab15a0fed501d12b4cd9e33dfda11ac69ae24e21be0def68773c1119c40d020d31c0e77aae5b993458a1cc02e7b9
7
+ data.tar.gz: 2d578d852fa29a83400e6fecd49918cbddc118ebe7e846f64496e04d79b88ea7c3d3844c4f6f2c22c55900085e3b6872c2b8cc1a0a04810cc9c5b1cc63abfd29
data/CHANGELOG.md CHANGED
@@ -7,6 +7,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.3.0] - 2026-04-30
11
+
12
+ ### Added
13
+
14
+ - `events.deliver` response now embeds the persisted event-log row plus
15
+ the (optional) linked WhatsApp message under the same
16
+ `event_log` / `message` keys that `events.detail` already uses. The
17
+ new `DeliverResponse#event` returns this as an `EventResponse` —
18
+ callers can read `result.data.event.status`, `.error_text`,
19
+ `.skipped?`, `.dispatched?`, `.message`, etc., to see at a glance
20
+ whether the event was actually queued for dispatch (`"received"`) or
21
+ skipped because the integration is paused / the per-event flow is
22
+ disabled (both still return 202 server-side, because the event was
23
+ logged for audit). Previously the only deliver-time signal was
24
+ `#log_id` / `#event_id`, so a paused integration looked identical to
25
+ a healthy one from the sender's perspective.
26
+ - `EventResponse` is now reused for both endpoints — no new response
27
+ class. Its existing public surface is unchanged.
28
+
29
+ ### Compatibility
30
+
31
+ - **Server requirement**: the new `event_log` / `message` fields are
32
+ populated by SimpleWaConnect server ≥ v0.3.0. Older servers return
33
+ the v0.2.0 shape (`status`, `log_id`, `event_id`, `duplicate`,
34
+ `used_previous_secret`); `DeliverResponse#event` returns `nil` in
35
+ that case so existing code continues to work unmodified.
36
+ - The flat `#log_id` / `#event_id` accessors on `DeliverResponse` are
37
+ preserved — existing callers do not need to change anything.
38
+
10
39
  ## [0.2.0] - 2026-04-21
11
40
 
12
41
  ### Changed
@@ -51,6 +80,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
51
80
  - Ruby 3.2+.
52
81
  - No runtime gem dependencies (stdlib only).
53
82
 
54
- [unreleased]: https://github.com/GemsEssence/SimpleWaConnect/compare/simple_connect-client-v0.2.0...HEAD
83
+ [unreleased]: https://github.com/GemsEssence/SimpleWaConnect/compare/simple_connect-client-v0.3.0...HEAD
84
+ [0.3.0]: https://github.com/GemsEssence/SimpleWaConnect/compare/simple_connect-client-v0.2.0...simple_connect-client-v0.3.0
55
85
  [0.2.0]: https://github.com/GemsEssence/SimpleWaConnect/compare/simple_connect-client-v0.1.0...simple_connect-client-v0.2.0
56
86
  [0.1.0]: https://github.com/GemsEssence/SimpleWaConnect/releases/tag/simple_connect-client-v0.1.0
@@ -5,14 +5,32 @@ module SimpleConnect
5
5
  # Wraps the `events.deliver` acknowledgement.
6
6
  #
7
7
  # Server returns:
8
- # 202 on a new event → { status, log_id, event_id }
9
- # 200 on an idempotent replay → { status, log_id, event_id, duplicate: true }
8
+ # 202 on a new event → { status, log_id, event_id, event_log, message }
9
+ # 200 on a duplicate replay → { status, log_id, event_id, event_log, message, duplicate: true }
10
10
  # Either code is a success; consumers check `#duplicate?` to distinguish.
11
11
  # If the request was signed with a recently-rotated previous secret, the
12
12
  # server adds `"used_previous_secret": true` at the top level — a hint
13
13
  # to rotate credentials before the grace window ends.
14
+ #
15
+ # As of server v0.3.0, the response also carries the persisted
16
+ # event-log row + symmetric message under the same `event_log` /
17
+ # `message` keys that `events.detail` uses, so the same `EventResponse`
18
+ # parser wraps both. `#event` returns that wrapped row — the caller can
19
+ # read `#event.status`, `#event.error_text`, `#event.skipped?`, etc., to
20
+ # see at a glance whether the event was actually queued for dispatch
21
+ # (`"received"`) or skipped because the integration is paused / the
22
+ # per-event flow is disabled. Without this, a paused integration looked
23
+ # identical to a live one from the sender's perspective.
24
+ #
25
+ # `#event.message` is almost always `nil` at deliver time — dispatch is
26
+ # async and the outbound Message does not exist yet at the moment of
27
+ # the ack; populated only on duplicate replays of an already-dispatched
28
+ # event.
29
+ #
30
+ # The flat `#log_id` / `#event_id` accessors are preserved for backward
31
+ # compatibility.
14
32
  class DeliverResponse
15
- attr_reader :status, :log_id, :event_id
33
+ attr_reader :status, :log_id, :event_id, :event
16
34
 
17
35
  def initialize(json)
18
36
  @json = json.is_a?(Hash) ? json : {}
@@ -21,6 +39,7 @@ module SimpleConnect
21
39
  @event_id = @json["event_id"]
22
40
  @duplicate = @json["duplicate"] == true
23
41
  @used_previous_secret = @json["used_previous_secret"] == true
42
+ @event = @json["event_log"].is_a?(Hash) ? EventResponse.new(@json) : nil
24
43
  end
25
44
 
26
45
  def duplicate?
@@ -2,9 +2,15 @@
2
2
 
3
3
  module SimpleConnect
4
4
  module Responses
5
- # Wraps the `events.detail` success payload. Holds the event-log row
6
- # and, optionally, a nested `MessageResponse` if a WhatsApp message is
7
- # linked to the event.
5
+ # Wraps the persisted event-log row and (optionally) the linked
6
+ # WhatsApp message. Returned from two endpoints:
7
+ #
8
+ # * `events.detail` — the full GET payload, where the server wraps
9
+ # the log under an `"event_log"` key alongside `"message"`.
10
+ # * `events.deliver` (server ≥ 0.3.0) — the same shape, embedded
11
+ # under the `"event"` key on the deliver ack so callers know
12
+ # immediately whether the event was queued (`"received"`) or
13
+ # skipped (`"skipped_paused"`, `"skipped_disabled"`, …).
8
14
  class EventResponse
9
15
  attr_reader :event_id, :event_key, :status, :occurred_at, :created_at,
10
16
  :updated_at, :error_text, :payload, :message
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SimpleConnect
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_connect-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ramkrishan Patidar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-04-21 00:00:00.000000000 Z
11
+ date: 2026-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake