roda-endpoints 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e63ead2c011c6f56649e0e2b415888e59c3da9b
|
4
|
+
data.tar.gz: 1103b4c76e38b565eea322ad02f7e1eda7e0ca90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a5d7d870f36259ffc222e569c8c4b96e71c0107675fdcc0f1912a9ddc82973d96e395e77193c2e60ca29c5233078147907aa86b7b955e57d43521d677e919f1
|
7
|
+
data.tar.gz: c76f5fead6207851a7b0c312f2cefcede79fdda9c258c51567e691073d442b37d190db52b1faebee8fba9d2cb06367cc118f6335d629dd20a8b82f6da2df6dfe
|
@@ -30,7 +30,12 @@ class Roda
|
|
30
30
|
# @param [Symbol] name
|
31
31
|
# @param [Hash] params
|
32
32
|
def child(name: item_name, type: Item, **params)
|
33
|
-
super(
|
33
|
+
super(
|
34
|
+
name: name,
|
35
|
+
type: type,
|
36
|
+
last_modified: @last_modified || Undefined,
|
37
|
+
**params
|
38
|
+
)
|
34
39
|
end
|
35
40
|
|
36
41
|
# @return [Symbol]
|
@@ -37,7 +37,7 @@ class Roda
|
|
37
37
|
|
38
38
|
# @return [ROM::Struct]
|
39
39
|
def entity
|
40
|
-
@entity ||= fetch_entity
|
40
|
+
@entity ||= fetch_entity if id
|
41
41
|
end
|
42
42
|
|
43
43
|
attr_writer :entity
|
@@ -49,7 +49,7 @@ class Roda
|
|
49
49
|
|
50
50
|
# @return [Time]
|
51
51
|
def last_modified
|
52
|
-
@last_modified ? entity.public_send(@last_modified) : super
|
52
|
+
@last_modified && entity ? entity.public_send(@last_modified) : super
|
53
53
|
end
|
54
54
|
|
55
55
|
route do |r, endpoint|
|
@@ -97,11 +97,13 @@ class Roda
|
|
97
97
|
item: { on: :id },
|
98
98
|
type: Roda::Endpoints::Endpoint::Collection,
|
99
99
|
on: name.to_s,
|
100
|
+
parent: root_endpoint,
|
100
101
|
**kwargs)
|
101
102
|
endpoint name: name,
|
102
103
|
item: item,
|
103
104
|
type: type,
|
104
105
|
on: on,
|
106
|
+
parent: parent,
|
105
107
|
**kwargs do |endpoint|
|
106
108
|
yield endpoint if block_given?
|
107
109
|
end
|
@@ -179,6 +181,7 @@ class Roda
|
|
179
181
|
parent: current_endpoint,
|
180
182
|
on: name,
|
181
183
|
**kwargs)
|
184
|
+
parent ||= root_endpoint
|
182
185
|
on on do |*captures|
|
183
186
|
with_current_endpoint parent.child(
|
184
187
|
name: name,
|
@@ -226,11 +229,15 @@ class Roda
|
|
226
229
|
|
227
230
|
# @return [<Endpoint>]
|
228
231
|
def endpoints
|
229
|
-
@endpoints ||= [
|
232
|
+
@endpoints ||= [root_endpoint]
|
233
|
+
end
|
234
|
+
|
235
|
+
def root_endpoint
|
236
|
+
@root_endpoint ||= Roda::Endpoints::Endpoint.new(
|
230
237
|
name: :root,
|
231
238
|
ns: nil,
|
232
239
|
container: roda_class.opts[:endpoints][:container]
|
233
|
-
)
|
240
|
+
)
|
234
241
|
end
|
235
242
|
|
236
243
|
def with_current_endpoint(endpoint)
|