Class: Rubino::API::Operations::OAuth::Providers::ListOperation

Inherits:
Object
  • Object
show all
Defined in:
lib/rubino/api/operations/oauth/providers/list_operation.rb

Overview

GET /v1/oauth/providers Lists OAuth providers registered at boot, with their default scopes.

Instance Method Summary collapse

Constructor Details

#initialize(registry: ::Rubino::OAuth::Registry) ⇒ ListOperation

Accepts an alternate provider registry for tests.



12
13
14
# File 'lib/rubino/api/operations/oauth/providers/list_operation.rb', line 12

def initialize(registry: ::Rubino::OAuth::Registry)
  @registry = registry
end

Instance Method Details

#call(_request) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/rubino/api/operations/oauth/providers/list_operation.rb', line 16

def call(_request)
  providers = @registry.all.map do |p|
    {
      id: p.id,
      display_name: p.class.display_name,
      scopes: p.scopes
    }
  end
  [200, providers]
end