Class: Rubino::API::Operations::Mode::ShowOperation

Inherits:
Object
  • Object
show all
Defined in:
lib/rubino/api/operations/mode/show_operation.rb

Overview

GET /v1/mode Returns the active mode and the list of valid modes so the web client can render a picker without hardcoding the set.

Instance Method Summary collapse

Instance Method Details

#call(_request) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/rubino/api/operations/mode/show_operation.rb', line 11

def call(_request)
  current = Rubino::Modes.current
  [200, {
    mode: current,
    description: Rubino::Modes.description(current),
    available: Rubino::Modes::ALL.map do |m|
      { mode: m, description: Rubino::Modes.description(m) }
    end
  }]
end