Module: Drillbit::AuthorizableResource::ClassMethods

Defined in:
lib/drillbit/authorizable_resource.rb

Instance Method Summary collapse

Instance Method Details

#authorizer_classObject



15
16
17
18
19
20
21
22
# File 'lib/drillbit/authorizable_resource.rb', line 15

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

#authorizer_filtering_params_classObject



44
45
46
47
48
49
50
51
52
# File 'lib/drillbit/authorizable_resource.rb', line 44

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

#authorizer_inclusions_params_classObject



54
55
56
57
58
59
60
61
62
# File 'lib/drillbit/authorizable_resource.rb', line 54

def authorizer_inclusions_params_class
  @authorizer_inclusions_params_class ||= "#{authorizer_prefix}" \
                                          "Authorizers::" \
                                          "#{resource_class_name}::" \
                                          "InclusionParameters"
                                            .constantize
rescue NameError
  'Drillbit::Authorizers::Parameters::Inclusions'.constantize
end

#authorizer_prefixObject



11
12
13
# File 'lib/drillbit/authorizable_resource.rb', line 11

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

#authorizer_resource_params_classObject



34
35
36
37
38
39
40
41
42
# File 'lib/drillbit/authorizable_resource.rb', line 34

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

#authorizer_scope_classObject



24
25
26
27
28
29
30
31
32
# File 'lib/drillbit/authorizable_resource.rb', line 24

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