Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions connect/models/activation_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,36 @@


class ActivationTileResponse(object):
""" An instance of this class might the returned by the overriden ``process_request`` method
of your :py:class:`connect.resources.FulfillmentAutomation` or
:py:class:`connect.resources.TierConfigAutomation` subclass to approve the request being
processed, showing a tile with the specified contents.

:param str markdown: Contents of the tile to be shown in the Vendor Portal, in Markdown format.
:rtype: None
"""

tile = 'Activation succeeded' # type: str

def __init__(self, markdown=''):
# type: (str) -> None
try:
self.tile = json.loads(markdown)
except ValueError:
self.tile = markdown or self.__class__.tile


class ActivationTemplateResponse(object):
""" An instance of this class might the returned by the overriden ``process_request`` method
of your :py:class:`connect.resources.FulfillmentAutomation` or
:py:class:`connect.resources.TierConfigAutomation` subclass to approve the request being
processed, showing a tile with the specified template id.

:param str template_id: Id of the template od the tile to be shown in the Vendor Portal.
The template must have been defined in the Vendor Portal.
:rtype: None
"""

template_id = None # type: str

def __init__(self, template_id):
# type: (str) -> None
self.template_id = template_id
10 changes: 5 additions & 5 deletions connect/resources/fulfillment_automation.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ class FulfillmentAutomation(AutomationEngine):
""" This is the automation engine for the Fulfillment API. If you want to process fulfillment
requests, subclass this and implement the ``process_request`` method, which receives a
:py:class:`connect.models.Fulfillment` request as argument and must return an
:py:class:`ActivationTemplateResponse` or :py:class:`ActivationTileResponse` object in case
the request has to be approved.
:py:class:`connect.models.ActivationTemplateResponse` or
:py:class:`connect.models.ActivationTileResponse` object in case the request has to be approved.

In other case, you must raise one of these exceptions:

- :py:class:`connect.models.InquireRequest`: Inquire for more information.
- :py:class:`connect.models.FailRequest`: Causes the request to fail.
- :py:class:`connect.models.SkipRequest`: Skips processing the request.
- :py:class:`connect.exceptions.InquireRequest`: Inquire for more information.
- :py:class:`connect.exceptions.FailRequest`: Causes the request to fail.
- :py:class:`connect.exceptions.SkipRequest`: Skips processing the request.

Create an instance of your subclass and call its ``process`` method to begin processing.

Expand Down
10 changes: 5 additions & 5 deletions connect/resources/tier_config_automation.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ class TierConfigAutomation(AutomationEngine):
""" This is the automation engine for the Tier Config Request API. If you want to process
Tier Config requests, subclass this and implement the ``process_request`` method,
which receives a :py:class:`connect.models.TierConfigRequest` request as argument and must
return an :py:class:`ActivationTemplateResponse` or :py:class:`ActivationTileResponse` object
in case the request has to be approved.
return an :py:class:`connect.models.ActivationTemplateResponse` or
:py:class:`connect.models.ActivationTileResponse` object in case the request has to be approved.

In other case, you must raise one of these exceptions:

- :py:class:`connect.models.InquireRequest`: Inquire for more information.
- :py:class:`connect.models.FailRequest`: Causes the request to fail.
- :py:class:`connect.models.SkipRequest`: Skips processing the request.
- :py:class:`connect.exceptions.InquireRequest`: Inquire for more information.
- :py:class:`connect.exceptions.FailRequest`: Causes the request to fail.
- :py:class:`connect.exceptions.SkipRequest`: Skips processing the request.

Create an instance of your subclass and call its ``process`` method to begin processing.

Expand Down