Class: Labimotion::KlassShareAPI
- Inherits:
-
Grape::API
- Object
- Grape::API
- Labimotion::KlassShareAPI
- Defined in:
- lib/labimotion/apis/klass_share_api.rb
Overview
Share management for generic templates (template-sharing.md §7). Its own API class, not more namespaces in GenericKlassAPI, so the spec harness can load and mount it alone.
Grant and level-change accept viewer/editor only: the owner level never moves through these routes. It moves through transfer_ownership, an update of the single owner row, so the one-owner-per-klass invariant holds at every instant and the handover is auditable.
request_access is the one route a non-holder may call, and it writes the one level the others refuse: 0, which grants nothing and only records the ask.
Metrics/ClassLength is disabled for the same reason Metrics/BlockLength is on the helpers
below: almost none of this is logic. It is Grape route DSL — a desc, a params block and
a body per endpoint — and the cop counts every declaration and rescue clause as a class
line. Splitting the routes across classes to satisfy it would scatter one coherent surface
(/generic_klass/shares…) over several files.
Constant Summary collapse
- MAX_ROW_KEYS =
How many rows one batch read may ask for. The poller is the caller, so the bound is about the payload rather than the client's patience: fifty klass entities carry fifty properties_templates, which is already a large response, and a Designer whose diff names more keys than that has effectively had its whole grid change — it can fall back to the list endpoint it was trying to avoid. Refused rather than truncated: a silently short answer would leave the client believing the missing keys were deleted.
50