From 8dea32f909fd21f51fe781e5b53c7dc913cfb47d Mon Sep 17 00:00:00 2001 From: "Neidinger, Marcel" Date: Mon, 29 Jun 2020 14:36:20 +0200 Subject: [PATCH] Fixed simple property rendering (fixes CiscoDevNet/webexteamssdk#107) Simple properties are no longer forced into a string representation and thus retain their original data type (i.e. booleans or numbers). Only exception are all option enums that are converted into their string representation. --- webexteamssdk/models/cards/actions.py | 4 ++-- webexteamssdk/models/cards/adaptive_card_component.py | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/webexteamssdk/models/cards/actions.py b/webexteamssdk/models/cards/actions.py index 88867cf..2ad33d6 100644 --- a/webexteamssdk/models/cards/actions.py +++ b/webexteamssdk/models/cards/actions.py @@ -49,8 +49,8 @@ def __init__(self, data=None, title=None, iconURL=None): self.iconURL = iconURL super().__init__( - serializable_properties=['data'], - simple_properties=['title', 'iconURL', 'type'], + serializable_properties=[], + simple_properties=['data', 'title', 'iconURL', 'type'], ) diff --git a/webexteamssdk/models/cards/adaptive_card_component.py b/webexteamssdk/models/cards/adaptive_card_component.py index d48b68c..3ef9e98 100644 --- a/webexteamssdk/models/cards/adaptive_card_component.py +++ b/webexteamssdk/models/cards/adaptive_card_component.py @@ -23,7 +23,7 @@ """ import json - +import enum class AdaptiveCardComponent: """Base class for all Adaptive Card components. @@ -63,7 +63,10 @@ def to_dict(self): property_value = getattr(self, property_name, None) if property_value is not None: - serialized_data[property_name] = str(property_value) + if isinstance(property_value, enum.Enum): + property_value = str(property_value) + + serialized_data[property_name] = property_value # Recursively serialize sub-components for property_name in self.serializable_properties: