Skip to content

Commit b6614b4

Browse files
committed
Implement RPC API
1 parent bf1ddd3 commit b6614b4

3 files changed

Lines changed: 7 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
## 0.1 2025-06-17
22

3-
- Implement context param validation
3+
- Implement RPC API controller
4+
- Implement Context with parameter validation
45
- Preliminary version

lib/syntropy/rpc_api.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66

77
module Syntropy
88
class RPCAPI
9-
def initialize(mount_path)
10-
@mount_path = mount_path
11-
end
12-
139
def call(ctx)
1410
response, status = invoke(ctx)
1511
ctx.request.respond(

test/test_rpc_api.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def set!(ctx)
1515
end
1616

1717
def setup
18-
@app = TestAPI.new('/api/v1')
18+
@app = TestAPI.new
1919
end
2020

2121
def test_kernel_version
@@ -25,24 +25,24 @@ def test_kernel_version
2525
end
2626

2727
def test_rpc_api
28-
req = mock_req(':method' => 'GET', ':path' => '/foo')
28+
req = mock_req(':method' => 'GET', ':path' => '/')
2929
ctx = Syntropy::Context.new(req)
3030
@app.call(ctx)
3131
assert_equal Qeweney::Status::BAD_REQUEST, req.response_status
3232

33-
req = mock_req(':method' => 'GET', ':path' => '/foo?q=get')
33+
req = mock_req(':method' => 'GET', ':path' => '/?q=get')
3434
ctx = Syntropy::Context.new(req)
3535
@app.call(ctx)
3636
assert_equal Qeweney::Status::OK, req.response_status
3737
assert_equal({ status: 'OK', response: nil }, req.response_json)
3838

39-
req = mock_req(':method' => 'POST', ':path' => '/foo?q=set&v=foo')
39+
req = mock_req(':method' => 'POST', ':path' => '/?q=set&v=foo')
4040
ctx = Syntropy::Context.new(req)
4141
@app.call(ctx)
4242
assert_equal Qeweney::Status::OK, req.response_status
4343
assert_equal({ status: 'OK', response: true }, req.response_json)
4444

45-
req = mock_req(':method' => 'GET', ':path' => '/foo?q=get')
45+
req = mock_req(':method' => 'GET', ':path' => '/?q=get')
4646
ctx = Syntropy::Context.new(req)
4747
@app.call(ctx)
4848
assert_equal Qeweney::Status::OK, req.response_status

0 commit comments

Comments
 (0)