MCPcopy Create free account
hub / github.com/StackStorm/st2 / to_model

Method to_model

st2common/st2common/models/api/notification.py:44–69  ·  view source on GitHub ↗
(notify_api_object)

Source from the content-addressed store, hash-verified

42class NotificationsHelper(object):
43 @staticmethod
44 def to_model(notify_api_object):
45 if notify_api_object.get("on-success", None):
46 on_success = NotificationsHelper._to_model_sub_schema(
47 notify_api_object["on-success"]
48 )
49 else:
50 on_success = None
51
52 if notify_api_object.get("on-complete", None):
53 on_complete = NotificationsHelper._to_model_sub_schema(
54 notify_api_object["on-complete"]
55 )
56 else:
57 on_complete = None
58
59 if notify_api_object.get("on-failure", None):
60 on_failure = NotificationsHelper._to_model_sub_schema(
61 notify_api_object["on-failure"]
62 )
63 else:
64 on_failure = None
65
66 model = NotificationSchema(
67 on_success=on_success, on_failure=on_failure, on_complete=on_complete
68 )
69 return model
70
71 @staticmethod
72 def _to_model_sub_schema(notification_settings_json):

Callers

nothing calls this directly

Calls 3

NotificationSchemaClass · 0.90
_to_model_sub_schemaMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected