Esempio n. 1
0
    def json_repr(self, minimal=False):
        """Construct a JSON-friendly representation of the object.

        :param bool minimal: Construct a minimal representation of the object (ignore nulls and empty collections)

        :rtype: dict
        """
        if minimal:
            return {to_camel_case(k):v for k,v in vars(self).items() if (v or v == False)}
        else:
            return {to_camel_case(k):v for k,v in vars(self).items()}
Esempio n. 2
0
    def json_repr(self, minimal=False):
        """Construct a JSON-friendly representation of the object.

        :param bool minimal: Construct a minimal representation of the object (ignore nulls and empty collections)

        :rtype: dict
        """
        if minimal:
            return {to_camel_case(k):v for k,v in vars(self).items() if (v or v == False)}
        else:
            return {to_camel_case(k):v for k,v in vars(self).items()}
Esempio n. 3
0
 def test(camel, snake):
     assert to_camel_case(snake) == camel