Hooks allow you to execute code at appropriate times during Sirportly's runtime. For example, you may to hook into the data gathering system in order to gather data from additional data sources.
In order to define a hook, you simply define the following in your module file:
class HookModule < Module
add_hook :pre_contact_gathering do |config, opts|
# All the code within this block will be executed when the given hook is called.
# The `config` variable will contain any user provided configuration (if needed,
# otherwise it will be nil) and `opts` will contain various options which are
# variable depending on the hook you are using. See the information below.
end
end
The following hooks are available within Sirportly and can be used:
pre_contact_data_gathering
- executed if data gathering has been requested for a contact
before we run any built-in gathering methods. Receives a :contact_method option for the
contact method which is being gathered.
post_contact_data_gathering
- executed after data gathering has taken place after the
contact object has been saved and all built-in methods have been run. Receives a :contact_method
option containing the contact method which is being gathered.