mirror of https://github.com/caronc/apprise
Updated Development_Contribution (markdown)
parent
60e91c57dc
commit
f297f70cc9
|
@ -42,6 +42,9 @@ It basically boils down to this:
|
|||
|
||||
# Apprise is nothing but a manager of individual plugins
|
||||
a = Apprise()
|
||||
|
||||
# Under the table, add just calls the NotifyMyService.parse_url() and passes
|
||||
# the result set into your new services __init__() function.
|
||||
a.add('myscheme://details/?more=details&are=optional')
|
||||
|
||||
# There would be one new service added to our manager now:
|
||||
|
@ -72,6 +75,40 @@ It basically boils down to this:
|
|||
# that handle some common things, but at the end of the day, it will call your `send()` function
|
||||
# you defined.
|
||||
```
|
||||
|
||||
- **Putting it together without the overhead of the Apprise manager**:
|
||||
```python
|
||||
from Apprise.plugins import NotifyMyService
|
||||
|
||||
# You can do this manually too if you want to test around the overhead
|
||||
# of the Apprise manager itself:
|
||||
results = NotifyMyService.parse_url('myscheme://details/?more=details&are=optional')
|
||||
|
||||
# A simple dictionary of all of our arguments ready to go:
|
||||
assert isinstance(results, dict)
|
||||
|
||||
# Now instantiate your object:
|
||||
obj = NotifyMyService(**results)
|
||||
|
||||
# If you build your NotifyMyService correctly, then you should be able
|
||||
# to build a copy of the object perfectly using it's url() call
|
||||
# Now instantiate your object:
|
||||
clone_results = NotifyMyService.parse_url(obj.url())
|
||||
|
||||
# A simple dictionary of all of our arguments ready to go:
|
||||
assert isinstance(clone_results, dict)
|
||||
|
||||
# if you did this properly, you'll have a second working instance
|
||||
# you can work with (this is a great test to make sure you coded
|
||||
# your new notification service perfect)
|
||||
clone = NotifyMyService(**clone_results)
|
||||
|
||||
# The best test of all to ensure you did everything well; both the
|
||||
# clone and original object you created should produce the same
|
||||
# url()
|
||||
assert clone.url() == obj.url()
|
||||
```
|
||||
|
||||
Any other functions you want to define can be done to you hearts content (if it helps with organization, structure, etc)
|
||||
Just avoid conflicting with any function written in `NotifyBase()` and `URLBase()`
|
||||
|
||||
|
|
Loading…
Reference in New Issue