 //
 //  Created by Mobin Zadeh Kochak on 04/09/2015.
 //  Copyright (c) 2015 Mobin Zadeh Kochak. All rights reserved.
-//  Edited by Mason Phillips (https://github.com/mathmatrix828/
-//  Edited on 30MAY2016
 //
 
 import UIKit

public class lolApiWrapper: NSObject {
    
    // MARK: Initialised detail
    var APIKey: String!
    var region: String?
    var miniURL: String!
    var result: NSDictionary!
    var static_data: Bool = false
    private var debugEnabled: Bool = false
    
    var delegate: LolAPIListener?
    var sharedInstance: lolApiWrapper = lolApiWrapper()
    
    public func ApiKey(APIKey: String, region: String?) -> lolApiWrapper {
        self.APIKey = APIKey
        self.region = region
        
        return self
    }
    
    public func APIWithDebug(APIKey k: String, region r: String?) -> lolApiWrapper {
        debugEnabled = true
        
        return ApiKey(k, region: r)
    }
    
    // MARK: Retrieve API

                jsonDictionary = try NSJSONSerialization.JSONObjectWithData(jsonData, options: NSJSONReadingOptions.MutableContainers) as! NSDictionary
            } catch let error as NSError {
                delegate?.errorDidOccur(error, userString: error.localizedFailureReason)
                print(error)
            }
        } else {
            print("-------- URL IS INVALID --------\n")
            delegate?.submittedURLInvalid(urlToRequest)
        }
        
