overturo 0.7.2

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 (55) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +201 -0
  3. data/README.md +395 -0
  4. data/lib/overturo/api_operations/create.rb +14 -0
  5. data/lib/overturo/api_operations/delete.rb +14 -0
  6. data/lib/overturo/api_operations/list.rb +14 -0
  7. data/lib/overturo/api_operations/nested_resource.rb +52 -0
  8. data/lib/overturo/api_operations/retrieve.rb +14 -0
  9. data/lib/overturo/api_operations/update.rb +14 -0
  10. data/lib/overturo/api_resource.rb +107 -0
  11. data/lib/overturo/client.rb +231 -0
  12. data/lib/overturo/configuration.rb +24 -0
  13. data/lib/overturo/endpoints.rb +27 -0
  14. data/lib/overturo/errors.rb +120 -0
  15. data/lib/overturo/http_client.rb +166 -0
  16. data/lib/overturo/list_object.rb +73 -0
  17. data/lib/overturo/overturo_object.rb +87 -0
  18. data/lib/overturo/resources/agree/agreements.rb +20 -0
  19. data/lib/overturo/resources/agree/collaborations.rb +20 -0
  20. data/lib/overturo/resources/agree/quorum_requests.rb +22 -0
  21. data/lib/overturo/resources/comply/anchors.rb +25 -0
  22. data/lib/overturo/resources/comply/clean_rooms.rb +46 -0
  23. data/lib/overturo/resources/comply/evidence_packages.rb +15 -0
  24. data/lib/overturo/resources/comply/residency_posture.rb +31 -0
  25. data/lib/overturo/resources/comply/transfer_register.rb +28 -0
  26. data/lib/overturo/resources/connect/applications.rb +20 -0
  27. data/lib/overturo/resources/connect/connections.rb +20 -0
  28. data/lib/overturo/resources/connect/flows.rb +77 -0
  29. data/lib/overturo/resources/connect/meeting_consents.rb +60 -0
  30. data/lib/overturo/resources/connect/portability.rb +45 -0
  31. data/lib/overturo/resources/connect/webhooks.rb +42 -0
  32. data/lib/overturo/resources/consent/consent_records.rb +57 -0
  33. data/lib/overturo/resources/consent/consent_sessions.rb +49 -0
  34. data/lib/overturo/resources/consent/decisions.rb +54 -0
  35. data/lib/overturo/resources/consent/entitlements.rb +18 -0
  36. data/lib/overturo/resources/consent/trust_levels.rb +18 -0
  37. data/lib/overturo/resources/core/accounts.rb +18 -0
  38. data/lib/overturo/resources/core/me.rb +20 -0
  39. data/lib/overturo/resources/delegate/agent_identities.rb +23 -0
  40. data/lib/overturo/resources/delegate/authorization_receipts.rb +38 -0
  41. data/lib/overturo/resources/delegate/delegations.rb +34 -0
  42. data/lib/overturo/resources/delegate/disclosure_receipts.rb +24 -0
  43. data/lib/overturo/resources/delegate/security_event_streams.rb +22 -0
  44. data/lib/overturo/resources/protect/data_licenses.rb +19 -0
  45. data/lib/overturo/resources/protect/data_requests.rb +17 -0
  46. data/lib/overturo/resources/protect/policies.rb +23 -0
  47. data/lib/overturo/resources/protect/transfers.rb +19 -0
  48. data/lib/overturo/resources/verify/credentials.rb +23 -0
  49. data/lib/overturo/resources/verify/presentations.rb +18 -0
  50. data/lib/overturo/resources/verify/trust_scores.rb +17 -0
  51. data/lib/overturo/resources/verify/verification_sessions.rb +16 -0
  52. data/lib/overturo/resources/verify/vouches.rb +29 -0
  53. data/lib/overturo/version.rb +5 -0
  54. data/lib/overturo.rb +85 -0
  55. metadata +99 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1fe278207834136088841e4fe6681d95d2c45ac25c9def4ab5165ddd1006c0b6
