//
//  RequestPath.swift
//  Pyrobase
//
//  Created by Mounir Ybanez on 02/05/2017.
//  Copyright © 2017 Ner. All rights reserved.
//

public protocol RequestPathProtocol {

    var baseURL: String { get }
        
    func build(_ path: String) -> String
}

public class RequestPath: RequestPathProtocol {
    
    internal var accessToken: String
    
    public var baseURL: String
    
    public init(baseURL: String, accessToken: String) {
        self.baseURL = baseURL
        self.accessToken = accessToken
    }
    
    public func build(_ path: String) -> String {
        guard !baseURL.isEmpty else {
            return ""
        }
        
        return "\(baseURL)/\(path).json?auth=\(accessToken)"
    }
}

//
//  RequestPath.swift
//  Pyrobase
//
//  Created by Mounir Ybanez on 02/05/2017.
//  Copyright © 2017 Ner. All rights reserved.
//

public protocol RequestPathProtocol {

    var baseURL: String { get }
        
    func build(_ path: String) -> String
}

public class RequestPath: RequestPathProtocol {
    
    internal var accessToken: String
    
    public var baseURL: String
    
    public init(baseURL: String, accessToken: String) {
        self.baseURL = baseURL
        self.accessToken = accessToken
    }
    
    public func build(_ path: String) -> String {
        return "\(baseURL)/\(path).json?auth=\(accessToken)"
    }
}

--- 
+++ 
@@ -25,6 +25,10 @@
     }
     
     public func build(_ path: String) -> String {
+        guard !baseURL.isEmpty else {
+            return ""
+        }
+        
         return "\(baseURL)/\(path).json?auth=\(accessToken)"
     }
 }
Return empty if baseURL is empty.
