Module: Jets::Router::Route::Authorization

Extended by:
ActiveSupport::Concern
Included in:
Jets::Router::Route
Defined in:
lib/jets/router/route/authorization.rb

Instance Method Summary collapse

Instance Method Details

#api_key_requiredObject



38
39
40
# File 'lib/jets/router/route/authorization.rb', line 38

def api_key_required
  @options[:api_key_required]
end

#authorization_typeObject



34
35
36
# File 'lib/jets/router/route/authorization.rb', line 34

def authorization_type
  @options[:authorization_type] || inferred_authorization_type
end

#authorizerObject



30
31
32
# File 'lib/jets/router/route/authorization.rb', line 30

def authorizer
  @options[:authorizer]
end

#authorizer_id(prefix_class: true) ⇒ Object

IE: main#protect => MainProtectAuthorizer



16
17
18
19
# File 'lib/jets/router/route/authorization.rb', line 16

def authorizer_id(prefix_class: true)
  return unless authorizer
  self.class.authorizer_logical_id(authorizer, prefix_class: prefix_class)
end

#authorizer_metadataObject

Metadata about the authorizer class that can be used later. Stored in the Authorizer template parameters. In app_class.rb ‘def controller_params` it is used to build the input parameters for controller templates.



23
24
25
26
27
28
# File 'lib/jets/router/route/authorization.rb', line 23

def 
  klass = authorizer.split("#").first
  authorizer_class = "#{klass}_authorizer".camelize
  logical_id = authorizer_id(prefix_class: false)
  "#{authorizer_class}.#{logical_id}"
end