Skip to content

Commit

Permalink
docs: apply feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
MaferMazu committed Aug 13, 2024
1 parent 1327708 commit cb3d9be
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 24 deletions.
13 changes: 11 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Installation
Usage
======

Before using eox-hooks, you need to set ``USE_EOX_HOOKS`` in ``True`` and configure ``EOX_HOOKS_DEFINITIONS`` as follows:
Before using eox-hooks, you need to set ``USE_EOX_HOOKS`` in ``True`` and configure ``EOX_HOOKS_DEFINITIONS`` in each tenant or site configuration that wants to use the plugin as follows:

.. code-block:: yaml
Expand All @@ -57,8 +57,9 @@ Before using eox-hooks, you need to set ``USE_EOX_HOOKS`` in ``True`` and config
}
Where:

- **trigger_event:** The name of the event the platform sends and eox-hooks listen, such as ``post_enrollment``. For a detailed list, visit the `trigger events examples file <docs/trigger_event_examples.rst>`_.
- **action_name:** Specify the name of the action to execute. For example: ``custom_action``.
- **action_name:** Specify the name of the action to execute. For example: ``custom_action``. To see the available actions in eox-hooks, visit the `default hook actions file <docs/default_hook_actions.rst>`_.
- **config:** Adds more information to the action.
- **fail_silently:** Defines what happens if an exception arises while executing the action. If ``False``, then the exception is raised.
- **path_to_module:** Path to the module defining the action to execute. For example: ``eox_hooks.actions``.
Expand Down Expand Up @@ -112,6 +113,14 @@ Compatibility Notes
| Redwood | >= 6.3.0 |
+-------------------+----------------+

The plugin is configured for the latest release (Quince). The following changes in the plugin settings should be applied to be used for previous releases.
Those settings can be changed in ``eox_hooks/settings/common.py`` or, for example, in the instance configurations.


🚨 If the release you are looking for is not listed, please note:

- If the Open edX release is compatible with the current eox-hooks version (see `Compatibility Notes <https://github.com/eduNEXT/eox-hooks?tab=readme-ov-file#compatibility-notes>`_), the default configuration is sufficient.
- If incompatible, you can refer to the README from the relevant version tag for configuration details (e.g., `v5.1.0 README <https://github.com/eduNEXT/eox-hooks/blob/v5.1.0/README.rst>`_).

How to Contribute
==================
Expand Down
10 changes: 10 additions & 0 deletions docs/default_hook_actions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Default Hooks Actions
======================

The actions in the hooks configuration could live in any route, but some actions are already available in ``eox-hooks``, and there are:

- ``post_to_webhook_url``: Send data to a webhook url specified in the hook settings.
- ``trigger_enrollments_creation``: starts an async task that enrolls a user in a list of courses.
- ``trigger_grades_assignment``: propagates grades to a course component.

For more information, you can see the code in `actions.py <https://github.com/eduNEXT/eox-hooks/blob/v5.1.0/eox_hooks/actions.py>`_.
28 changes: 8 additions & 20 deletions docs/hooks_example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,14 @@ EOX_HOOKS Settings Example
"fail_silently": False,
"module": "eox_hooks.actions",
},
"post_session_login":
{
"action": "post_to_webhook_url",
"config":
{
"fields": { "recipient_email": "user.pii.email" },
"url": "https://webhook.site/",
},
"post_certificate_creation": {
"action": "trigger_grades_assignment",
"fail_silently": True,
"module": "eox_hooks.actions",
},
"post_enrollment":
{
"action": "post_to_webhook_url",
"config":
{
"fields": { "recipient_email": "user.pii.email" },
"url": "https://webhook.site/",
},
"fail_silently": True,
"module": "eox_hooks.actions",
"module": "eox_hooks.actions"
},
"post_enrollment": {
"action": "trigger_enrollments_creation",
"fail_silently": False,
"module": "eox_hooks.actions"
}
}
2 changes: 1 addition & 1 deletion eox_hooks/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def plugin_settings(settings):
"""
Set of plugin settings used by the Open Edx platform.
More info:
https://github.com/edx/edx-platform/blob/master/openedx/core/djangoapps/plugins/README.rst
https://github.com/openedx/edx-platform/blob/master/openedx/core/djangoapps/plugins/README.rst
"""
settings.EOX_HOOKS_ENROLLMENTS_BACKEND = "eox_hooks.edxapp_wrapper.backends.enrollments_l_v1"
settings.EOX_HOOKS_COURSES_BACKEND = "eox_hooks.edxapp_wrapper.backends.courses_p_v1"
Expand Down
2 changes: 1 addition & 1 deletion eox_hooks/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def plugin_settings(settings):
"""
Set of plugin settings used by the Open Edx platform.
More info:
https://github.com/edx/edx-platform/blob/master/openedx/core/djangoapps/plugins/README.rst
https://github.com/openedx/edx-platform/blob/master/openedx/core/djangoapps/plugins/README.rst
"""
settings.EOX_HOOKS_ENROLLMENTS_BACKEND = getattr(settings, "ENV_TOKENS", {}).get(
"EOX_HOOKS_ENROLLMENTS_BACKEND",
Expand Down

0 comments on commit cb3d9be

Please sign in to comment.