hub_kernel-api 0.1.0 → 0.2.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 +4 -4
- data/README.md +8 -1
- data/lib/hub_kernel/api/version.rb +1 -1
- data/lib/hub_kernel/api.rb +3 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1ff8bff7f1990c004e388aac6bbfe08f93f6007263653962a93ee7589d185a24
|
|
4
|
+
data.tar.gz: f79790b1f3a26080b561ce6968142c39aa584742b0a5e037a231165ed00fd0d2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3d9ee144416f2ab53a5f66aa0e590ab7a784cec6519a49d89336c3dfe0df53bf6ce9ace1cda27644e9e5616ccf08f33bde8e5b04a30b8bc356153ccbffbc716f
|
|
7
|
+
data.tar.gz: fe2a86a74e9e47f6b78b3093d6ac29bd766d706b3b3024762a89f3e80d2936be896d90633b2860f78700cce2f25674035fd8e939d94472e5bd7967850e81993b
|
data/README.md
CHANGED
|
@@ -28,7 +28,14 @@ mount HubKernel::Api::Engine => "/api/v1/hubs"
|
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
Each exposed method answers at `/<hub>/<method>`, where `<hub>` is the hub's module name
|
|
31
|
-
underscored.
|
|
31
|
+
underscored. To answer at a name of the host's choosing, list the hub as a one-pair hash:
|
|
32
|
+
|
|
33
|
+
```ruby
|
|
34
|
+
HubKernel::Api.hubs = [ Supplies, { "money" => Billing::Ledger } ]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
A hub listed this way answers only at the name given, and the permission check is still
|
|
38
|
+
asked about it by its own name, such as `ledger:record_spend`. A read answers GET and a write answers POST, and the answer is the method's
|
|
32
39
|
return value under `answer`.
|
|
33
40
|
|
|
34
41
|
| Case | Status | Body |
|
data/lib/hub_kernel/api.rb
CHANGED
|
@@ -9,6 +9,8 @@ module HubKernel
|
|
|
9
9
|
mattr_accessor :person_method
|
|
10
10
|
mattr_accessor :account_method
|
|
11
11
|
|
|
12
|
-
def self.find(name) =
|
|
12
|
+
def self.find(name) = addresses[name]
|
|
13
|
+
|
|
14
|
+
def self.addresses = hubs.reduce({}) { |found, entry| found.merge(entry.is_a?(Hash) ? entry : { entry.name.demodulize.underscore => entry }) }
|
|
13
15
|
end
|
|
14
16
|
end
|