aho-sdk 0.1.0 → 0.1.1
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 +8 -1
- data/README.md +1 -1
- data/lib/aho_sdk/account.rb +46 -26
- data/lib/aho_sdk/holder.rb +9 -9
- data/lib/aho_sdk/http_client.rb +1 -1
- data/lib/aho_sdk/issuer.rb +51 -51
- data/lib/aho_sdk/schemas.rb +8 -8
- data/lib/aho_sdk/system.rb +3 -3
- data/lib/aho_sdk/{public.rb → unauthenticated.rb} +7 -7
- data/lib/aho_sdk/verifier.rb +77 -16
- data/lib/aho_sdk/version.rb +1 -1
- data/lib/aho_sdk.rb +18 -19
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c196d6f8508fab43b9eba6b5ae25186cd1b886c46d0de4e6c1caf7076fe7c42f
|
|
4
|
+
data.tar.gz: 32aba973775471eb93d0c3ec3829a7e3ad9a245829e1dd5fb6d276b329dc447d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c6f485cbe1ae666eac7ee3b76bcea05199b8b25051e5e11d1db41bfbf1399d54b9a176644104d29afaa97e2e193250d465ead4c6c05790eab97132fdb9f26e67
|
|
7
|
+
data.tar.gz: 5f0af391ed4fd1a577ec2576b4b2770f944cf94ca5d7d55d46e3ea01d4e165a026a382aa09f36ebb4097213de2621ee667c196d9393aa68047d70621f0ea8ba3
|
data/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,14 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [0.1.
|
|
8
|
+
## [0.1.1] - 2026-04-17
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- API base URL updated to `https://api.aho.com` (subdomain routing)
|
|
13
|
+
- API paths simplified from `/api/v1/*` to `/v1/*`
|
|
14
|
+
|
|
15
|
+
## [0.1.0] - 2026-04-17
|
|
9
16
|
|
|
10
17
|
### Added
|
|
11
18
|
|
data/README.md
CHANGED
|
@@ -49,7 +49,7 @@ The SDK provides the following clients:
|
|
|
49
49
|
| `AhoSdk::Verifier` | Create presentation requests and verify credentials | Verifier API Key |
|
|
50
50
|
| `AhoSdk::Issuer` | Issue and manage verifiable credentials | Issuer API Key |
|
|
51
51
|
| `AhoSdk::Schemas` | Browse and retrieve credential schemas | Schemas API Key |
|
|
52
|
-
| `AhoSdk::
|
|
52
|
+
| `AhoSdk::Unauthenticated` | Public endpoints (no authentication required) | None (public) |
|
|
53
53
|
|
|
54
54
|
## Usage Examples
|
|
55
55
|
|
data/lib/aho_sdk/account.rb
CHANGED
|
@@ -12,18 +12,20 @@ module AhoSdk
|
|
|
12
12
|
# @example
|
|
13
13
|
# client = AhoSdk::Account.new(api_key: ENV["AHO_ACCOUNT_API_KEY"])
|
|
14
14
|
# client.api_keys.list
|
|
15
|
+
# client.regenerate.list
|
|
15
16
|
# client.domains.list
|
|
16
17
|
# client.signing_keys.list
|
|
17
18
|
# client.webhooks.list
|
|
18
19
|
#
|
|
19
20
|
class Account
|
|
20
21
|
# @param api_key [String] API key for authentication
|
|
21
|
-
# @param base_url [String] Base URL (default: https://aho.com)
|
|
22
|
+
# @param base_url [String] Base URL (default: https://api.aho.com)
|
|
22
23
|
# @param timeout [Integer] Request timeout in seconds (default: 30)
|
|
23
24
|
# @param logger [Logger] Optional logger for debugging
|
|
24
|
-
def initialize(api_key:, base_url: "https://aho.com", timeout: 30, logger: nil)
|
|
25
|
+
def initialize(api_key:, base_url: "https://api.aho.com", timeout: 30, logger: nil)
|
|
25
26
|
@client = HttpClient.new(api_key: api_key, base_url: base_url, timeout: timeout, logger: logger)
|
|
26
27
|
@api_keys = ApiKeysResource.new(@client)
|
|
28
|
+
@regenerate = RegenerateResource.new(@client)
|
|
27
29
|
@domains = DomainsResource.new(@client)
|
|
28
30
|
@signing_keys = SigningKeysResource.new(@client)
|
|
29
31
|
@webhooks = WebhooksResource.new(@client)
|
|
@@ -31,6 +33,8 @@ module AhoSdk
|
|
|
31
33
|
|
|
32
34
|
# @return [ApiKeysResource]
|
|
33
35
|
attr_reader :api_keys
|
|
36
|
+
# @return [RegenerateResource]
|
|
37
|
+
attr_reader :regenerate
|
|
34
38
|
# @return [DomainsResource]
|
|
35
39
|
attr_reader :domains
|
|
36
40
|
# @return [SigningKeysResource]
|
|
@@ -51,21 +55,37 @@ module AhoSdk
|
|
|
51
55
|
#
|
|
52
56
|
# @return [Hash]
|
|
53
57
|
def list
|
|
54
|
-
@client.get("/
|
|
58
|
+
@client.get("/v1/account/api_keys")
|
|
55
59
|
end
|
|
56
60
|
|
|
57
|
-
#
|
|
61
|
+
# Get API key details
|
|
58
62
|
#
|
|
59
63
|
# @return [Hash]
|
|
60
|
-
def
|
|
61
|
-
@client.
|
|
64
|
+
def get(hashid:)
|
|
65
|
+
@client.get("/v1/account/api_keys/#{hashid}")
|
|
62
66
|
end
|
|
63
67
|
|
|
64
|
-
#
|
|
68
|
+
# Update API key
|
|
65
69
|
#
|
|
66
70
|
# @return [Hash]
|
|
67
|
-
def
|
|
68
|
-
@client.
|
|
71
|
+
def update(hashid:, body:, idempotency_key: nil)
|
|
72
|
+
@client.patch("/v1/account/api_keys/#{hashid}", body: body, idempotency_key: idempotency_key)
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Regenerate resource operations
|
|
77
|
+
# @api private
|
|
78
|
+
class RegenerateResource
|
|
79
|
+
# @api private
|
|
80
|
+
def initialize(client)
|
|
81
|
+
@client = client
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Regenerate API key
|
|
85
|
+
#
|
|
86
|
+
# @return [Hash]
|
|
87
|
+
def create(hashid:, idempotency_key: nil)
|
|
88
|
+
@client.post("/v1/account/api_keys/#{hashid}/regenerate", idempotency_key: idempotency_key)
|
|
69
89
|
end
|
|
70
90
|
end
|
|
71
91
|
|
|
@@ -81,7 +101,7 @@ module AhoSdk
|
|
|
81
101
|
#
|
|
82
102
|
# @return [Hash]
|
|
83
103
|
def create(body: nil, idempotency_key: nil)
|
|
84
|
-
@client.post("/
|
|
104
|
+
@client.post("/v1/account/domains", body: body, idempotency_key: idempotency_key)
|
|
85
105
|
end
|
|
86
106
|
|
|
87
107
|
# List domains
|
|
@@ -89,7 +109,7 @@ module AhoSdk
|
|
|
89
109
|
# @return [Hash]
|
|
90
110
|
def list(txt_status: nil, fully_verified: nil, primary: nil, page: nil, per_page: nil)
|
|
91
111
|
fetch_page = ->(p) {
|
|
92
|
-
response = @client.get("/
|
|
112
|
+
response = @client.get("/v1/account/domains", params: { txt_status: txt_status, fully_verified: fully_verified, primary: primary, page: p, per_page: per_page })
|
|
93
113
|
Page.new(data: response[:data], meta: response[:meta], fetch_next: fetch_page)
|
|
94
114
|
}
|
|
95
115
|
fetch_page.call(page)
|
|
@@ -99,21 +119,21 @@ module AhoSdk
|
|
|
99
119
|
#
|
|
100
120
|
# @return [Hash]
|
|
101
121
|
def get(id:)
|
|
102
|
-
@client.get("/
|
|
122
|
+
@client.get("/v1/account/domains/#{id}")
|
|
103
123
|
end
|
|
104
124
|
|
|
105
125
|
# Delete a domain
|
|
106
126
|
#
|
|
107
127
|
# @return [Hash]
|
|
108
128
|
def delete(id:)
|
|
109
|
-
@client.delete("/
|
|
129
|
+
@client.delete("/v1/account/domains/#{id}")
|
|
110
130
|
end
|
|
111
131
|
|
|
112
132
|
# Verify domain
|
|
113
133
|
#
|
|
114
134
|
# @return [Hash]
|
|
115
135
|
def verify(id:, idempotency_key: nil)
|
|
116
|
-
@client.post("/
|
|
136
|
+
@client.post("/v1/account/domains/#{id}/verify", idempotency_key: idempotency_key)
|
|
117
137
|
end
|
|
118
138
|
end
|
|
119
139
|
|
|
@@ -129,7 +149,7 @@ module AhoSdk
|
|
|
129
149
|
#
|
|
130
150
|
# @return [Hash]
|
|
131
151
|
def create(body: nil, idempotency_key: nil)
|
|
132
|
-
@client.post("/
|
|
152
|
+
@client.post("/v1/account/signing_keys", body: body, idempotency_key: idempotency_key)
|
|
133
153
|
end
|
|
134
154
|
|
|
135
155
|
# List signing keys
|
|
@@ -137,7 +157,7 @@ module AhoSdk
|
|
|
137
157
|
# @return [Hash]
|
|
138
158
|
def list(status: nil, algorithm: nil, usable: nil, page: nil, per_page: nil)
|
|
139
159
|
fetch_page = ->(p) {
|
|
140
|
-
response = @client.get("/
|
|
160
|
+
response = @client.get("/v1/account/signing_keys", params: { status: status, algorithm: algorithm, usable: usable, page: p, per_page: per_page })
|
|
141
161
|
Page.new(data: response[:data], meta: response[:meta], fetch_next: fetch_page)
|
|
142
162
|
}
|
|
143
163
|
fetch_page.call(page)
|
|
@@ -147,28 +167,28 @@ module AhoSdk
|
|
|
147
167
|
#
|
|
148
168
|
# @return [Hash]
|
|
149
169
|
def get(id:)
|
|
150
|
-
@client.get("/
|
|
170
|
+
@client.get("/v1/account/signing_keys/#{id}")
|
|
151
171
|
end
|
|
152
172
|
|
|
153
173
|
# Rotate a signing key
|
|
154
174
|
#
|
|
155
175
|
# @return [Hash]
|
|
156
176
|
def rotate(id:, body: nil, idempotency_key: nil)
|
|
157
|
-
@client.post("/
|
|
177
|
+
@client.post("/v1/account/signing_keys/#{id}/rotate", body: body, idempotency_key: idempotency_key)
|
|
158
178
|
end
|
|
159
179
|
|
|
160
180
|
# Revoke a signing key
|
|
161
181
|
#
|
|
162
182
|
# @return [Hash]
|
|
163
183
|
def revoke(id:, idempotency_key: nil)
|
|
164
|
-
@client.post("/
|
|
184
|
+
@client.post("/v1/account/signing_keys/#{id}/revoke", idempotency_key: idempotency_key)
|
|
165
185
|
end
|
|
166
186
|
|
|
167
187
|
# Download X.509 certificate
|
|
168
188
|
#
|
|
169
189
|
# @return [Hash]
|
|
170
190
|
def certificate(id:, domain: nil)
|
|
171
|
-
@client.get("/
|
|
191
|
+
@client.get("/v1/account/signing_keys/#{id}/certificate", params: { domain: domain })
|
|
172
192
|
end
|
|
173
193
|
end
|
|
174
194
|
|
|
@@ -184,42 +204,42 @@ module AhoSdk
|
|
|
184
204
|
#
|
|
185
205
|
# @return [Hash]
|
|
186
206
|
def list
|
|
187
|
-
@client.get("/
|
|
207
|
+
@client.get("/v1/account/webhooks")
|
|
188
208
|
end
|
|
189
209
|
|
|
190
210
|
# Create webhook
|
|
191
211
|
#
|
|
192
212
|
# @return [Hash]
|
|
193
213
|
def create(body: nil, idempotency_key: nil)
|
|
194
|
-
@client.post("/
|
|
214
|
+
@client.post("/v1/account/webhooks", body: body, idempotency_key: idempotency_key)
|
|
195
215
|
end
|
|
196
216
|
|
|
197
217
|
# Get webhook details
|
|
198
218
|
#
|
|
199
219
|
# @return [Hash]
|
|
200
220
|
def get
|
|
201
|
-
@client.get("/
|
|
221
|
+
@client.get("/v1/account/webhooks/primary")
|
|
202
222
|
end
|
|
203
223
|
|
|
204
224
|
# Update webhook
|
|
205
225
|
#
|
|
206
226
|
# @return [Hash]
|
|
207
227
|
def update(body: nil, idempotency_key: nil)
|
|
208
|
-
@client.patch("/
|
|
228
|
+
@client.patch("/v1/account/webhooks/primary", body: body, idempotency_key: idempotency_key)
|
|
209
229
|
end
|
|
210
230
|
|
|
211
231
|
# Delete webhook
|
|
212
232
|
#
|
|
213
233
|
# @return [Hash]
|
|
214
234
|
def delete
|
|
215
|
-
@client.delete("/
|
|
235
|
+
@client.delete("/v1/account/webhooks/primary")
|
|
216
236
|
end
|
|
217
237
|
|
|
218
238
|
# Test webhook
|
|
219
239
|
#
|
|
220
240
|
# @return [Hash]
|
|
221
241
|
def test(idempotency_key: nil)
|
|
222
|
-
@client.post("/
|
|
242
|
+
@client.post("/v1/account/webhooks/primary/test", idempotency_key: idempotency_key)
|
|
223
243
|
end
|
|
224
244
|
end
|
|
225
245
|
end
|
data/lib/aho_sdk/holder.rb
CHANGED
|
@@ -16,10 +16,10 @@ module AhoSdk
|
|
|
16
16
|
#
|
|
17
17
|
class Holder
|
|
18
18
|
# @param api_key [String] API key for authentication
|
|
19
|
-
# @param base_url [String] Base URL (default: https://aho.com)
|
|
19
|
+
# @param base_url [String] Base URL (default: https://api.aho.com)
|
|
20
20
|
# @param timeout [Integer] Request timeout in seconds (default: 30)
|
|
21
21
|
# @param logger [Logger] Optional logger for debugging
|
|
22
|
-
def initialize(api_key:, base_url: "https://aho.com", timeout: 30, logger: nil)
|
|
22
|
+
def initialize(api_key:, base_url: "https://api.aho.com", timeout: 30, logger: nil)
|
|
23
23
|
@client = HttpClient.new(api_key: api_key, base_url: base_url, timeout: timeout, logger: logger)
|
|
24
24
|
@credentials = CredentialsResource.new(@client)
|
|
25
25
|
@presentations = PresentationsResource.new(@client)
|
|
@@ -44,17 +44,17 @@ module AhoSdk
|
|
|
44
44
|
# @return [Hash]
|
|
45
45
|
def list(page: nil, per_page: nil, status: nil, sort: nil, direction: nil)
|
|
46
46
|
fetch_page = ->(p) {
|
|
47
|
-
response = @client.get("/
|
|
47
|
+
response = @client.get("/v1/holder/credentials", params: { page: p, per_page: per_page, status: status, sort: sort, direction: direction })
|
|
48
48
|
Page.new(data: response[:data], meta: response[:meta], fetch_next: fetch_page)
|
|
49
49
|
}
|
|
50
50
|
fetch_page.call(page)
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
-
# Get credential details
|
|
53
|
+
# Get holder credential details
|
|
54
54
|
#
|
|
55
55
|
# @return [Hash]
|
|
56
56
|
def get(uuid:)
|
|
57
|
-
@client.get("/
|
|
57
|
+
@client.get("/v1/holder/credentials/#{uuid}")
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
60
|
|
|
@@ -71,7 +71,7 @@ module AhoSdk
|
|
|
71
71
|
# @return [Hash]
|
|
72
72
|
def list(page: nil, per_page: nil, status: nil, credential_uuid: nil, sort: nil, direction: nil)
|
|
73
73
|
fetch_page = ->(p) {
|
|
74
|
-
response = @client.get("/
|
|
74
|
+
response = @client.get("/v1/holder/presentations", params: { page: p, per_page: per_page, status: status, credential_uuid: credential_uuid, sort: sort, direction: direction })
|
|
75
75
|
Page.new(data: response[:data], meta: response[:meta], fetch_next: fetch_page)
|
|
76
76
|
}
|
|
77
77
|
fetch_page.call(page)
|
|
@@ -81,21 +81,21 @@ module AhoSdk
|
|
|
81
81
|
#
|
|
82
82
|
# @return [Hash]
|
|
83
83
|
def create(body: nil, idempotency_key: nil)
|
|
84
|
-
@client.post("/
|
|
84
|
+
@client.post("/v1/holder/presentations", body: body, idempotency_key: idempotency_key)
|
|
85
85
|
end
|
|
86
86
|
|
|
87
87
|
# Get presentation details
|
|
88
88
|
#
|
|
89
89
|
# @return [Hash]
|
|
90
90
|
def get(uuid:)
|
|
91
|
-
@client.get("/
|
|
91
|
+
@client.get("/v1/holder/presentations/#{uuid}")
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
# Revoke a presentation
|
|
95
95
|
#
|
|
96
96
|
# @return [Hash]
|
|
97
97
|
def delete(uuid:)
|
|
98
|
-
@client.delete("/
|
|
98
|
+
@client.delete("/v1/holder/presentations/#{uuid}")
|
|
99
99
|
end
|
|
100
100
|
end
|
|
101
101
|
end
|
data/lib/aho_sdk/http_client.rb
CHANGED
|
@@ -23,7 +23,7 @@ module AhoSdk
|
|
|
23
23
|
# @param max_retries [Integer] Maximum number of retries on rate limit (default: 3)
|
|
24
24
|
# @param retry_delay [Float] Base delay in seconds for exponential backoff (default: 1.0)
|
|
25
25
|
# @param logger [Logger, nil] Optional logger for debugging
|
|
26
|
-
def initialize(api_key:, base_url: "https://aho.com", timeout: DEFAULT_TIMEOUT, max_retries: DEFAULT_MAX_RETRIES, retry_delay: DEFAULT_RETRY_DELAY, logger: nil)
|
|
26
|
+
def initialize(api_key:, base_url: "https://api.aho.com", timeout: DEFAULT_TIMEOUT, max_retries: DEFAULT_MAX_RETRIES, retry_delay: DEFAULT_RETRY_DELAY, logger: nil)
|
|
27
27
|
@api_key = api_key
|
|
28
28
|
@base_url = base_url.chomp("/")
|
|
29
29
|
@timeout = timeout
|
data/lib/aho_sdk/issuer.rb
CHANGED
|
@@ -24,10 +24,10 @@ module AhoSdk
|
|
|
24
24
|
#
|
|
25
25
|
class Issuer
|
|
26
26
|
# @param api_key [String] API key for authentication
|
|
27
|
-
# @param base_url [String] Base URL (default: https://aho.com)
|
|
27
|
+
# @param base_url [String] Base URL (default: https://api.aho.com)
|
|
28
28
|
# @param timeout [Integer] Request timeout in seconds (default: 30)
|
|
29
29
|
# @param logger [Logger] Optional logger for debugging
|
|
30
|
-
def initialize(api_key:, base_url: "https://aho.com", timeout: 30, logger: nil)
|
|
30
|
+
def initialize(api_key:, base_url: "https://api.aho.com", timeout: 30, logger: nil)
|
|
31
31
|
@client = HttpClient.new(api_key: api_key, base_url: base_url, timeout: timeout, logger: logger)
|
|
32
32
|
@automations = AutomationsResource.new(@client)
|
|
33
33
|
@credentials = CredentialsResource.new(@client)
|
|
@@ -75,28 +75,28 @@ module AhoSdk
|
|
|
75
75
|
#
|
|
76
76
|
# @return [Hash]
|
|
77
77
|
def get_webhook(automation_id:)
|
|
78
|
-
@client.get("/
|
|
78
|
+
@client.get("/v1/issuer/automations/#{automation_id}/webhook")
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
# Generate webhook token
|
|
82
82
|
#
|
|
83
83
|
# @return [Hash]
|
|
84
84
|
def create_webhook(automation_id:, idempotency_key: nil)
|
|
85
|
-
@client.post("/
|
|
85
|
+
@client.post("/v1/issuer/automations/#{automation_id}/webhook", idempotency_key: idempotency_key)
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
# Revoke webhook token
|
|
89
89
|
#
|
|
90
90
|
# @return [Hash]
|
|
91
91
|
def delete_webhook(automation_id:)
|
|
92
|
-
@client.delete("/
|
|
92
|
+
@client.delete("/v1/issuer/automations/#{automation_id}/webhook")
|
|
93
93
|
end
|
|
94
94
|
|
|
95
95
|
# Create an automation
|
|
96
96
|
#
|
|
97
97
|
# @return [Hash]
|
|
98
98
|
def create(body: nil, idempotency_key: nil)
|
|
99
|
-
@client.post("/
|
|
99
|
+
@client.post("/v1/issuer/automations", body: body, idempotency_key: idempotency_key)
|
|
100
100
|
end
|
|
101
101
|
|
|
102
102
|
# List automations
|
|
@@ -104,7 +104,7 @@ module AhoSdk
|
|
|
104
104
|
# @return [Hash]
|
|
105
105
|
def list(status: nil, trigger_mode: nil, page: nil, per_page: nil)
|
|
106
106
|
fetch_page = ->(p) {
|
|
107
|
-
response = @client.get("/
|
|
107
|
+
response = @client.get("/v1/issuer/automations", params: { status: status, trigger_mode: trigger_mode, page: p, per_page: per_page })
|
|
108
108
|
Page.new(data: response[:data], meta: response[:meta], fetch_next: fetch_page)
|
|
109
109
|
}
|
|
110
110
|
fetch_page.call(page)
|
|
@@ -114,42 +114,42 @@ module AhoSdk
|
|
|
114
114
|
#
|
|
115
115
|
# @return [Hash]
|
|
116
116
|
def get(id:)
|
|
117
|
-
@client.get("/
|
|
117
|
+
@client.get("/v1/issuer/automations/#{id}")
|
|
118
118
|
end
|
|
119
119
|
|
|
120
120
|
# Update an automation
|
|
121
121
|
#
|
|
122
122
|
# @return [Hash]
|
|
123
123
|
def update(id:, body: nil, idempotency_key: nil)
|
|
124
|
-
@client.patch("/
|
|
124
|
+
@client.patch("/v1/issuer/automations/#{id}", body: body, idempotency_key: idempotency_key)
|
|
125
125
|
end
|
|
126
126
|
|
|
127
127
|
# Delete an automation
|
|
128
128
|
#
|
|
129
129
|
# @return [Hash]
|
|
130
130
|
def delete(id:)
|
|
131
|
-
@client.delete("/
|
|
131
|
+
@client.delete("/v1/issuer/automations/#{id}")
|
|
132
132
|
end
|
|
133
133
|
|
|
134
134
|
# Trigger an automation
|
|
135
135
|
#
|
|
136
136
|
# @return [Hash]
|
|
137
137
|
def trigger(id:, idempotency_key: nil)
|
|
138
|
-
@client.post("/
|
|
138
|
+
@client.post("/v1/issuer/automations/#{id}/trigger", idempotency_key: idempotency_key)
|
|
139
139
|
end
|
|
140
140
|
|
|
141
141
|
# Pause an automation
|
|
142
142
|
#
|
|
143
143
|
# @return [Hash]
|
|
144
144
|
def pause(id:, idempotency_key: nil)
|
|
145
|
-
@client.post("/
|
|
145
|
+
@client.post("/v1/issuer/automations/#{id}/pause", idempotency_key: idempotency_key)
|
|
146
146
|
end
|
|
147
147
|
|
|
148
148
|
# Resume an automation
|
|
149
149
|
#
|
|
150
150
|
# @return [Hash]
|
|
151
151
|
def resume(id:, idempotency_key: nil)
|
|
152
|
-
@client.post("/
|
|
152
|
+
@client.post("/v1/issuer/automations/#{id}/resume", idempotency_key: idempotency_key)
|
|
153
153
|
end
|
|
154
154
|
end
|
|
155
155
|
|
|
@@ -165,7 +165,7 @@ module AhoSdk
|
|
|
165
165
|
#
|
|
166
166
|
# @return [Hash]
|
|
167
167
|
def create(body: nil, idempotency_key: nil)
|
|
168
|
-
@client.post("/
|
|
168
|
+
@client.post("/v1/issuer/credentials", body: body, idempotency_key: idempotency_key)
|
|
169
169
|
end
|
|
170
170
|
|
|
171
171
|
# List credentials
|
|
@@ -173,52 +173,52 @@ module AhoSdk
|
|
|
173
173
|
# @return [Hash]
|
|
174
174
|
def list(status: nil, schema: nil, subject_identifier: nil, issued_after: nil, issued_before: nil, expires_after: nil, expires_before: nil, sort: "issued_at", direction: "desc", page: 1, per_page: 25)
|
|
175
175
|
fetch_page = ->(p) {
|
|
176
|
-
response = @client.get("/
|
|
176
|
+
response = @client.get("/v1/issuer/credentials", params: { status: status, schema: schema, subject_identifier: subject_identifier, issued_after: issued_after, issued_before: issued_before, expires_after: expires_after, expires_before: expires_before, sort: sort, direction: direction, page: p, per_page: per_page })
|
|
177
177
|
Page.new(data: response[:data], meta: response[:meta], fetch_next: fetch_page)
|
|
178
178
|
}
|
|
179
179
|
fetch_page.call(page)
|
|
180
180
|
end
|
|
181
181
|
|
|
182
|
-
# Get credential details
|
|
182
|
+
# Get issued credential details
|
|
183
183
|
#
|
|
184
184
|
# @return [Hash]
|
|
185
185
|
def get(uuid:)
|
|
186
|
-
@client.get("/
|
|
186
|
+
@client.get("/v1/issuer/credentials/#{uuid}")
|
|
187
187
|
end
|
|
188
188
|
|
|
189
189
|
# Revoke a credential
|
|
190
190
|
#
|
|
191
191
|
# @return [Hash]
|
|
192
192
|
def revoke(uuid:, body: nil, idempotency_key: nil)
|
|
193
|
-
@client.post("/
|
|
193
|
+
@client.post("/v1/issuer/credentials/#{uuid}/revoke", body: body, idempotency_key: idempotency_key)
|
|
194
194
|
end
|
|
195
195
|
|
|
196
196
|
# Suspend a credential
|
|
197
197
|
#
|
|
198
198
|
# @return [Hash]
|
|
199
199
|
def suspend(uuid:, idempotency_key: nil)
|
|
200
|
-
@client.post("/
|
|
200
|
+
@client.post("/v1/issuer/credentials/#{uuid}/suspend", idempotency_key: idempotency_key)
|
|
201
201
|
end
|
|
202
202
|
|
|
203
203
|
# Reinstate a suspended credential
|
|
204
204
|
#
|
|
205
205
|
# @return [Hash]
|
|
206
206
|
def reinstate(uuid:, idempotency_key: nil)
|
|
207
|
-
@client.post("/
|
|
207
|
+
@client.post("/v1/issuer/credentials/#{uuid}/reinstate", idempotency_key: idempotency_key)
|
|
208
208
|
end
|
|
209
209
|
|
|
210
210
|
# Get credential status
|
|
211
211
|
#
|
|
212
212
|
# @return [Hash]
|
|
213
213
|
def status(uuid:)
|
|
214
|
-
@client.get("/
|
|
214
|
+
@client.get("/v1/issuer/credentials/#{uuid}/status")
|
|
215
215
|
end
|
|
216
216
|
|
|
217
217
|
# Get credential history
|
|
218
218
|
#
|
|
219
219
|
# @return [Hash]
|
|
220
220
|
def history(uuid:)
|
|
221
|
-
@client.get("/
|
|
221
|
+
@client.get("/v1/issuer/credentials/#{uuid}/history")
|
|
222
222
|
end
|
|
223
223
|
end
|
|
224
224
|
|
|
@@ -234,7 +234,7 @@ module AhoSdk
|
|
|
234
234
|
#
|
|
235
235
|
# @return [Hash]
|
|
236
236
|
def create(body: nil, idempotency_key: nil)
|
|
237
|
-
@client.post("/
|
|
237
|
+
@client.post("/v1/issuer/credentials/revoke_batch", body: body, idempotency_key: idempotency_key)
|
|
238
238
|
end
|
|
239
239
|
end
|
|
240
240
|
|
|
@@ -250,7 +250,7 @@ module AhoSdk
|
|
|
250
250
|
#
|
|
251
251
|
# @return [Hash]
|
|
252
252
|
def create(body: nil, idempotency_key: nil)
|
|
253
|
-
@client.post("/
|
|
253
|
+
@client.post("/v1/issuer/credentials/suspend_batch", body: body, idempotency_key: idempotency_key)
|
|
254
254
|
end
|
|
255
255
|
end
|
|
256
256
|
|
|
@@ -266,7 +266,7 @@ module AhoSdk
|
|
|
266
266
|
#
|
|
267
267
|
# @return [Hash]
|
|
268
268
|
def create(body: nil, idempotency_key: nil)
|
|
269
|
-
@client.post("/
|
|
269
|
+
@client.post("/v1/issuer/credentials/reinstate_batch", body: body, idempotency_key: idempotency_key)
|
|
270
270
|
end
|
|
271
271
|
end
|
|
272
272
|
|
|
@@ -282,7 +282,7 @@ module AhoSdk
|
|
|
282
282
|
#
|
|
283
283
|
# @return [Hash]
|
|
284
284
|
def create(body: nil, idempotency_key: nil)
|
|
285
|
-
@client.post("/
|
|
285
|
+
@client.post("/v1/issuer/data_source_mappings", body: body, idempotency_key: idempotency_key)
|
|
286
286
|
end
|
|
287
287
|
|
|
288
288
|
# List data source mappings
|
|
@@ -290,7 +290,7 @@ module AhoSdk
|
|
|
290
290
|
# @return [Hash]
|
|
291
291
|
def list(data_source: nil, credential_schema: nil, page: nil, per_page: nil)
|
|
292
292
|
fetch_page = ->(p) {
|
|
293
|
-
response = @client.get("/
|
|
293
|
+
response = @client.get("/v1/issuer/data_source_mappings", params: { data_source: data_source, credential_schema: credential_schema, page: p, per_page: per_page })
|
|
294
294
|
Page.new(data: response[:data], meta: response[:meta], fetch_next: fetch_page)
|
|
295
295
|
}
|
|
296
296
|
fetch_page.call(page)
|
|
@@ -300,21 +300,21 @@ module AhoSdk
|
|
|
300
300
|
#
|
|
301
301
|
# @return [Hash]
|
|
302
302
|
def get(id:)
|
|
303
|
-
@client.get("/
|
|
303
|
+
@client.get("/v1/issuer/data_source_mappings/#{id}")
|
|
304
304
|
end
|
|
305
305
|
|
|
306
306
|
# Update a mapping
|
|
307
307
|
#
|
|
308
308
|
# @return [Hash]
|
|
309
309
|
def update(id:, body: nil, idempotency_key: nil)
|
|
310
|
-
@client.patch("/
|
|
310
|
+
@client.patch("/v1/issuer/data_source_mappings/#{id}", body: body, idempotency_key: idempotency_key)
|
|
311
311
|
end
|
|
312
312
|
|
|
313
313
|
# Delete a mapping
|
|
314
314
|
#
|
|
315
315
|
# @return [Hash]
|
|
316
316
|
def delete(id:)
|
|
317
|
-
@client.delete("/
|
|
317
|
+
@client.delete("/v1/issuer/data_source_mappings/#{id}")
|
|
318
318
|
end
|
|
319
319
|
end
|
|
320
320
|
|
|
@@ -330,7 +330,7 @@ module AhoSdk
|
|
|
330
330
|
#
|
|
331
331
|
# @return [Hash]
|
|
332
332
|
def create(body: nil, idempotency_key: nil)
|
|
333
|
-
@client.post("/
|
|
333
|
+
@client.post("/v1/issuer/data_sources", body: body, idempotency_key: idempotency_key)
|
|
334
334
|
end
|
|
335
335
|
|
|
336
336
|
# List data sources
|
|
@@ -338,7 +338,7 @@ module AhoSdk
|
|
|
338
338
|
# @return [Hash]
|
|
339
339
|
def list(status: nil, source_type: nil, page: nil, per_page: nil)
|
|
340
340
|
fetch_page = ->(p) {
|
|
341
|
-
response = @client.get("/
|
|
341
|
+
response = @client.get("/v1/issuer/data_sources", params: { status: status, source_type: source_type, page: p, per_page: per_page })
|
|
342
342
|
Page.new(data: response[:data], meta: response[:meta], fetch_next: fetch_page)
|
|
343
343
|
}
|
|
344
344
|
fetch_page.call(page)
|
|
@@ -348,28 +348,28 @@ module AhoSdk
|
|
|
348
348
|
#
|
|
349
349
|
# @return [Hash]
|
|
350
350
|
def get(id:)
|
|
351
|
-
@client.get("/
|
|
351
|
+
@client.get("/v1/issuer/data_sources/#{id}")
|
|
352
352
|
end
|
|
353
353
|
|
|
354
354
|
# Update a data source
|
|
355
355
|
#
|
|
356
356
|
# @return [Hash]
|
|
357
357
|
def update(id:, body: nil, idempotency_key: nil)
|
|
358
|
-
@client.patch("/
|
|
358
|
+
@client.patch("/v1/issuer/data_sources/#{id}", body: body, idempotency_key: idempotency_key)
|
|
359
359
|
end
|
|
360
360
|
|
|
361
361
|
# Delete a data source
|
|
362
362
|
#
|
|
363
363
|
# @return [Hash]
|
|
364
364
|
def delete(id:)
|
|
365
|
-
@client.delete("/
|
|
365
|
+
@client.delete("/v1/issuer/data_sources/#{id}")
|
|
366
366
|
end
|
|
367
367
|
|
|
368
368
|
# Test data source connection
|
|
369
369
|
#
|
|
370
370
|
# @return [Hash]
|
|
371
371
|
def test(id:, idempotency_key: nil)
|
|
372
|
-
@client.post("/
|
|
372
|
+
@client.post("/v1/issuer/data_sources/#{id}/test", idempotency_key: idempotency_key)
|
|
373
373
|
end
|
|
374
374
|
end
|
|
375
375
|
|
|
@@ -386,7 +386,7 @@ module AhoSdk
|
|
|
386
386
|
# @return [Hash]
|
|
387
387
|
def list(page: nil, per_page: nil, status: nil, created_after: nil, created_before: nil, expires_after: nil, expires_before: nil, schema: nil, subject_identifier: nil, sort: nil, direction: nil)
|
|
388
388
|
fetch_page = ->(p) {
|
|
389
|
-
response = @client.get("/
|
|
389
|
+
response = @client.get("/v1/issuer/offers", params: { page: p, per_page: per_page, status: status, created_after: created_after, created_before: created_before, expires_after: expires_after, expires_before: expires_before, schema: schema, subject_identifier: subject_identifier, sort: sort, direction: direction })
|
|
390
390
|
Page.new(data: response[:data], meta: response[:meta], fetch_next: fetch_page)
|
|
391
391
|
}
|
|
392
392
|
fetch_page.call(page)
|
|
@@ -396,21 +396,21 @@ module AhoSdk
|
|
|
396
396
|
#
|
|
397
397
|
# @return [Hash]
|
|
398
398
|
def create(body: nil, idempotency_key: nil)
|
|
399
|
-
@client.post("/
|
|
399
|
+
@client.post("/v1/issuer/offers", body: body, idempotency_key: idempotency_key)
|
|
400
400
|
end
|
|
401
401
|
|
|
402
402
|
# Get credential offer details
|
|
403
403
|
#
|
|
404
404
|
# @return [Hash]
|
|
405
405
|
def get(uuid:)
|
|
406
|
-
@client.get("/
|
|
406
|
+
@client.get("/v1/issuer/offers/#{uuid}")
|
|
407
407
|
end
|
|
408
408
|
|
|
409
409
|
# Revoke a credential offer
|
|
410
410
|
#
|
|
411
411
|
# @return [Hash]
|
|
412
412
|
def revoke(uuid:, idempotency_key: nil)
|
|
413
|
-
@client.post("/
|
|
413
|
+
@client.post("/v1/issuer/offers/#{uuid}/revoke", idempotency_key: idempotency_key)
|
|
414
414
|
end
|
|
415
415
|
end
|
|
416
416
|
|
|
@@ -426,15 +426,15 @@ module AhoSdk
|
|
|
426
426
|
#
|
|
427
427
|
# @return [Hash]
|
|
428
428
|
def create(body: nil, idempotency_key: nil)
|
|
429
|
-
@client.post("/
|
|
429
|
+
@client.post("/v1/issuer/schemas", body: body, idempotency_key: idempotency_key)
|
|
430
430
|
end
|
|
431
431
|
|
|
432
|
-
# List credential schemas
|
|
432
|
+
# List issuer credential schemas
|
|
433
433
|
#
|
|
434
434
|
# @return [Hash]
|
|
435
|
-
def list(status: nil, page:
|
|
435
|
+
def list(status: nil, page: nil, per_page: nil)
|
|
436
436
|
fetch_page = ->(p) {
|
|
437
|
-
response = @client.get("/
|
|
437
|
+
response = @client.get("/v1/issuer/schemas", params: { status: status, page: p, per_page: per_page })
|
|
438
438
|
Page.new(data: response[:data], meta: response[:meta], fetch_next: fetch_page)
|
|
439
439
|
}
|
|
440
440
|
fetch_page.call(page)
|
|
@@ -444,35 +444,35 @@ module AhoSdk
|
|
|
444
444
|
#
|
|
445
445
|
# @return [Hash]
|
|
446
446
|
def get(id:)
|
|
447
|
-
@client.get("/
|
|
447
|
+
@client.get("/v1/issuer/schemas/#{id}")
|
|
448
448
|
end
|
|
449
449
|
|
|
450
450
|
# Update a draft credential schema
|
|
451
451
|
#
|
|
452
452
|
# @return [Hash]
|
|
453
453
|
def update(id:, body: nil, idempotency_key: nil)
|
|
454
|
-
@client.patch("/
|
|
454
|
+
@client.patch("/v1/issuer/schemas/#{id}", body: body, idempotency_key: idempotency_key)
|
|
455
455
|
end
|
|
456
456
|
|
|
457
457
|
# Delete a draft credential schema
|
|
458
458
|
#
|
|
459
459
|
# @return [Hash]
|
|
460
460
|
def delete(id:)
|
|
461
|
-
@client.delete("/
|
|
461
|
+
@client.delete("/v1/issuer/schemas/#{id}")
|
|
462
462
|
end
|
|
463
463
|
|
|
464
464
|
# Activate a draft credential schema
|
|
465
465
|
#
|
|
466
466
|
# @return [Hash]
|
|
467
467
|
def activate(id:, idempotency_key: nil)
|
|
468
|
-
@client.post("/
|
|
468
|
+
@client.post("/v1/issuer/schemas/#{id}/activate", idempotency_key: idempotency_key)
|
|
469
469
|
end
|
|
470
470
|
|
|
471
471
|
# Archive an active credential schema
|
|
472
472
|
#
|
|
473
473
|
# @return [Hash]
|
|
474
474
|
def archive(id:, idempotency_key: nil)
|
|
475
|
-
@client.post("/
|
|
475
|
+
@client.post("/v1/issuer/schemas/#{id}/archive", idempotency_key: idempotency_key)
|
|
476
476
|
end
|
|
477
477
|
end
|
|
478
478
|
|
|
@@ -488,14 +488,14 @@ module AhoSdk
|
|
|
488
488
|
#
|
|
489
489
|
# @return [Hash]
|
|
490
490
|
def get(uuid:)
|
|
491
|
-
@client.get("/
|
|
491
|
+
@client.get("/v1/issuer/verify/#{uuid}")
|
|
492
492
|
end
|
|
493
493
|
|
|
494
494
|
# Verify a credential
|
|
495
495
|
#
|
|
496
496
|
# @return [Hash]
|
|
497
497
|
def create(body: nil, idempotency_key: nil)
|
|
498
|
-
@client.post("/
|
|
498
|
+
@client.post("/v1/issuer/verify", body: body, idempotency_key: idempotency_key)
|
|
499
499
|
end
|
|
500
500
|
end
|
|
501
501
|
end
|
data/lib/aho_sdk/schemas.rb
CHANGED
|
@@ -15,10 +15,10 @@ module AhoSdk
|
|
|
15
15
|
#
|
|
16
16
|
class Schemas
|
|
17
17
|
# @param api_key [String] API key for authentication
|
|
18
|
-
# @param base_url [String] Base URL (default: https://aho.com)
|
|
18
|
+
# @param base_url [String] Base URL (default: https://api.aho.com)
|
|
19
19
|
# @param timeout [Integer] Request timeout in seconds (default: 30)
|
|
20
20
|
# @param logger [Logger] Optional logger for debugging
|
|
21
|
-
def initialize(api_key:, base_url: "https://aho.com", timeout: 30, logger: nil)
|
|
21
|
+
def initialize(api_key:, base_url: "https://api.aho.com", timeout: 30, logger: nil)
|
|
22
22
|
@client = HttpClient.new(api_key: api_key, base_url: base_url, timeout: timeout, logger: logger)
|
|
23
23
|
@render_templates = RenderTemplatesResource.new(@client)
|
|
24
24
|
end
|
|
@@ -40,7 +40,7 @@ module AhoSdk
|
|
|
40
40
|
# @return [Hash]
|
|
41
41
|
def list(schema_id:)
|
|
42
42
|
fetch_page = ->(p) {
|
|
43
|
-
response = @client.get("/
|
|
43
|
+
response = @client.get("/v1/schemas/#{schema_id}/render_templates")
|
|
44
44
|
Page.new(data: response[:data], meta: response[:meta], fetch_next: fetch_page)
|
|
45
45
|
}
|
|
46
46
|
fetch_page.call(1)
|
|
@@ -50,35 +50,35 @@ module AhoSdk
|
|
|
50
50
|
#
|
|
51
51
|
# @return [Hash]
|
|
52
52
|
def create(schema_id:, body: nil, idempotency_key: nil)
|
|
53
|
-
@client.post("/
|
|
53
|
+
@client.post("/v1/schemas/#{schema_id}/render_templates", body: body, idempotency_key: idempotency_key)
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
# Get render template
|
|
57
57
|
#
|
|
58
58
|
# @return [Hash]
|
|
59
59
|
def get(schema_id:, id:)
|
|
60
|
-
@client.get("/
|
|
60
|
+
@client.get("/v1/schemas/#{schema_id}/render_templates/#{id}")
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
# Update render template
|
|
64
64
|
#
|
|
65
65
|
# @return [Hash]
|
|
66
66
|
def update(schema_id:, id:, body: nil, idempotency_key: nil)
|
|
67
|
-
@client.patch("/
|
|
67
|
+
@client.patch("/v1/schemas/#{schema_id}/render_templates/#{id}", body: body, idempotency_key: idempotency_key)
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
# Delete render template
|
|
71
71
|
#
|
|
72
72
|
# @return [Hash]
|
|
73
73
|
def delete(schema_id:, id:)
|
|
74
|
-
@client.delete("/
|
|
74
|
+
@client.delete("/v1/schemas/#{schema_id}/render_templates/#{id}")
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
# Validate template
|
|
78
78
|
#
|
|
79
79
|
# @return [Hash]
|
|
80
80
|
def validate(schema_id:, body: nil, idempotency_key: nil)
|
|
81
|
-
@client.post("/
|
|
81
|
+
@client.post("/v1/schemas/#{schema_id}/render_templates/validate", body: body, idempotency_key: idempotency_key)
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
84
|
end
|
data/lib/aho_sdk/system.rb
CHANGED
|
@@ -15,10 +15,10 @@ module AhoSdk
|
|
|
15
15
|
#
|
|
16
16
|
class System
|
|
17
17
|
# @param api_key [String] API key for authentication
|
|
18
|
-
# @param base_url [String] Base URL (default: https://aho.com)
|
|
18
|
+
# @param base_url [String] Base URL (default: https://api.aho.com)
|
|
19
19
|
# @param timeout [Integer] Request timeout in seconds (default: 30)
|
|
20
20
|
# @param logger [Logger] Optional logger for debugging
|
|
21
|
-
def initialize(api_key:, base_url: "https://aho.com", timeout: 30, logger: nil)
|
|
21
|
+
def initialize(api_key:, base_url: "https://api.aho.com", timeout: 30, logger: nil)
|
|
22
22
|
@client = HttpClient.new(api_key: api_key, base_url: base_url, timeout: timeout, logger: logger)
|
|
23
23
|
@health = HealthResource.new(@client)
|
|
24
24
|
end
|
|
@@ -39,7 +39,7 @@ module AhoSdk
|
|
|
39
39
|
#
|
|
40
40
|
# @return [Hash]
|
|
41
41
|
def get
|
|
42
|
-
@client.get("/
|
|
42
|
+
@client.get("/v1/health")
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
end
|
|
@@ -10,14 +10,14 @@ module AhoSdk
|
|
|
10
10
|
# Public endpoints (no authentication required)
|
|
11
11
|
#
|
|
12
12
|
# @example
|
|
13
|
-
# client = AhoSdk::
|
|
13
|
+
# client = AhoSdk::Unauthenticated.new
|
|
14
14
|
# client.schemas.list
|
|
15
15
|
#
|
|
16
|
-
class
|
|
17
|
-
# @param base_url [String] Base URL (default: https://aho.com)
|
|
16
|
+
class Unauthenticated
|
|
17
|
+
# @param base_url [String] Base URL (default: https://api.aho.com)
|
|
18
18
|
# @param timeout [Integer] Request timeout in seconds (default: 30)
|
|
19
19
|
# @param logger [Logger] Optional logger for debugging
|
|
20
|
-
def initialize(base_url: "https://aho.com", timeout: 30, logger: nil)
|
|
20
|
+
def initialize(base_url: "https://api.aho.com", timeout: 30, logger: nil)
|
|
21
21
|
@client = HttpClient.new(api_key: nil, base_url: base_url, timeout: timeout, logger: logger)
|
|
22
22
|
@schemas = SchemasResource.new(@client)
|
|
23
23
|
end
|
|
@@ -34,12 +34,12 @@ module AhoSdk
|
|
|
34
34
|
@client = client
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
#
|
|
37
|
+
# Browse public credential schemas
|
|
38
38
|
#
|
|
39
39
|
# @return [Hash]
|
|
40
40
|
def list(category: nil, tag: nil, q: nil, page: nil, per_page: nil)
|
|
41
41
|
fetch_page = ->(p) {
|
|
42
|
-
response = @client.get("/
|
|
42
|
+
response = @client.get("/v1/schemas", params: { category: category, tag: tag, q: q, page: p, per_page: per_page })
|
|
43
43
|
Page.new(data: response[:data], meta: response[:meta], fetch_next: fetch_page)
|
|
44
44
|
}
|
|
45
45
|
fetch_page.call(page)
|
|
@@ -50,7 +50,7 @@ module AhoSdk
|
|
|
50
50
|
# @return [Hash]
|
|
51
51
|
def get(slug:)
|
|
52
52
|
fetch_page = ->(p) {
|
|
53
|
-
response = @client.get("/
|
|
53
|
+
response = @client.get("/v1/schemas/#{slug}")
|
|
54
54
|
Page.new(data: response[:data], meta: response[:meta], fetch_next: fetch_page)
|
|
55
55
|
}
|
|
56
56
|
fetch_page.call(1)
|
data/lib/aho_sdk/verifier.rb
CHANGED
|
@@ -12,23 +12,31 @@ module AhoSdk
|
|
|
12
12
|
# @example
|
|
13
13
|
# client = AhoSdk::Verifier.new(api_key: ENV["AHO_VERIFIER_API_KEY"])
|
|
14
14
|
# client.presentations.list
|
|
15
|
+
# client.dc_sessions.list
|
|
16
|
+
# client.render.list
|
|
15
17
|
# client.requests.list
|
|
16
18
|
# client.responses.list
|
|
17
19
|
#
|
|
18
20
|
class Verifier
|
|
19
21
|
# @param api_key [String] API key for authentication
|
|
20
|
-
# @param base_url [String] Base URL (default: https://aho.com)
|
|
22
|
+
# @param base_url [String] Base URL (default: https://api.aho.com)
|
|
21
23
|
# @param timeout [Integer] Request timeout in seconds (default: 30)
|
|
22
24
|
# @param logger [Logger] Optional logger for debugging
|
|
23
|
-
def initialize(api_key:, base_url: "https://aho.com", timeout: 30, logger: nil)
|
|
25
|
+
def initialize(api_key:, base_url: "https://api.aho.com", timeout: 30, logger: nil)
|
|
24
26
|
@client = HttpClient.new(api_key: api_key, base_url: base_url, timeout: timeout, logger: logger)
|
|
25
27
|
@presentations = PresentationsResource.new(@client)
|
|
28
|
+
@dc_sessions = DcSessionsResource.new(@client)
|
|
29
|
+
@render = RenderResource.new(@client)
|
|
26
30
|
@requests = RequestsResource.new(@client)
|
|
27
31
|
@responses = ResponsesResource.new(@client)
|
|
28
32
|
end
|
|
29
33
|
|
|
30
34
|
# @return [PresentationsResource]
|
|
31
35
|
attr_reader :presentations
|
|
36
|
+
# @return [DcSessionsResource]
|
|
37
|
+
attr_reader :dc_sessions
|
|
38
|
+
# @return [RenderResource]
|
|
39
|
+
attr_reader :render
|
|
32
40
|
# @return [RequestsResource]
|
|
33
41
|
attr_reader :requests
|
|
34
42
|
# @return [ResponsesResource]
|
|
@@ -47,7 +55,60 @@ module AhoSdk
|
|
|
47
55
|
#
|
|
48
56
|
# @return [Hash]
|
|
49
57
|
def verify(body: nil, idempotency_key: nil)
|
|
50
|
-
@client.post("/
|
|
58
|
+
@client.post("/v1/verifier/presentations/verify", body: body, idempotency_key: idempotency_key)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Dc_sessions resource operations
|
|
63
|
+
# @api private
|
|
64
|
+
class DcSessionsResource
|
|
65
|
+
# @api private
|
|
66
|
+
def initialize(client)
|
|
67
|
+
@client = client
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Create a DC API session
|
|
71
|
+
#
|
|
72
|
+
# @return [Hash]
|
|
73
|
+
def create(body: nil, idempotency_key: nil)
|
|
74
|
+
@client.post("/v1/verifier/dc_sessions", body: body, idempotency_key: idempotency_key)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Get DC API session status
|
|
78
|
+
#
|
|
79
|
+
# @return [Hash]
|
|
80
|
+
def get(id:)
|
|
81
|
+
@client.get("/v1/verifier/dc_sessions/#{id}")
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Verify a DC API session
|
|
85
|
+
#
|
|
86
|
+
# @return [Hash]
|
|
87
|
+
def verify(id:, body: nil, idempotency_key: nil)
|
|
88
|
+
@client.post("/v1/verifier/dc_sessions/#{id}/verify", body: body, idempotency_key: idempotency_key)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Render resource operations
|
|
93
|
+
# @api private
|
|
94
|
+
class RenderResource
|
|
95
|
+
# @api private
|
|
96
|
+
def initialize(client)
|
|
97
|
+
@client = client
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Render verified claims as visual credential
|
|
101
|
+
#
|
|
102
|
+
# @return [Hash]
|
|
103
|
+
def list(id:, format: nil)
|
|
104
|
+
@client.get("/v1/verifier/dc_sessions/#{id}/render", params: { format: format })
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Render claims as visual credential
|
|
108
|
+
#
|
|
109
|
+
# @return [Hash]
|
|
110
|
+
def create(body: nil, idempotency_key: nil)
|
|
111
|
+
@client.post("/v1/verifier/render", body: body, idempotency_key: idempotency_key)
|
|
51
112
|
end
|
|
52
113
|
end
|
|
53
114
|
|
|
@@ -63,15 +124,15 @@ module AhoSdk
|
|
|
63
124
|
#
|
|
64
125
|
# @return [Hash]
|
|
65
126
|
def create(body: nil, idempotency_key: nil)
|
|
66
|
-
@client.post("/
|
|
127
|
+
@client.post("/v1/verifier/requests", body: body, idempotency_key: idempotency_key)
|
|
67
128
|
end
|
|
68
129
|
|
|
69
130
|
# List presentation requests
|
|
70
131
|
#
|
|
71
132
|
# @return [Hash]
|
|
72
|
-
def list(status: nil, page:
|
|
133
|
+
def list(status: nil, page: nil, per_page: nil)
|
|
73
134
|
fetch_page = ->(p) {
|
|
74
|
-
response = @client.get("/
|
|
135
|
+
response = @client.get("/v1/verifier/requests", params: { status: status, page: p, per_page: per_page })
|
|
75
136
|
Page.new(data: response[:data], meta: response[:meta], fetch_next: fetch_page)
|
|
76
137
|
}
|
|
77
138
|
fetch_page.call(page)
|
|
@@ -81,44 +142,44 @@ module AhoSdk
|
|
|
81
142
|
#
|
|
82
143
|
# @return [Hash]
|
|
83
144
|
def get(uuid:)
|
|
84
|
-
@client.get("/
|
|
145
|
+
@client.get("/v1/verifier/requests/#{uuid}")
|
|
85
146
|
end
|
|
86
147
|
|
|
87
148
|
# Update a draft presentation request
|
|
88
149
|
#
|
|
89
150
|
# @return [Hash]
|
|
90
151
|
def update(uuid:, body: nil, idempotency_key: nil)
|
|
91
|
-
@client.patch("/
|
|
152
|
+
@client.patch("/v1/verifier/requests/#{uuid}", body: body, idempotency_key: idempotency_key)
|
|
92
153
|
end
|
|
93
154
|
|
|
94
155
|
# Delete a draft presentation request
|
|
95
156
|
#
|
|
96
157
|
# @return [Hash]
|
|
97
158
|
def delete(uuid:)
|
|
98
|
-
@client.delete("/
|
|
159
|
+
@client.delete("/v1/verifier/requests/#{uuid}")
|
|
99
160
|
end
|
|
100
161
|
|
|
101
162
|
# Activate a draft presentation request
|
|
102
163
|
#
|
|
103
164
|
# @return [Hash]
|
|
104
165
|
def activate(uuid:, idempotency_key: nil)
|
|
105
|
-
@client.post("/
|
|
166
|
+
@client.post("/v1/verifier/requests/#{uuid}/activate", idempotency_key: idempotency_key)
|
|
106
167
|
end
|
|
107
168
|
|
|
108
169
|
# Close an active presentation request
|
|
109
170
|
#
|
|
110
171
|
# @return [Hash]
|
|
111
172
|
def close(uuid:, idempotency_key: nil)
|
|
112
|
-
@client.post("/
|
|
173
|
+
@client.post("/v1/verifier/requests/#{uuid}/close", idempotency_key: idempotency_key)
|
|
113
174
|
end
|
|
114
175
|
|
|
115
176
|
# Get QR code for presentation request
|
|
116
177
|
#
|
|
117
178
|
# @return [String]
|
|
118
|
-
def qr_code(uuid:, format:
|
|
179
|
+
def qr_code(uuid:, format: nil, output_format: :svg)
|
|
119
180
|
format_map = { svg: "image/svg+xml", png: "image/png", json: "application/json" }
|
|
120
181
|
accept = format_map[output_format] || format_map.values.first
|
|
121
|
-
@client.get("/
|
|
182
|
+
@client.get("/v1/verifier/requests/#{uuid}/qr_code", params: { format: format }, accept: accept)
|
|
122
183
|
end
|
|
123
184
|
end
|
|
124
185
|
|
|
@@ -133,9 +194,9 @@ module AhoSdk
|
|
|
133
194
|
# List responses for a presentation request
|
|
134
195
|
#
|
|
135
196
|
# @return [Hash]
|
|
136
|
-
def list(request_uuid:, status: nil, page:
|
|
197
|
+
def list(request_uuid:, status: nil, page: nil, per_page: nil)
|
|
137
198
|
fetch_page = ->(p) {
|
|
138
|
-
response = @client.get("/
|
|
199
|
+
response = @client.get("/v1/verifier/requests/#{request_uuid}/responses", params: { status: status, page: p, per_page: per_page })
|
|
139
200
|
Page.new(data: response[:data], meta: response[:meta], fetch_next: fetch_page)
|
|
140
201
|
}
|
|
141
202
|
fetch_page.call(page)
|
|
@@ -145,7 +206,7 @@ module AhoSdk
|
|
|
145
206
|
#
|
|
146
207
|
# @return [Hash]
|
|
147
208
|
def get(request_uuid:, uuid:)
|
|
148
|
-
@client.get("/
|
|
209
|
+
@client.get("/v1/verifier/requests/#{request_uuid}/responses/#{uuid}")
|
|
149
210
|
end
|
|
150
211
|
end
|
|
151
212
|
end
|
data/lib/aho_sdk/version.rb
CHANGED
data/lib/aho_sdk.rb
CHANGED
|
@@ -18,71 +18,70 @@ require_relative "aho_sdk/issuer"
|
|
|
18
18
|
|
|
19
19
|
require_relative "aho_sdk/schemas"
|
|
20
20
|
|
|
21
|
-
require_relative "aho_sdk/
|
|
21
|
+
require_relative "aho_sdk/unauthenticated"
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
module AhoSdk
|
|
25
25
|
class << self
|
|
26
26
|
# Create a new Account client
|
|
27
27
|
# @param api_key [String] API key for authentication
|
|
28
|
-
# @param base_url [String] Base URL (default: https://aho.com)
|
|
28
|
+
# @param base_url [String] Base URL (default: https://api.aho.com)
|
|
29
29
|
# @return [Account]
|
|
30
|
-
def account(api_key:, base_url: "https://aho.com")
|
|
30
|
+
def account(api_key:, base_url: "https://api.aho.com")
|
|
31
31
|
Account.new(api_key: api_key, base_url: base_url)
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
# Create a new System client
|
|
36
36
|
# @param api_key [String] API key for authentication
|
|
37
|
-
# @param base_url [String] Base URL (default: https://aho.com)
|
|
37
|
+
# @param base_url [String] Base URL (default: https://api.aho.com)
|
|
38
38
|
# @return [System]
|
|
39
|
-
def system(api_key:, base_url: "https://aho.com")
|
|
39
|
+
def system(api_key:, base_url: "https://api.aho.com")
|
|
40
40
|
System.new(api_key: api_key, base_url: base_url)
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
# Create a new Holder client
|
|
45
45
|
# @param api_key [String] API key for authentication
|
|
46
|
-
# @param base_url [String] Base URL (default: https://aho.com)
|
|
46
|
+
# @param base_url [String] Base URL (default: https://api.aho.com)
|
|
47
47
|
# @return [Holder]
|
|
48
|
-
def holder(api_key:, base_url: "https://aho.com")
|
|
48
|
+
def holder(api_key:, base_url: "https://api.aho.com")
|
|
49
49
|
Holder.new(api_key: api_key, base_url: base_url)
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
# Create a new Verifier client
|
|
54
54
|
# @param api_key [String] API key for authentication
|
|
55
|
-
# @param base_url [String] Base URL (default: https://aho.com)
|
|
55
|
+
# @param base_url [String] Base URL (default: https://api.aho.com)
|
|
56
56
|
# @return [Verifier]
|
|
57
|
-
def verifier(api_key:, base_url: "https://aho.com")
|
|
57
|
+
def verifier(api_key:, base_url: "https://api.aho.com")
|
|
58
58
|
Verifier.new(api_key: api_key, base_url: base_url)
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
# Create a new Issuer client
|
|
63
63
|
# @param api_key [String] API key for authentication
|
|
64
|
-
# @param base_url [String] Base URL (default: https://aho.com)
|
|
64
|
+
# @param base_url [String] Base URL (default: https://api.aho.com)
|
|
65
65
|
# @return [Issuer]
|
|
66
|
-
def issuer(api_key:, base_url: "https://aho.com")
|
|
66
|
+
def issuer(api_key:, base_url: "https://api.aho.com")
|
|
67
67
|
Issuer.new(api_key: api_key, base_url: base_url)
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
# Create a new Schemas client
|
|
72
72
|
# @param api_key [String] API key for authentication
|
|
73
|
-
# @param base_url [String] Base URL (default: https://aho.com)
|
|
73
|
+
# @param base_url [String] Base URL (default: https://api.aho.com)
|
|
74
74
|
# @return [Schemas]
|
|
75
|
-
def schemas(api_key:, base_url: "https://aho.com")
|
|
75
|
+
def schemas(api_key:, base_url: "https://api.aho.com")
|
|
76
76
|
Schemas.new(api_key: api_key, base_url: base_url)
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
|
|
80
|
-
# Create a new
|
|
81
|
-
# @param
|
|
82
|
-
# @
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
Public.new(api_key: api_key, base_url: base_url)
|
|
80
|
+
# Create a new Unauthenticated client
|
|
81
|
+
# @param base_url [String] Base URL (default: https://api.aho.com)
|
|
82
|
+
# @return [Unauthenticated]
|
|
83
|
+
def unauthenticated(base_url: "https://api.aho.com")
|
|
84
|
+
Unauthenticated.new(base_url: base_url)
|
|
86
85
|
end
|
|
87
86
|
end
|
|
88
87
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: aho-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Aho
|
|
@@ -41,9 +41,9 @@ files:
|
|
|
41
41
|
- lib/aho_sdk/http_client.rb
|
|
42
42
|
- lib/aho_sdk/issuer.rb
|
|
43
43
|
- lib/aho_sdk/page.rb
|
|
44
|
-
- lib/aho_sdk/public.rb
|
|
45
44
|
- lib/aho_sdk/schemas.rb
|
|
46
45
|
- lib/aho_sdk/system.rb
|
|
46
|
+
- lib/aho_sdk/unauthenticated.rb
|
|
47
47
|
- lib/aho_sdk/verifier.rb
|
|
48
48
|
- lib/aho_sdk/version.rb
|
|
49
49
|
homepage: https://aho.com
|