navigable-server 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/navigable/server.rb +1 -0
- data/lib/navigable/server/endpoint_command.rb +41 -0
- data/lib/navigable/server/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9290813f3f31d905b2d7dc3a39700b23da833d04ea3397ef09a08af3fa78e3cd
|
4
|
+
data.tar.gz: a067219239e0d23bb0fde60c641fa5dbe19fe24cf9d8a52f07ef0c59d87c576d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd4f369eab8a65a32dbef752cb3d315584d3390981ba3784050876382f6cf1974fb2652500b61a865e33c2f577f33ea5a7d35bf5878a6714fb38f1303c5144d1
|
7
|
+
data.tar.gz: a17f8c2565b80ae4ea06809b057a2dc7227ce1dd6a55e50edd1babbdaa39857b6dc4a410b5a97a233ae3b06949c92997fc4c53b4ab00b1fa85e63e6dcd183557
|
data/lib/navigable/server.rb
CHANGED
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Navigable
|
4
|
+
module Server
|
5
|
+
module EndpointCommand
|
6
|
+
def self.extended(base)
|
7
|
+
base.extend(Navigable::Command)
|
8
|
+
base.extend(ClassMethods)
|
9
|
+
end
|
10
|
+
|
11
|
+
module ClassMethods
|
12
|
+
def responds_to(verb, path)
|
13
|
+
@responds_to_proc ||= Proc.new do |endpoint_klass|
|
14
|
+
endpoint_klass.responds_to(verb, path)
|
15
|
+
end
|
16
|
+
|
17
|
+
setup_endpoint_command if ready_for_setup?
|
18
|
+
end
|
19
|
+
|
20
|
+
def corresponds_to(command_key)
|
21
|
+
@corresponds_to_proc ||= Proc.new do |endpoint_klass, command_klass|
|
22
|
+
endpoint_klass.executes(command_key)
|
23
|
+
super(command_key)
|
24
|
+
end
|
25
|
+
|
26
|
+
setup_endpoint_command if ready_for_setup?
|
27
|
+
end
|
28
|
+
|
29
|
+
def setup_endpoint_command
|
30
|
+
endpoint_klass = Class.new { extend Navigable::Server::Endpoint }
|
31
|
+
@responds_to_proc.call(endpoint_klass)
|
32
|
+
@corresponds_to_proc.call(endpoint_klass, self)
|
33
|
+
end
|
34
|
+
|
35
|
+
def ready_for_setup?
|
36
|
+
@responds_to_proc && @corresponds_to_proc
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: navigable-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alan Ridlehoover
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-01-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
@@ -185,6 +185,7 @@ files:
|
|
185
185
|
- lib/navigable/server.rb
|
186
186
|
- lib/navigable/server/cors.rb
|
187
187
|
- lib/navigable/server/endpoint.rb
|
188
|
+
- lib/navigable/server/endpoint_command.rb
|
188
189
|
- lib/navigable/server/parsers/factory.rb
|
189
190
|
- lib/navigable/server/parsers/json.rb
|
190
191
|
- lib/navigable/server/parsers/null.rb
|