<commit_before>//
//  Account.swift
//  STwitter
//
//  Created by Sinoru on 2016. 12. 2..
//  Copyright © 2016년 Sinoru. All rights reserved.
//

import Foundation

@objc(STWAccount)
public class Account: NSObject {
    public let oauthToken: String
    internal let oauthTokenSecret: String
    
    @objc public init(oauthToken: String, oauthTokenSecret: String) {
        self.oauthToken = oauthToken
        self.oauthTokenSecret = oauthTokenSecret
        super.init()
    }
}
<commit_msg>create requestVerifyCredential on Account class<commit_after>//
//  Account.swift
//  STwitter
//
//  Created by Sinoru on 2016. 12. 2..
//  Copyright © 2016년 Sinoru. All rights reserved.
//

import Foundation

@objc(STWAccount)
public class Account: NSObject {
    public let oauthToken: String
    internal let oauthTokenSecret: String
    
    @objc public init(oauthToken: String, oauthTokenSecret: String) {
        self.oauthToken = oauthToken
        self.oauthTokenSecret = oauthTokenSecret
        super.init()
    }
    
    @objc public class func requestVerifyCredential(session: Session, handler: @escaping (User?, NSError?) -> Void) {
        guard let url = URL.twitterRESTAPIURL(endpoint: "account/verify_credentials.json") else {
            handler(nil, Error.unknown)
            return
        }
        
        let httpMethod = "GET"
        
        do {
            var urlRequest = URLRequest(url: url)
            urlRequest.httpMethod = httpMethod
            
            let authorizationHeader = try OAuth.authorizationHeader(oauthItems: [:], HTTPMethod: httpMethod, url: url, consumerKey: session.consumerKey, consumerSecret: session.consumerSecret)
            
            urlRequest.setValue(authorizationHeader, forHTTPHeaderField: "Authorization")
            
            let task = session.urlSession.dataTask(with: urlRequest, completionHandler: { (data, response, error) in
                if let error = error {
                    handler(nil, error as NSError?)
                    return
                }
                
                do {
                    guard let data = data else {
                        handler(nil, error as NSError?)
                        return
                    }
                    
                    let jsonObject = try JSONSerialization.jsonObject(with: data, options: [.allowFragments])
                    
                    guard let user = User(jsonObject: jsonObject) else {
                        handler(nil, error as NSError?)
                        return
                    }
                    
                    handler(user, nil)
                }
                catch let error as NSError {
                    handler(nil, error)
                }
                catch {
                    handler(nil, Error.unknown)
                }
            })
            task.resume()
        }
        catch let error as NSError {
            handler(nil, error)
        }
        catch {
            handler(nil, Error.unknown)
        }
    }
    
}

{'fraction_non_alphanumeric': 0.07891290111329403, 'fraction_numerical': 0.007203667321545514, 'mean_word_length': 1.5123355263157894, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2809148', 'n_tokens_mistral': 830, 'n_tokens_neox': 778, 'n_words': 205}