<commit_before>//
//  FacebookApiMoya.swift
//  RxSocialConnectExample
//
//  Created by <NAME> on 5/25/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import RxSwift
import OAuthSwift
import Moya

// MARK: - Endpoint Closure
let endpointClosure = { (target: Target) -> Endpoint<Target> in
    let endpoint: Endpoint<Target> = Endpoint<Target>(URL: url(target), sampleResponseClosure: {.NetworkResponse(200, target.sampleData)}, method: target.method, parameters: target.parameters, parameterEncoding: target.parameterEncoding)
    // Add this line to add OAuthHeaders
    return RxSocialConnect.addOAuthHeaders(FacebookApi20.self, endpoint: endpoint)
}

class FacebookApiMoya: NSObject {
    
    // MARK: - Provider setup
    private let provider = RxMoyaProvider<Target>(endpointClosure: endpointClosure)
    
    func getMe() -> Observable<Response> {
        return provider.request(Target.Me)
    }

}

public enum Target: TargetType {
    case Me
    
    public var baseURL: NSURL {
        return NSURL(string: "https://graph.facebook.com")!
    }
    
    public var path: String {
        switch(self) {
        case .Me:
            return "/me"
        }
    }
    
    public var method: Moya.Method {
        switch(self) {
        case .Me:
            return .GET
        }
    }
    
    public var parameterEncoding: Moya.ParameterEncoding {
        switch(self) {
        case .Me:
            return .JSON
        }
    }
    
    public var parameters: [String: AnyObject]? {
        return nil
    }
    
    public var sampleData: NSData {
        switch self {
        default:
            return "[{\"name\": \"Repo Name\"}]".dataUsingEncoding(NSUTF8StringEncoding)!
        }
    }
}

public func url(route: TargetType) -> String {
    return route.baseURL.URLByAppendingPathComponent(route.path).absoluteString
}<commit_msg>Modified the parameterEnconding in the Example<commit_after>//
//  FacebookApiMoya.swift
//  RxSocialConnectExample
//
//  Created by <NAME> on 5/25/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import RxSwift
import OAuthSwift
import Moya

// MARK: - Endpoint Closure
let endpointClosure = { (target: Target) -> Endpoint<Target> in
    let endpoint: Endpoint<Target> = Endpoint<Target>(URL: url(target), sampleResponseClosure: {.NetworkResponse(200, target.sampleData)}, method: target.method, parameters: target.parameters, parameterEncoding: target.parameterEncoding)
    // Add this line to add OAuthHeaders
    return RxSocialConnect.addOAuthHeaders(FacebookApi20.self, endpoint: endpoint)
}

class FacebookApiMoya: NSObject {
    
    // MARK: - Provider setup
    private let provider = RxMoyaProvider<Target>(endpointClosure: endpointClosure)
    
    func getMe() -> Observable<Response> {
        return provider.request(Target.Me)
    }

}

public enum Target: TargetType {
    case Me
    
    public var baseURL: NSURL {
        return NSURL(string: "https://graph.facebook.com")!
    }
    
    public var path: String {
        switch(self) {
        case .Me:
            return "/me"
        }
    }
    
    public var method: Moya.Method {
        switch(self) {
        case .Me:
            return .GET
        }
    }
    
    public var parameterEncoding: Moya.ParameterEncoding {
        switch(self) {
        case .Me:
            return .URL
        }
    }
    
    public var parameters: [String: AnyObject]? {
        return nil
    }
    
    public var sampleData: NSData {
        switch self {
        default:
            return "[{\"name\": \"Repo Name\"}]".dataUsingEncoding(NSUTF8StringEncoding)!
        }
    }
}

public func url(route: TargetType) -> String {
    return route.baseURL.URLByAppendingPathComponent(route.path).absoluteString
}
{'fraction_non_alphanumeric': 0.10649627263045794, 'fraction_numerical': 0.007987220447284345, 'mean_word_length': 2.4341864716636197, 'pattern_counts': {'":': 2, '<': 17, '<?xml version=': 0, '>': 23, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3527944', 'n_tokens_mistral': 1141, 'n_tokens_neox': 1085, 'n_words': 275}