Example #1
0
    def update(args: Union[PickupUpdateRequest, dict]):
        """Update a pickup previously scheduled
        
        Args:
            args (Union[TrackingRequest, dict]): the pickup update request payload

        Returns:
            IRequestFrom: a lazy request dataclass instance
        """
        logger.debug(f"update a pickup. payload: {DP.jsonify(args)}")
        payload = (args if isinstance(args, PickupUpdateRequest) else
                   PickupUpdateRequest(**args))

        def action(gateway: Gateway):
            request: Serializable = gateway.mapper.create_pickup_update_request(
                payload)
            response: Deserializable = gateway.proxy.modify_pickup(request)

            @fail_safe(gateway)
            def deserialize():
                return gateway.mapper.parse_pickup_update_response(response)

            return IDeserialize(deserialize)

        return IRequestFrom(action)
Example #2
0
    def update(args: Union[PickupUpdateRequest, dict]):
        payload = (args if isinstance(args, PickupUpdateRequest) else
                   PickupUpdateRequest(**args))

        def action(gateway: Gateway):
            request: Serializable = gateway.mapper.create_modify_pickup_request(
                payload)
            response: Deserializable = gateway.proxy.modify_pickup(request)

            def deserialize():
                return gateway.mapper.parse_modify_pickup_response(response)

            return IDeserialize(deserialize)

        return IRequestFrom(action)
Example #3
0
 def setUp(self):
     self.maxDiff = None
     self.PickupRequest = PickupRequest(**pickup_data)
     self.PickupUpdateRequest = PickupUpdateRequest(**pickup_update_data)
     self.PickupCancelRequest = PickupCancelRequest(**pickup_cancel_data)
Example #4
0
 def setUp(self):
     self.maxDiff = None
     self.BookPURequest = PickupRequest(**book_pickup_payload)
     self.ModifyPURequest = PickupUpdateRequest(**modification_data)
     self.CancelPURequest = PickupCancelRequest(**cancellation_data)