예제 #1
0
 def _defaults(self):
     """Default initialization for the Post Transaction."""
     super(Post, self)._defaults()
     self.client.id = Container()
     self.client.output = Container()
     self.server.output = Container()
     self.client.verb = "POST"
예제 #2
0
    def _deserialize(cls, data):
        """Deserialize data into a Get Transaction.

        Args:
            data (dict (str, obj)): Serialized data (json)

        Returns:
            Get Transaction
        """
        get = super(Get, cls)._deserialize(data)
        if data:
            get.client.metadata = Container._deserialize(
                data["client"]["metadata"]) if (
                    "client" in data
                    and "metadata" in data["client"]) else Container()
            get.server.output = Container._deserialize(
                data["server"]["output"]) if (
                    "server" in data
                    and "output" in data["server"]) else Container()
        return get
예제 #3
0
    def _deserialize(cls, data):
        """Deserialize data into a Stager Transaction.

        Args:
            data (dict (str, obj)): Serialized data (json)

        Returns:
            Stager Transaction
        """
        stager = super(Stager, cls)._deserialize(data)
        if data:
            stager.client.metadata = Container._deserialize(
                data["client"]["metadata"]) if (
                    "client" in data
                    and "metadata" in data["client"]) else Container()
            stager.server.output = Container._deserialize(
                data["server"]["output"]) if (
                    "server" in data
                    and "output" in data["server"]) else Container()
        return stager
예제 #4
0
    def _pattern(cls):
        """Define the pattern to recognize a MalleableResponse object while parsing a file.

        Returns:
            pyparsing object
        """
        return Group(
            Suppress("{") +
            ZeroOrMore(cls.COMMENT
                       | (Literal("header") + Group(cls.VALUE + cls.VALUE) +
                          cls.SEMICOLON) | Container._pattern()) +
            Suppress("}"))
예제 #5
0
    def _deserialize(cls, data):
        """Deserialize data into a Post Transaction.

        Args:
            data (dict (str, obj)): Serialized data (json)

        Returns:
            Post Transaction
        """
        post = super(Post, cls)._deserialize(data)
        if data:
            post.client.id = Container._deserialize(data["client"]["id"]) if (
                "client" in data and "id" in data["client"]) else Container()
            post.client.output = Container._deserialize(
                data["client"]["output"]) if (
                    "client" in data
                    and "output" in data["client"]) else Container()
            post.server.output = Container._deserialize(
                data["server"]["output"]) if (
                    "server" in data
                    and "output" in data["server"]) else Container()
        return post
예제 #6
0
 def _defaults(self):
     """Default initialization for the Stager Transaction."""
     super(Stager, self)._defaults()
     self.client.metadata = Container()
     self.server.output = Container()
     self.client.verb = "GET"