Class: Praxis::Plugins::MapperPlugin::Plugin

Inherits:
Praxis::Plugin show all
Includes:
Singleton
Defined in:
lib/praxis/plugins/mapper_plugin.rb

Overview

The Mapper plugin is an overarching set of things to include in your application when you want to use the rendring, field_selection, filtering (and potentially pagination) extensions To use the plugin, set it up like any other plugin by registering to the bootloader. Typically you’d do that in environment.rb, inside the ‘Praxis::Application.configure do |application|` block, by:

application.bootloader.use Praxis::Plugins::MapperPlugin

The plugin accepts only 1 configuration option thus far, which you can set inside the same block as:

application.config.mapper.debug_queries = true

when debug_queries is set to true, the system will output information about the expanded fields and associations that the system ihas calculated necessary to pull from the DB, based on the requested API fields, API filters and ‘property` dependencies defined in the domain models (i.e., resources)

Instance Attribute Summary

Attributes inherited from Praxis::Plugin

#application, #block, #config, #config_attribute

Instance Method Summary collapse

Methods inherited from Praxis::Plugin

#after, #before, #options, #register_doc_browser_plugin, #setup!

Instance Method Details

#config_keyObject



26
27
28
# File 'lib/praxis/plugins/mapper_plugin.rb', line 26

def config_key
  :mapper
end

#load_config!Object



30
31
32
# File 'lib/praxis/plugins/mapper_plugin.rb', line 30

def load_config!
  {} # override the default one, since we don't necessarily want to configure it via a yaml file.
end

#prepare_config!(node) ⇒ Object



34
35
36
37
38
39
# File 'lib/praxis/plugins/mapper_plugin.rb', line 34

def prepare_config!(node)
  node.attributes do
    attribute :debug_queries, Attributor::Boolean, default: false,
                                                   description: 'Weather or not to log debug information about queries executed in the build_query automation module'
  end
end