4
+ data.tar.gz: 3509f71330fe80391aa878ed9494980e0a98360b1c5b21fdb84103ec037f1066
5
+ SHA512:
6
+ metadata.gz: e26ff3acb8f9fdd3228db28417de2f82bd477fd72aa8d00bd61486ed7e24c5575bb6c87aaac7e7cb3e2d46cb955626ac67b42c83e00ed5d93b04408a4c3b1dcb
7
+ data.tar.gz: 2890a441b18e348cbf48c9036afb890e9325993e7899a4bed8e26fdce68995f9b634873f75926f205e8c1b574e8f4da0edbb78f92b809f5d83fa7964290f5f91
data/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Overturo Geneva Association
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,395 @@
1
+ > **Release mirror.** This repository is a read-only snapshot of
2
+ > `overturo` 0.7.2, published from Overturo's main
3
+ > development repository. Issues and pull requests are welcome here; accepted
4
+ > changes are ported upstream and appear in the next release snapshot.
5
+ > Security reports: see [SECURITY.md](./SECURITY.md).
6
+
7
+ # Overturo Ruby SDK
8
+
9
+ **Documentation:** <https://overturo.com/developers/sdks> · **API reference:** <https://overturo.com/developers/openapi>
10
+
11
+ Ruby client for the [Overturo](https://overturo.com) personal data identity platform API.
12
+
13
+ ## Installation
14
+
15
+ Add to your Gemfile:
16
+
17
+ ```ruby
18
+ gem "overturo"
19
+ ```
20
+
21
+ Or install directly:
22
+
23
+ ```bash
24
+ gem install overturo
25
+ ```
26
+
27
+ **Requirements:** Ruby >= 3.1. Zero runtime dependencies.
28
+
29
+ ## Quick Start
30
+
31
+ ```ruby
32
+ require "overturo"
33
+
34
+ client = Overturo::Client.new(api_key: "sk_live_...")
35
+
36
+ # Get the current user
37
+ me = client.core.me.retrieve
38
+ puts me.email
39
+
40
+ # List applications
41
+ apps = client.connect.applications.list
42
+ apps.each { |app| puts app.name }
43
+
44
+ # Create a policy
45
+ policy = client.protect.policies.create(
46
+ title: "Data Access Policy",
47
+ type: "touchpoint"
48
+ )
49
+
50
+ # Activate a flow
51
+ client.connect.flows.activate("flw_abc123")
52
+ ```
53
+
54
+ ## Configuration
55
+
56
+ | Option | Default | Description |
57
+ |--------|---------|-------------|
58
+ | `api_key` | **required** | Your API key (`sk_live_...` or `sk_test_...`) |
59
+ | `base_url` | `https://overturo.com` | API base URL |
60
+ | `api_version` | `v1` | API version |
61
+ | `open_timeout` | `30` | Connection open timeout (seconds) |
62
+ | `read_timeout` | `80` | Read timeout (seconds) |
63
+ | `write_timeout` | `30` | Write timeout (seconds) |
64
+ | `max_retries` | `2` | Max retries on transient failures (429, 5xx, network) |
65
+ | `logger` | `nil` | Logger instance for request/response logging |
66
+
67
+ ```ruby
68
+ client = Overturo::Client.new(
69
+ api_key: "sk_live_...",
70
+ base_url: "https://custom.endpoint.com",
71
+ max_retries: 3,
72
+ read_timeout: 120,
73
+ logger: Logger.new($stdout)
74
+ )
75
+ ```
76
+
77
+ ## Surfaces & Resources
78
+
79
+ The API is organized into 8 surfaces:
80
+
81
+ | Surface | Accessor | Resources |
82
+ |---------|----------|-----------|
83
+ | **Core** | `client.core` | `me`, `accounts` |
84
+ | **Connect** | `client.connect` | `applications`, `webhooks`, `connections`, `trust_pairings`, `flows` |
85
+ | **Consent** | `client.consent` | `consent_sessions`, `decisions`, `consent_records`, `entitlements`, `trust_levels` |
86
+ | **Verify** | `client.verify` | `credentials`, `verification_sessions`, `presentations`, `trust_scores`, `vouches` |
87
+ | **Protect** | `client.protect` | `policies`, `data_requests`, `transfers`, `data_licenses` |
88
+ | **Agree** | `client.agree` | `agreements`, `decisions`, `collaborations` |
89
+ | **Delegate** | `client.delegate_ns` | `delegations`, `agent_identities`, `security_event_streams` |
90
+ | **Comply** | `client.comply` | `anchors`, `evidence_packages`, `clean_rooms` |
91
+
92
+ ## Usage
93
+
94
+ ### CRUDL Operations
95
+
96
+ ```ruby
97
+ # Create
98
+ app = client.connect.applications.create(name: "My App", redirect_uri: "https://example.com/callback")
99
+
100
+ # Retrieve
101
+ app = client.connect.applications.retrieve("app_abc123")
102
+
103
+ # Update
104
+ app = client.connect.applications.update("app_abc123", name: "New Name")
105
+
106
+ # Delete
107
+ client.connect.applications.delete("app_abc123")
108
+
109
+ # List
110
+ apps = client.connect.applications.list(page: 1, per_page: 25)
111
+ ```
112
+
113
+ ### Custom Actions
114
+
115
+ Resources expose domain-specific actions beyond standard CRUDL:
116
+
117
+ ```ruby
118
+ # Application lifecycle
119
+ client.connect.applications.publish("app_1")
120
+ client.connect.applications.unpublish("app_1")
121
+
122
+ # Flow lifecycle (draft → active → deprecated → archived)
123
+ client.connect.flows.activate("flw_1")
124
+ client.connect.flows.deprecate("flw_1", successor_id: "flw_2")
125
+ client.connect.flows.archive("flw_1")
126
+
127
+ # Connection management
128
+ client.connect.connections.suspend("conn_1", reason: "policy_violation")
129
+ client.connect.connections.unsuspend("conn_1")
130
+
131
+ # Consent verification
132
+ result = client.consent.entitlements.verify("ent_1", scope: "read:profile")
133
+ result.valid # => true
134
+ result.scopes # => ["read:profile"]
135
+
136
+ # Consent records captured outside Overturo's surfaces
137
+ record = client.consent.consent_records.create(flow_id: "flw_1", subject: { email: "ana@example.com" },
138
+ decisions: { marketing_email: { decision: "granted" } },
139
+ idempotency_key: "signup-1842")
140
+ client.consent.decisions.authorize("cap_token", subject: { email: "ana@example.com" }) # commit a form's capture token
141
+ batch = client.consent.consent_records.import(flow_id: "flw_1", records: rows, dry_run: true)
142
+ client.consent.consent_records.import_status(batch.id)
143
+ client.consent.consent_records.status(application_id: "app_1", email: "ana@example.com")
144
+
145
+ # Trust score queries
146
+ score = client.verify.trust_scores.query(subject: "usr_1", context: "data_sharing")
147
+ score.score # => 0.85
148
+
149
+ # Vouch management
150
+ vouches = client.verify.vouches.received(claim: "identity_verified")
151
+ vouches.data # => [OverturoObject, ...]
152
+
153
+ # Agreement negotiation
154
+ client.agree.agreements.propose(title: "Data sharing", counterparty_id: "usr_2")
155
+ client.agree.agreements.accept("agr_1")
156
+ client.agree.agreements.counter("agr_1", terms: "revised terms")
157
+
158
+ # Quorum decisions
159
+ client.agree.quorum_requests.vote("qreq_1", vote: "approve", comment: "Looks good")
160
+
161
+ # Multi-party collaboration
162
+ client.agree.collaborations.invite("collab_1", email: "partner@example.com", role: "contributor")
163
+ client.agree.collaborations.sign("collab_1")
164
+
165
+ # Agent identity delegation
166
+ client.delegate_ns.agent_identities.delegate("ai_1", scopes: ["read:profile"], ttl: 3600)
167
+ client.delegate_ns.agent_identities.suspend("ai_1", reason: "anomalous_behavior")
168
+ client.delegate_ns.agent_identities.reactivate("ai_1")
169
+
170
+ # Security event stream polling
171
+ events = client.delegate_ns.security_event_streams.poll("ses_1", cursor: "cur_abc")
172
+ events.events # => [OverturoObject, ...]
173
+ events.cursor # => "cur_def"
174
+
175
+ # Policy management
176
+ client.protect.policies.activate("pol_1")
177
+ client.protect.policies.revoke("pol_1")
178
+
179
+ # Data transfer cancellation
180
+ client.protect.transfers.cancel("tfr_1", reason: "user_requested")
181
+
182
+ # Data license termination
183
+ client.protect.data_licenses.terminate("dl_1", reason: "contract_expired")
184
+
185
+ # Clean room approval
186
+ client.comply.clean_rooms.approve("cr_1")
187
+
188
+ # Audit anchor inspection
189
+ anchor = client.comply.anchors.retrieve("anc_1")
190
+ export = client.comply.anchors.export("anc_1", format: "json")
191
+ receipts = client.comply.anchors.receipts("anc_1")
192
+ ```
193
+
194
+ ### Pagination
195
+
196
+ List endpoints return `ListObject` instances with built-in pagination:
197
+
198
+ ```ruby
199
+ # Manual pagination
200
+ page = client.connect.applications.list(page: 1, per_page: 10)
201
+ page.data # => Array of OverturoObject
202
+ page.has_more? # => true/false
203
+ page.pagination # => {"page" => 1, "per_page" => 10, "total" => 42}
204
+
205
+ # Fetch next page
206
+ next_page = page.next_page
207
+
208
+ # Auto-pagination across all pages
209
+ client.connect.applications.list.auto_paging_each do |app|
210
+ puts app.name
211
+ end
212
+ ```
213
+
214
+ ### Nested Resources
215
+
216
+ Webhooks are scoped to an application:
217
+
218
+ ```ruby
219
+ webhooks = client.connect.webhooks
220
+
221
+ # Create a webhook for an application
222
+ webhook = webhooks.create("app_1",
223
+ url: "https://example.com/webhook",
224
+ events: ["policy.activated"]
225
+ )
226
+
227
+ # List webhooks for an application
228
+ webhooks.list("app_1")
229
+
230
+ # Retrieve a specific webhook
231
+ webhooks.retrieve("app_1", "wh_1")
232
+
233
+ # Delete a webhook
234
+ webhooks.delete("app_1", "wh_1")
235
+ ```
236
+
237
+ ### Consent Sessions
238
+
239
+ The consent flow uses session tokens for iframe/embed integration:
240
+
241
+ ```ruby
242
+ sessions = client.consent.consent_sessions
243
+
244
+ # Create a consent session
245
+ session = sessions.create(flow_id: "flw_1", delivery_mode: "redirect")
246
+ session.session_token # => "tok_abc"
247
+
248
+ # Authorize the session (after user grants consent)
249
+ sessions.authorize("cs_1")
250
+
251
+ # Exchange session for tokens
252
+ tokens = sessions.exchange("cs_1")
253
+ tokens.access_token # => "at_123"
254
+ ```
255
+
256
+ ### Cross-border compliance
257
+
258
+ ```ruby
259
+ # Cross-border transfer register — each entry carries its lawful basis,
260
+ # adequacy verdict, and country pair. Export a signed, verifiable package.
261
+ register = client.comply.transfer_register
262
+ register.list # => list of transfer entries
263
+ register.evidence_package # => signed, anchored evidence package
264
+
265
+ # Residency posture — where your subjects' data is stored, per country.
266
+ posture = client.comply.residency_posture
267
+ posture.get # => per-country posture + assurance status
268
+ posture.evidence_package # => signed Proof of Residency
269
+
270
+ # Data portability (Art. 20) — application-scoped
271
+ client.connect.portability.formats("app_1")
272
+ client.connect.portability.confirm_export("app_1", portability_transfer_id: "pt_1")
273
+
274
+ # Compute-to-data — a result carries its privacy parameters and a first-class
275
+ # `suppressed` flag; a full k-anonymity suppression is surfaced, never empty.
276
+ result = client.comply.clean_rooms.run_query("cr_1", query: { ... })
277
+ result.suppressed # => true/false
278
+ result.k_anonymity_met # => true/false
279
+ ```
280
+
281
+ Country and assurance metadata ride the response objects (a country, never an
282
+ internal code).
283
+
284
+ ## Error Handling
285
+
286
+ All errors inherit from `Overturo::Error` and carry `http_status`, `http_body`, and `json_body` attributes.
287
+
288
+ | Error Class | HTTP Status | Description |
289
+ |-------------|-------------|-------------|
290
+ | `AuthenticationError` | 401 | Invalid or missing API key |
291
+ | `ForbiddenError` | 403 | Insufficient permissions |
292
+ | `NotFoundError` | 404 | Resource not found |
293
+ | `InvalidRequestError` | 400, 422 | Malformed request or validation failure |
294
+ | `RateLimitError` | 429 | Too many requests |
295
+ | `ApiError` | 500+ | Server-side error |
296
+ | `ConnectionError` | — | Network connectivity failure |
297
+ | `TimeoutError` | — | Request timed out |
298
+
299
+ ```ruby
300
+ begin
301
+ client.connect.flows.activate("flw_nonexistent")
302
+ rescue Overturo::NotFoundError => e
303
+ puts "Not found: #{e.message}"
304
+ puts "Status: #{e.http_status}" # => 404
305
+ puts "Body: #{e.json_body}" # => {"error" => "..."}
306
+ rescue Overturo::InvalidRequestError => e
307
+ puts "Validation failed: #{e.message}" # e.g. "Flow must be in draft status to activate"
308
+ rescue Overturo::RateLimitError
309
+ puts "Rate limited — retry later"
310
+ rescue Overturo::AuthenticationError
311
+ puts "Check your API key"
312
+ rescue Overturo::Error => e
313
+ puts "Unexpected error: #{e.message}"
314
+ end
315
+ ```
316
+
317
+ ## Retries & Idempotency
318
+
319
+ The client automatically retries on transient failures (HTTP 429, 5xx, network errors, timeouts) up to `max_retries` times with exponential backoff (0.5s, 1s, 2s, ...).
320
+
321
+ POST and PATCH requests include an `Idempotency-Key` header to ensure safe retries. You can also provide your own:
322
+
323
+ ```ruby
324
+ client.connect.applications.create(
325
+ { name: "My App" },
326
+ idempotency_key: "my-unique-key-123"
327
+ )
328
+ ```
329
+
330
+ ## Thread Safety
331
+
332
+ Each `Client` instance is safe to use across threads. Surface accessors and resources are memoized per-client, and `Net::HTTP` connections are created per-request. Create one client and share it:
333
+
334
+ ```ruby
335
+ # config/initializers/overturo.rb
336
+ OVERTURO = Overturo::Client.new(api_key: ENV["OVERTURO_API_KEY"])
337
+
338
+ # Anywhere in your app
339
+ OVERTURO.connect.applications.list
340
+ ```
341
+
342
+ ## Contract and testing
343
+
344
+ This client is written against Overturo's published OpenAPI document, kept at
345
+ <https://github.com/overturo/openapi> and rendered at
346
+ <https://overturo.com/developers/openapi>, where each operation lists the SDKs that reach it. When the client and the API disagree, the
347
+ document is the authority; a change to it is a change to this client.
348
+
349
+ The test suite stubs recorded operations from the shared API response corpus
350
+ (<https://github.com/overturo/conformance>, `api_responses/`), vendored under
351
+ `spec/fixtures/api_responses`. Each recording was made against the real API and checked against
352
+ the published document before it was committed, so a passing suite means the
353
+ client parses what the API actually sends — not what a test author remembered.
354
+ Identifiers, timestamps and tokens in the recordings are placeholders
355
+ (`<PREFIX_ID:1>`, `2026-01-01T00:00:00Z`, `<TOKEN>`); the corpus README documents the
356
+ grammar.
357
+
358
+ Run the suite with `bundle exec rspec`. When you add a test for a recorded operation, stub it
359
+ from the recording (`ApiCorpus.stub!("Vouches_show")`) rather than writing the response by hand.
360
+
361
+ ## License
362
+
363
+ Apache-2.0 — see [LICENSE](./LICENSE). Copyright 2026 Overturo Geneva Association.
364
+
365
+ ## Authority records
366
+
367
+ The durable **Authorization Receipt** is a different artifact from the
368
+ short-lived runtime receipt of the authorize path — the runtime
369
+ receipt's TTL bounds *honoring*, not evidence, while the durable record
370
+ is the archival, offline-verifiable account of the authorization.
371
+
372
+ ```ruby
373
+ # The durable record (audit:verify scope). Flavors: canonical (default,
374
+ # unwrapped like every resource read), signed and dpv (returned as
375
+ # plain Hashes — portable artifacts).
376
+ record = client.delegate_ns.authorization_receipts.retrieve("acc_...")
377
+ envelope = client.delegate_ns.authorization_receipts.retrieve("acc_...", flavor: "signed")
378
+
379
+ # Mint an operator-declared disclosure receipt (disclosures:write scope).
380
+ minted = client.delegate_ns.disclosure_receipts.create(
381
+ flow_id: "acc_...", agent_id: "agt_...", disclosed_at: Time.now.utc.iso8601
382
+ )
383
+ ```
384
+
385
+ Typed refusals raise `Overturo::InvalidRequestError` carrying the
386
+ machine code in `error_code` (`unknown_flavor`, `not_signable`,
387
+ `dpv_unavailable`; `agent_not_disclosed`, `invalid_disclosed_at`,
388
+ `purposes_missing`). The 404 contract is parity-preserving: unknown,
389
+ foreign, and non-authority ids are indistinguishable. An
390
+ authorization-kind record is refused by the consent-receipts read with
391
+ a typed hint — authority records are served only by these endpoints.
392
+ The gem stays dependency-free, so signed-record verification in Ruby is
393
+ the worked recipe in the Receipt Interop & Verification guide (gated by
394
+ the shared conformance corpus); in Node and Python it is a library call
395
+ (`@overturo/verify`, `overturo.verify_record`).
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Overturo
4
+ module ApiOperations
5
+ module Create
6
+ def self.included(base) = base.declare_endpoint(:post, "<resource>")
7
+
8
+ def create(params = {})
9
+ response = http_client.post(resource_path, body: params)
10
+ unwrap(response)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Overturo
4
+ module ApiOperations
5
+ module Delete
6
+ def self.included(base) = base.declare_endpoint(:delete, "<resource>/{id}")
7
+
8
+ def delete(id)
9
+ response = http_client.delete("#{resource_path}/#{id}")
10
+ unwrap(response)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Overturo
4
+ module ApiOperations
5
+ module List
6
+ def self.included(base) = base.declare_endpoint(:get, "<resource>")
7
+
8
+ def list(params = {})
9
+ response = http_client.get(resource_path, params: params)
10
+ unwrap_list(response, params: params)
11
+ end
12
+ end
13
+ end
14
+ end