Skip to content

Commit

Permalink
docs: Documenation updated with latest updates 📝
Browse files Browse the repository at this point in the history
  • Loading branch information
inforian committed Jun 7, 2017
1 parent dc425a5 commit 3d655e8
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 11 deletions.
53 changes: 52 additions & 1 deletion docs/source/email.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ Email Providers
notification_type = 'email'
General Settings you need to configure in Django Project when using any email providers are mentioned below :
- General Settings you need to configure in Django Project when using any email providers are mentioned below :
- Some settings can be passed as function arguments as well as in `Django settings`. The main AIM is to provide all
possible flexibility to user to use Any `Provider` with any configuration.
- If we Add settings in `Django settings` then in entire project those settings will be used But if you want every
notification use different provider configuration then that is also possible here.

> General Settings
------------------
Expand Down Expand Up @@ -56,6 +60,9 @@ Default email address to use for various outgoing emails.
- For this you need below settings to configure in your Django Project.
- Sample settings for Gmail Provider are as follows:

As Django settings :
~~~~~~~~~~~~~~~~~~~~

.. code-block:: python
EMAIL_USE_TLS = True
Expand All @@ -66,6 +73,41 @@ Default email address to use for various outgoing emails.
EMAIL_PORT = 587
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
As Function Arguments:
~~~~~~~~~~~~~~~~~~~~~~

- `EMAIL_HOST_USER` as `username`.
- `EMAIL_HOST_PASSWORD` as `password`.

**Example Usage** :

.. code-block:: python
from notifyAll.services import notifier
def notify():
"""
"""
context = {
'subject': 'subject'
'body': 'body'
'html_message': '<h1>html message</h1>'
}
data = {
'source': 'admin@example.com',
'destination': 'me@example.com',
'notification_type': 'email',
'provider': 'gmail',
'context': context,
}
notification = notifier.Notifier(**data)
return notification.notify(username='myuser@gmail.com', password='mypassword')
> SendGrid
----------

Expand All @@ -85,6 +127,9 @@ SENDGRID_API_KEY :

- Sample settings for SendGrid Provider are as follows:

As Django settings :
~~~~~~~~~~~~~~~~~~~~

.. code-block:: python
EMAIL_USE_TLS = True
Expand All @@ -95,3 +140,9 @@ SENDGRID_API_KEY :
EMAIL_PORT = 587
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
As Function Arguments:
~~~~~~~~~~~~~~~~~~~~~~

- `SENDGRID_API_KEY` as `sendgrid_api_key`.

- Usage is same as shown in `Gmail` provider example
11 changes: 2 additions & 9 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ context
For email provider only. If you want to send message including **HTML** then you need to send your notification body
in the above key.


**Example Usage** :

.. code-block:: python
Expand All @@ -99,17 +98,11 @@ context
'context': context,
}
notification = notifier.Notifier(
source=data.get('source'),
destination=data.get('destination'),
notification_type=data.get('notification_type'),
provider=data.get('provider'),
context=data.get('context')
)
notification = notifier.Notifier(**data)
return notification.notify()
For more information about usage visit our `Example`_ project.

.. _Provider: https://django-allauth.readthedocs.io/en/latest/Providers.html
.. _Provider: https://django-allauth.readthedocs.io/en/latest/providers.html
.. _Example: https://django-allauth.readthedocs.io/en/latest/example.html
4 changes: 3 additions & 1 deletion docs/source/providers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ I'll try to explain what settings you need in order to user Any below providers.
email
sms

**Note :** Providers can be managed in two ways using `django settings` or as `function arguments`.
See respective Providers docs for more info

Add providers
=============
Expand All @@ -32,4 +34,4 @@ If you want to contribute to this repo and wish to add more providers just follo
so that your provider can be enabled for outer world.


.. _Provider: https://django-allauth.readthedocs.io/en/latest/Providers.html
.. _Provider: https://django-allauth.readthedocs.io/en/latest/providers.html
49 changes: 49 additions & 0 deletions docs/source/sms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ SMS Providers
notification_type = 'sms'
- General Settings you need to configure in Django Project when using any email providers are mentioned below :
- Some settings can be passed as function arguments as well as in `Django settings`. The main AIM is to provide all
possible flexibility to user to use Any `Provider` with any configuration.
- If we Add settings in `Django settings` then in entire project those settings will be used But if you want every
notification use different provider configuration then that is also possible here.

> Plivo
-------

Expand All @@ -26,13 +32,46 @@ SMS Providers
- When you register at `Plivo` it will give you two keys which you need to configure in your Django Project.

As Django settings :
~~~~~~~~~~~~~~~~~~~~

PLIVO_AUTH_ID
+++++++++++++

PLIVO_AUTH_TOKEN
++++++++++++++++

As Function Arguments:
~~~~~~~~~~~~~~~~~~~~~~

- `PLIVO_AUTH_ID` as `auth_id`
- `PLIVO_AUTH_TOKEN` as `auth_token`


**Example Usage** :

.. code-block:: python
from notifyAll.services import notifier
def notify():
"""
"""
data = {
'source': '<source>',
'destination': '<destination>',
'notification_type': 'sms',
'provider': 'plivo',
'context': {
'body': 'test message'
},
}
notification = notifier.Notifier(**data)
return notification.notify(auth_id='<plivo_auth_id>', auth_token='<plivo_auth_token>')
> Twilio
--------
Expand All @@ -53,13 +92,23 @@ PLIVO_AUTH_TOKEN
- When you register at `Twilio` it will give you two keys which you need to configure in your Django Project.

As Django settings :
~~~~~~~~~~~~~~~~~~~~

TWILIO_ACCOUNT_SID
++++++++++++++++++

TWILIO_AUTH_TOKEN
+++++++++++++++++

As Function Arguments:
~~~~~~~~~~~~~~~~~~~~~~

- `TWILIO_ACCOUNT_SID` as `account_sid`
- `TWILIO_AUTH_TOKEN` as `auth_token`


- Usage is same as shown in `Plivo` provider example

.. _plivo: https://github.com/plivo/plivo-python
.. _twilio: https://github.com/twilio/twilio-python

0 comments on commit 3d655e8

Please sign in to comment.