Module: Apill::AuthorizableResource::ClassMethods

Defined in:
lib/apill/authorizable_resource.rb

Instance Method Summary collapse

Instance Method Details

#authorizer_classObject



13
14
15
16
17
18
19
20
# File 'lib/apill/authorizable_resource.rb', line 13

def authorizer_class
  @authorizer_class ||= "#{authorizer_prefix}" \
                        'Authorizers::' \
                        "#{resource_class_name}".
                        constantize
rescue NameError
  'Apill::Authorizers::Query'.constantize
end

#authorizer_filtering_params_classObject



42
43
44
45
46
47
48
49
50
# File 'lib/apill/authorizable_resource.rb', line 42

def authorizer_filtering_params_class
  @authorizer_filtering_params_class ||= "#{authorizer_prefix}" \
                                         'Authorizers::' \
                                         "#{resource_class_name}::" \
                                         'FilteringParameters'.
                                         constantize
rescue NameError
  'Apill::Authorizers::Parameters::Filtering'.constantize
end

#authorizer_prefixObject



9
10
11
# File 'lib/apill/authorizable_resource.rb', line 9

def authorizer_prefix
  @authorizer_prefix ||= name[Resource::Naming::CONTROLLER_RESOURCE_NAME_PATTERN, 2]
end

#authorizer_resource_params_classObject



32
33
34
35
36
37
38
39
40
# File 'lib/apill/authorizable_resource.rb', line 32

def authorizer_resource_params_class
  @authorizer_resource_params_class ||= "#{authorizer_prefix}" \
                                        'Authorizers::' \
                                        "#{resource_class_name}" \
                                        '::ResourceParameters'.
                                        constantize
rescue NameError
  'Apill::Authorizers::Parameters::Resource'.constantize
end

#authorizer_scope_classObject



22
23
24
25
26
27
28
29
30
# File 'lib/apill/authorizable_resource.rb', line 22

def authorizer_scope_class
  @authorizer_scope_class ||= "#{authorizer_prefix}" \
                              'Authorizers::' \
                              "#{resource_class_name}" \
                              '::Scope'.
                              constantize
rescue NameError
  'Apill::Authorizers::Scope'.constantize
end