     
     
     
-    
-    @discardableResult public class func doPUTTokenToURL(_ url : String, withPath path : String, withParameter parameters : Any?, withToken token : String, withCompletion completion : @escaping (_ objResponse : CDMWebResponse) -> Void) -> URLSessionDataTask {
-        
-        let sessionConfiguration = URLSessionConfiguration.default
-        sessionConfiguration.httpAdditionalHeaders = self.createHeaderRequestToken(token)
-        
-        let sesion = URLSession.init(configuration: sessionConfiguration)
-        
-        let urlServicio = URL(string: "\(url)/\(path)")
-        let request = NSMutableURLRequest(url: urlServicio!)
-        request.addValue("application/json; charset=UTF-8", forHTTPHeaderField: "Content-Type")
-        request.addValue("application/json", forHTTPHeaderField: "Accept")
-        
-        
-        if parameters != nil {
-            do {
-                request.httpBody = try JSONSerialization.data(withJSONObject: parameters!, options: JSONSerialization.WritingOptions.prettyPrinted)
-            }catch {}
-        }
-        
-        request.httpMethod = "PUT"
-        
-        let postDataTask = sesion.dataTask(with: request as URLRequest) { (data, response, error) in
-            
-            DispatchQueue.main.async(execute: {
-                
-                let objResponse = self.getResponseService(toData: data, withResponse: response, withError: error)
-                completion(objResponse)
-            })
-        }
-        
-        
-        postDataTask.resume()
-        return postDataTask
-    }
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    //MARK: - Consumo de servicios simple
-    
-    
-    
-    @discardableResult public class func doPOSTToURL(_ url : String, withPath path : String, withParameter parameters : Any?, withCompletion completion : @escaping (_ objResponse : CDMWebResponse) -> Void) -> URLSessionDataTask{
+    @discardableResult public class func doPUTToURL(_ url : String, withPath path : String, withParameter parameters : Any?, withCompletion completion : @escaping (_ objResponse : CDMWebResponse) -> Void) -> URLSessionDataTask {
         
         let sessionConfiguration = URLSessionConfiguration.default
         sessionConfiguration.httpAdditionalHeaders = self.createHeaderRequest()
         
         let sesion = URLSession.init(configuration: sessionConfiguration)
         
-        let urlServicio = URL(string: "\(url)/\(path)")
-        let request = NSMutableURLRequest(url: urlServicio!)
-        request.addValue("application/json; charset=UTF-8", forHTTPHeaderField: "Content-Type")
-        request.addValue("application/json", forHTTPHeaderField: "Accept")
-        
-        
-        if parameters != nil {
-            do {
-                request.httpBody = try JSONSerialization.data(withJSONObject: parameters!, options: JSONSerialization.WritingOptions.prettyPrinted)
-            }catch {}
-        }
-        
-        request.httpMethod = "POST"
-        
-        let postDataTask = sesion.dataTask(with: request as URLRequest) { (data, response, error) in
-            
-            DispatchQueue.main.async(execute: {
-                
-                let objResponse = self.getResponseService(toData: data, withResponse: response, withError: error)
-                completion(objResponse)
-            })
-        }
-        
-        
-        postDataTask.resume()
-        return postDataTask
-    }
-    
-    
-    
-    
-    
-    
-    
-    @discardableResult public class func doGETToURL(_ url : String, withPath path : String, withParameter parameters : Any?, withCompletion completion : @escaping (_ objResponse : CDMWebResponse) -> Void) -> URLSessionDataTask{
-        
-        let sessionConfiguration = URLSessionConfiguration.default
-        sessionConfiguration.httpAdditionalHeaders = self.createHeaderRequest()
-        
-        let sesion = URLSession.init(configuration: sessionConfiguration)
-        
-        let urlServicio = URL(string: "\(url)/\(path)")
-        let request = NSMutableURLRequest(url: urlServicio!)
-        request.addValue("application/json; charset=UTF-8", forHTTPHeaderField: "Content-Type")
-        request.addValue("application/json", forHTTPHeaderField: "Accept")
-        
-        
-        if parameters != nil {
-            do {
-                request.httpBody = try JSONSerialization.data(withJSONObject: parameters!, options: JSONSerialization.WritingOptions.prettyPrinted)
-            }catch {}
-        }
-        
-        request.httpMethod = "GET"
-        
-        let postDataTask = sesion.dataTask(with: request as URLRequest) { (data, response, error) in
-            
-            DispatchQueue.main.async(execute: {
-                
-                let objResponse = self.getResponseService(toData: data, withResponse: response, withError: error)
-                completion(objResponse)
-            })
-        }
-        
-        
-        postDataTask.resume()
-        return postDataTask
-    }
-    
-    
-    
-    
-    
-    
-    
-    
-    @discardableResult public class func doPUTToURL(_ url : String, withPath path : String, withParameter parameters : Any?, withCompletion completion : @escaping (_ objResponse : CDMWebResponse) -> Void) -> URLSessionDataTask {
-        
-        let sessionConfiguration = URLSessionConfiguration.default
-        sessionConfiguration.httpAdditionalHeaders = self.createHeaderRequest()
-        
-        let sesion = URLSession.init(configuration: sessionConfiguration)
-        
-        let urlServicio = URL(string: "\(url)/\(path)")
+        let escapedUrlString = "\(url)/\(path)".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!
+        let urlServicio = URL(string: escapedUrlString)
         let request = NSMutableURLRequest(url: urlServicio!)
         request.addValue("application/json; charset=UTF-8", forHTTPHeaderField: "Content-Type")
         request.addValue("application/json", forHTTPHeaderField: "Accept")

    
    
    
    @discardableResult public class func doGETTokenToURL(_ url : String, withPath path : String, withParameter parameters : Any?, withToken token : String, withCompletion completion : @escaping (_ objResponse : CDMWebResponse) -> Void) -> URLSessionDataTask {
        
        let sessionConfiguration = URLSessionConfiguration.default
        sessionConfiguration.httpAdditionalHeaders = self.createHeaderRequestToken(token)
        
        let sesion = URLSession.init(configuration: sessionConfiguration)
        
        let urlServicio = URL(string: "\(url)\(path)")
        let request = NSMutableURLRequest(url: urlServicio!)
        request.addValue("application/json; charset=UTF-8", forHTTPHeaderField: "Content-Type")
        request.addValue("application/json", forHTTPHeaderField: "Accept")

            }catch {}
        }
        
        request.httpMethod = "PUT"
        
        let postDataTask = sesion.dataTask(with: request as URLRequest) { (data, response, error) in
            
            DispatchQueue.main.async(execute: {
                
                let objResponse = self.getResponseService(toData: data, withResponse: response, withError: error)
                completion(objResponse)
            })
        }
        
        
        postDataTask.resume()
        return postDataTask
    }

    
    
    
    
    
    
    
    
    

    //MARK: - Consumo de servicios con token
    
    
    @discardableResult public class func doPATCHTokenToURL(_ url : String, withPath path : String, withParameter parameters : Any?, withToken token : String, withCompletion completion : @escaping (_ objResponse : CDMWebResponse) -> Void) -> URLSessionDataTask {
        
        let sessionConfiguration = URLSessionConfiguration.default
        sessionConfiguration.httpAdditionalHeaders = self.createHeaderRequestToken(token)
        
        let sesion = URLSession.init(configuration: sessionConfiguration)
        
        let escapedUrlString = "\(url)/\(path)".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!
        let urlServicio = URL(string: escapedUrlString)
        let request = NSMutableURLRequest(url: urlServicio!)
        request.addValue("application/json; charset=UTF-8", forHTTPHeaderField: "Content-Type")
        request.addValue("application/json", forHTTPHeaderField: "Accept")
        
        
        if parameters != nil {
            do {
                request.httpBody = try JSONSerialization.data(withJSONObject: parameters!, options: JSONSerialization.WritingOptions.prettyPrinted)
            }catch {}
        }
        
        request.httpMethod = "PATCH"
        
        let postDataTask = sesion.dataTask(with: request as URLRequest) { (data, response, error) in
            
            DispatchQueue.main.async(execute: {
                
                let objResponse = self.getResponseService(toData: data, withResponse: response, withError: error)
                completion(objResponse)
            })
        }
        
        
        postDataTask.resume()
        return postDataTask
    }
    
    
    
    @discardableResult public class func doPOSTTokenToURL(_ url : String, withPath path : String, withParameter parameters : Any?, withToken token : String, withCompletion completion : @escaping (_ objResponse : CDMWebResponse) -> Void) -> URLSessionDataTask {
        
        let sessionConfiguration = URLSessionConfiguration.default
        sessionConfiguration.httpAdditionalHeaders = self.createHeaderRequestToken(token)
        
        let sesion = URLSession.init(configuration: sessionConfiguration)
        
        let escapedUrlString = "\(url)/\(path)".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!
        let urlServicio = URL(string: escapedUrlString)
        let request = NSMutableURLRequest(url: urlServicio!)
        request.addValue("application/json; charset=UTF-8", forHTTPHeaderField: "Content-Type")
        request.addValue("application/json", forHTTPHeaderField: "Accept")
        
        
        if parameters != nil {
            do {
                request.httpBody = try JSONSerialization.data(withJSONObject: parameters!, options: JSONSerialization.WritingOptions.prettyPrinted)
            }catch {}
        }
        
        request.httpMethod = "POST"
        
        let postDataTask = sesion.dataTask(with: request as URLRequest) { (data, response, error) in
