Skip to content

Commit 0fa0d0d

Browse files
authored
Adding documentation for Hermes resources (#289)
* Adding docs * version * comments * more comments * fix dates
1 parent 9292f88 commit 0fa0d0d

File tree

3 files changed

+42
-3
lines changed

3 files changed

+42
-3
lines changed

cuenca/resources/endpoints.py

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,41 @@ class Endpoint(Creatable, Deactivable, Retrievable, Queryable, Updateable):
1919
is_enable: bool
2020
events: List[WebhookEvent]
2121

22+
class Config:
23+
fields = {
24+
'url': {'description': 'HTTPS url to send webhooks'},
25+
'secret': {
26+
'description': 'token to verify the webhook is sent by Cuenca '
27+
'using HMAC algorithm'
28+
},
29+
'is_enable': {
30+
'description': 'Allows user to turn-off the endpoint '
31+
'without the need of deleting it'
32+
},
33+
'events': {
34+
'description': 'list of enabled events. If None, '
35+
'all events will be enabled for this Endpoint'
36+
},
37+
}
38+
schema_extra = {
39+
'example': {
40+
'_id': 'ENxxne2Z5VSTKZm_w8Hzffcw',
41+
'platform_id': 'PTZoPrrPT6Ts-9myamq5h1bA',
42+
'created_at': '2022-06-29T22:00:00Z',
43+
'updated_at': '2022-06-29T22:00:00Z',
44+
'secret': '1234',
45+
'url': 'https://webhook.site/714ed1d8',
46+
'events': [
47+
'transaction.create',
48+
'transaction.update',
49+
'user.create',
50+
'user.update',
51+
'user.delete',
52+
],
53+
'is_enable': True,
54+
}
55+
}
56+
2257
@classmethod
2358
def create(
2459
cls,
@@ -30,7 +65,6 @@ def create(
3065
"""
3166
Creates and Endpoint, allowing to recieve Webhooks with the specified
3267
events.
33-
3468
:param url: HTTPS url to send webhooks
3569
:param events: list of enabled events. If None, all events will be
3670
enabled for this Endpoint
@@ -52,7 +86,6 @@ def update(
5286
"""
5387
Updates endpoint properties. It allows reconfigure properties
5488
like url and is_active.
55-
5689
:param endpoint_id: existing endpoint_id
5790
:param url
5891
:param is_enable

cuenca/resources/webhooks.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@ class Webhook(Retrievable, Queryable):
1010

1111
payload: Dict[str, Any]
1212
event: WebhookEvent
13+
14+
class Config:
15+
fields = {
16+
'payload': {'description': 'object sent by the webhook'},
17+
'event': {'description': 'type of event being reported'},
18+
}

cuenca/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version__ = '0.13.4'
1+
__version__ = '0.13.5'
22
CLIENT_VERSION = __version__
33
API_VERSION = '2020-03-19'

0 commit comments

Comments
 (0)