Class: ReeRoutes::Route
- Inherits:
-
Object
- Object
- ReeRoutes::Route
- Defined in:
- lib/ree_lib/packages/ree_routes/package/ree_routes/route.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#audit ⇒ Object
writeonly
Sets the attribute audit.
-
#before ⇒ Object
Returns the value of attribute before.
-
#override ⇒ Object
Returns the value of attribute override.
-
#path ⇒ Object
Returns the value of attribute path.
-
#redirect ⇒ Object
Returns the value of attribute redirect.
-
#request_method ⇒ Object
Returns the value of attribute request_method.
-
#respond_to ⇒ Object
Returns the value of attribute respond_to.
-
#route ⇒ Object
Returns the value of attribute route.
-
#sections ⇒ Object
Returns the value of attribute sections.
-
#serializer ⇒ Object
Returns the value of attribute serializer.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#visibility ⇒ Object
Returns the value of attribute visibility.
-
#warden_scopes ⇒ Object
Returns the value of attribute warden_scopes.
Instance Method Summary collapse
- #audit_declared? ⇒ Boolean
-
#audit_on_annotation? ⇒ Boolean
audit :on_annotation— a public route that the client calls for its own data and a staff member calls for someone else's. -
#audited? ⇒ Boolean
Auditing is declared at the route and nowhere else.
- #internal? ⇒ Boolean
-
#public? ⇒ Boolean
Routing always includes every route; visibility only affects generated docs.
- #valid? ⇒ Boolean
- #warden_scope ⇒ Object
- #warden_scope=(scope) ⇒ Object
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
4 5 6 |
# File 'lib/ree_lib/packages/ree_routes/package/ree_routes/route.rb', line 4 def action @action end |
#audit=(value) ⇒ Object (writeonly)
Sets the attribute audit
8 9 10 |
# File 'lib/ree_lib/packages/ree_routes/package/ree_routes/route.rb', line 8 def audit=(value) @audit = value end |
#before ⇒ Object
Returns the value of attribute before.
4 5 6 |
# File 'lib/ree_lib/packages/ree_routes/package/ree_routes/route.rb', line 4 def before @before end |
#override ⇒ Object
Returns the value of attribute override.
4 5 6 |
# File 'lib/ree_lib/packages/ree_routes/package/ree_routes/route.rb', line 4 def override @override end |
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/ree_lib/packages/ree_routes/package/ree_routes/route.rb', line 4 def path @path end |
#redirect ⇒ Object
Returns the value of attribute redirect.
4 5 6 |
# File 'lib/ree_lib/packages/ree_routes/package/ree_routes/route.rb', line 4 def redirect @redirect end |
#request_method ⇒ Object
Returns the value of attribute request_method.
4 5 6 |
# File 'lib/ree_lib/packages/ree_routes/package/ree_routes/route.rb', line 4 def request_method @request_method end |
#respond_to ⇒ Object
Returns the value of attribute respond_to.
4 5 6 |
# File 'lib/ree_lib/packages/ree_routes/package/ree_routes/route.rb', line 4 def respond_to @respond_to end |
#route ⇒ Object
Returns the value of attribute route.
4 5 6 |
# File 'lib/ree_lib/packages/ree_routes/package/ree_routes/route.rb', line 4 def route @route end |
#sections ⇒ Object
Returns the value of attribute sections.
4 5 6 |
# File 'lib/ree_lib/packages/ree_routes/package/ree_routes/route.rb', line 4 def sections @sections end |
#serializer ⇒ Object
Returns the value of attribute serializer.
4 5 6 |
# File 'lib/ree_lib/packages/ree_routes/package/ree_routes/route.rb', line 4 def serializer @serializer end |
#summary ⇒ Object
Returns the value of attribute summary.
4 5 6 |
# File 'lib/ree_lib/packages/ree_routes/package/ree_routes/route.rb', line 4 def summary @summary end |
#visibility ⇒ Object
Returns the value of attribute visibility.
4 5 6 |
# File 'lib/ree_lib/packages/ree_routes/package/ree_routes/route.rb', line 4 def visibility @visibility end |
#warden_scopes ⇒ Object
Returns the value of attribute warden_scopes.
4 5 6 |
# File 'lib/ree_lib/packages/ree_routes/package/ree_routes/route.rb', line 4 def warden_scopes @warden_scopes end |
Instance Method Details
#audit_declared? ⇒ Boolean
29 30 31 |
# File 'lib/ree_lib/packages/ree_routes/package/ree_routes/route.rb', line 29 def audit_declared? !@audit.nil? end |
#audit_on_annotation? ⇒ Boolean
audit :on_annotation — a public route that the client calls for its own
data and a staff member calls for someone else's. The event is always
assembled, but it only reaches the sink if the code annotated the call;
auditing such a route unconditionally would bury the staff access under
every ordinary client request.
38 39 40 |
# File 'lib/ree_lib/packages/ree_routes/package/ree_routes/route.rb', line 38 def audit_on_annotation? @audit == :on_annotation end |
#audited? ⇒ Boolean
Auditing is declared at the route and nowhere else. Deriving it from
visibility would work just as well and read far worse: whether a call
lands in the access trail is exactly the kind of fact that must be visible
where the route is written, not inferred from a flag that means something
else. audit is mandatory on admin paths (see DSL#define_route), so the
audited set still cannot drift away from the routes that touch client data.
25 26 27 |
# File 'lib/ree_lib/packages/ree_routes/package/ree_routes/route.rb', line 25 def audited? @audit == true || @audit == :on_annotation end |
#internal? ⇒ Boolean
15 16 17 |
# File 'lib/ree_lib/packages/ree_routes/package/ree_routes/route.rb', line 15 def internal? !public? end |
#public? ⇒ Boolean
Routing always includes every route; visibility only affects generated docs.
11 12 13 |
# File 'lib/ree_lib/packages/ree_routes/package/ree_routes/route.rb', line 11 def public? visibility.nil? || visibility == :public end |
#valid? ⇒ Boolean
42 43 44 |
# File 'lib/ree_lib/packages/ree_routes/package/ree_routes/route.rb', line 42 def valid? !action.nil? && !summary.nil? && !warden_scopes.nil? && !warden_scopes.empty? end |
#warden_scope ⇒ Object
50 51 52 |
# File 'lib/ree_lib/packages/ree_routes/package/ree_routes/route.rb', line 50 def warden_scope @warden_scopes&.first end |
#warden_scope=(scope) ⇒ Object
54 55 56 |
# File 'lib/ree_lib/packages/ree_routes/package/ree_routes/route.rb', line 54 def warden_scope=(scope) @warden_scopes = Array(scope) end |