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.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(request) ⇒ Object



11
12
13
# File 'lib/rubino/api/operations/mode/show_operation.rb', line 11

def self.call(request)
  new.call(request)
end

Instance Method Details

#call(_request) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/rubino/api/operations/mode/show_operation.rb', line 15

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