{"action":"created","comment":{"url":"https://api.github.com/repos/digipost/ios/pulls/comments/30506048","id":30506048,"diff_hunk":"@@ -21,28 +19,20 @@ extension APIClient {\n                 return [Constants.APIClient.AttributeKey.location : Constants.FolderName.folder, Constants.APIClient.AttributeKey.subject : name, Constants.APIClient.AttributeKey.folderId: documentFolder.folderId.stringValue]\n             }\n             }()\n-        let task = urlSessionTask(httpMethod.post, url: document.updateUri, parameters: parameters, success: success) { (error) -> () in\n-            if (error.code == Constants.Error.Code.oAuthUnathorized ) {\n-                self.changeName(document, newName: name, success: success, failure: failure)\n-            } else {\n-                failure(error: error)\n-            }\n+\n+        validateFullScope {\n+            let task = self.urlSessionTask(httpMethod.post, url: document.updateUri, parameters: parameters, success: success,failure: failure)\n+            task?.resume()\n         }\n-        validateTokensThenPerformTask(task!)\n     }\n     \n     func deleteDocument(uri: String, success: () -> Void , failure: (error: APIError) -> ()) {\n-        let task = urlSessionTask(httpMethod.delete, url: uri, success: success) { (error) -> Void in\n-            if error.code == Constants.Error.Code.oAuthUnathorized {\n-                self.deleteDocument(uri, success: success, failure: failure)\n-            } else {\n-                failure(error: error)\n-            }\n+        validateFullScope {\n+            let task = self.urlSessionTask(httpMethod.delete, url: uri, success: success, failure: failure)\n+            task?.resume()","path":"Digipost/APIClient+Document.swift","position":36,"original_position":36,"commit_id":"058838ed85248f0dd4391491c3a92cb14b7819d1","original_commit_id":"058838ed85248f0dd4391491c3a92cb14b7819d1","user":{"login":"lillesand","id":92167,"avatar_url":"https://avatars.githubusercontent.com/u/92167?v=3","gravatar_id":"","url":"https://api.github.com/users/lillesand","html_url":"https://github.com/lillesand","followers_url":"https://api.github.com/users/lillesand/followers","following_url":"https://api.github.com/users/lillesand/following{/other_user}","gists_url":"https://api.github.com/users/lillesand/gists{/gist_id}","starred_url":"https://api.github.com/users/lillesand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lillesand/subscriptions","organizations_url":"https://api.github.com/users/lillesand/orgs","repos_url":"https://api.github.com/users/lillesand/repos","events_url":"https://api.github.com/users/lillesand/events{/privacy}","received_events_url":"https://api.github.com/users/lillesand/received_events","type":"User","site_admin":false},"body":"Force unwrap","created_at":"2015-05-18T13:20:20Z","updated_at":"2015-05-18T13:20:20Z","html_url":"https://github.com/digipost/ios/pull/2#discussion_r30506048","pull_request_url":"https://api.github.com/repos/digipost/ios/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/digipost/ios/pulls/comments/30506048"},"html":{"href":"https://github.com/digipost/ios/pull/2#discussion_r30506048"},"pull_request":{"href":"https://api.github.com/repos/digipost/ios/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/digipost/ios/pulls/2","id":35626736,"html_url":"https://github.com/digipost/ios/pull/2","diff_url":"https://github.com/digipost/ios/pull/2.diff","patch_url":"https://github.com/digipost/ios/pull/2.patch","issue_url":"https://api.github.com/repos/digipost/ios/issues/2","number":2,"state":"open","locked":false,"title":"Check timeout of token when validating access tokens","user":{"login":"haaakon","id":1579465,"avatar_url":"https://avatars.githubusercontent.com/u/1579465?v=3","gravatar_id":"","url":"https://api.github.com/users/haaakon","html_url":"https://github.com/haaakon","followers_url":"https://api.github.com/users/haaakon/followers","following_url":"https://api.github.com/users/haaakon/following{/other_user}","gists_url":"https://api.github.com/users/haaakon/gists{/gist_id}","starred_url":"https://api.github.com/users/haaakon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haaakon/subscriptions","organizations_url":"https://api.github.com/users/haaakon/orgs","repos_url":"https://api.github.com/users/haaakon/repos","events_url":"https://api.github.com/users/haaakon/events{/privacy}","received_events_url":"https://api.github.com/users/haaakon/received_events","type":"User","site_admin":false},"body":"OAuth tests now running, but not on travis because it still has no support for Swift 1.2. The tests can be run on the \"Digipost\" target. \r\n\r\nAlso added some cleanup for targets and schemes. ","created_at":"2015-05-18T12:04:13Z","updated_at":"2015-05-18T13:20:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2cbbaccd58278c60973b11aebbb977e0f04e79ae","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/digipost/ios/pulls/2/commits","review_comments_url":"https://api.github.com/repos/digipost/ios/pulls/2/comments","review_comment_url":"https://api.github.com/repos/digipost/ios/pulls/comments{/number}","comments_url":"https://api.github.com/repos/digipost/ios/issues/2/comments","statuses_url":"https://api.github.com/repos/digipost/ios/statuses/058838ed85248f0dd4391491c3a92cb14b7819d1","head":{"label":"digipost:auth-timeout","ref":"auth-timeout","sha":"058838ed85248f0dd4391491c3a92cb14b7819d1","user":{"login":"digipost","id":1013853,"avatar_url":"https://avatars.githubusercontent.com/u/1013853?v=3","gravatar_id":"","url":"https://api.github.com/users/digipost","html_url":"https://github.com/digipost","followers_url":"https://api.github.com/users/digipost/followers","following_url":"https://api.github.com/users/digipost/following{/other_user}","gists_url":"https://api.github.com/users/digipost/gists{/gist_id}","starred_url":"https://api.github.com/users/digipost/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digipost/subscriptions","organizations_url":"https://api.github.com/users/digipost/orgs","repos_url":"https://api.github.com/users/digipost/repos","events_url":"https://api.github.com/users/digipost/events{/privacy}","received_events_url":"https://api.github.com/users/digipost/received_events","type":"Organization","site_admin":false},"repo":{"id":14979171,"name":"ios","full_name":"digipost/ios","owner":{"login":"digipost","id":1013853,"avatar_url":"https://avatars.githubusercontent.com/u/1013853?v=3","gravatar_id":"","url":"https://api.github.com/users/digipost","html_url":"https://github.com/digipost","followers_url":"https://api.github.com/users/digipost/followers","following_url":"https://api.github.com/users/digipost/following{/other_user}","gists_url":"https://api.github.com/users/digipost/gists{/gist_id}","starred_url":"https://api.github.com/users/digipost/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digipost/subscriptions","organizations_url":"https://api.github.com/users/digipost/orgs","repos_url":"https://api.github.com/users/digipost/repos","events_url":"https://api.github.com/users/digipost/events{/privacy}","received_events_url":"https://api.github.com/users/digipost/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/digipost/ios","description":"Digipost for iOS","fork":false,"url":"https://api.github.com/repos/digipost/ios","forks_url":"https://api.github.com/repos/digipost/ios/forks","keys_url":"https://api.github.com/repos/digipost/ios/keys{/key_id}","collaborators_url":"https://api.github.com/repos/digipost/ios/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/digipost/ios/teams","hooks_url":"https://api.github.com/repos/digipost/ios/hooks","issue_events_url":"https://api.github.com/repos/digipost/ios/issues/events{/number}","events_url":"https://api.github.com/repos/digipost/ios/events","assignees_url":"https://api.github.com/repos/digipost/ios/assignees{/user}","branches_url":"https://api.github.com/repos/digipost/ios/branches{/branch}","tags_url":"https://api.github.com/repos/digipost/ios/tags","blobs_url":"https://api.github.com/repos/digipost/ios/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/digipost/ios/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/digipost/ios/git/refs{/sha}","trees_url":"https://api.github.com/repos/digipost/ios/git/trees{/sha}","statuses_url":"https://api.github.com/repos/digipost/ios/statuses/{sha}","languages_url":"https://api.github.com/repos/digipost/ios/languages","stargazers_url":"https://api.github.com/repos/digipost/ios/stargazers","contributors_url":"https://api.github.com/repos/digipost/ios/contributors","subscribers_url":"https://api.github.com/repos/digipost/ios/subscribers","subscription_url":"https://api.github.com/repos/digipost/ios/subscription","commits_url":"https://api.github.com/repos/digipost/ios/commits{/sha}","git_commits_url":"https://api.github.com/repos/digipost/ios/git/commits{/sha}","comments_url":"https://api.github.com/repos/digipost/ios/comments{/number}","issue_comment_url":"https://api.github.com/repos/digipost/ios/issues/comments{/number}","contents_url":"https://api.github.com/repos/digipost/ios/contents/{+path}","compare_url":"https://api.github.com/repos/digipost/ios/compare/{base}...{head}","merges_url":"https://api.github.com/repos/digipost/ios/merges","archive_url":"https://api.github.com/repos/digipost/ios/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/digipost/ios/downloads","issues_url":"https://api.github.com/repos/digipost/ios/issues{/number}","pulls_url":"https://api.github.com/repos/digipost/ios/pulls{/number}","milestones_url":"https://api.github.com/repos/digipost/ios/milestones{/number}","notifications_url":"https://api.github.com/repos/digipost/ios/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/digipost/ios/labels{/name}","releases_url":"https://api.github.com/repos/digipost/ios/releases{/id}","created_at":"2013-12-06T09:48:19Z","updated_at":"2015-04-30T17:16:29Z","pushed_at":"2015-05-18T12:54:46Z","git_url":"git://github.com/digipost/ios.git","ssh_url":"git@github.com:digipost/ios.git","clone_url":"https://github.com/digipost/ios.git","svn_url":"https://github.com/digipost/ios","homepage":null,"size":210559,"stargazers_count":11,"watchers_count":11,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":1,"forks":4,"open_issues":1,"watchers":11,"default_branch":"master"}},"base":{"label":"digipost:master","ref":"master","sha":"ccd683bd53654d075fa1916e5b1b9585388b85c5","user":{"login":"digipost","id":1013853,"avatar_url":"https://avatars.githubusercontent.com/u/1013853?v=3","gravatar_id":"","url":"https://api.github.com/users/digipost","html_url":"https://github.com/digipost","followers_url":"https://api.github.com/users/digipost/followers","following_url":"https://api.github.com/users/digipost/following{/other_user}","gists_url":"https://api.github.com/users/digipost/gists{/gist_id}","starred_url":"https://api.github.com/users/digipost/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digipost/subscriptions","organizations_url":"https://api.github.com/users/digipost/orgs","repos_url":"https://api.github.com/users/digipost/repos","events_url":"https://api.github.com/users/digipost/events{/privacy}","received_events_url":"https://api.github.com/users/digipost/received_events","type":"Organization","site_admin":false},"repo":{"id":14979171,"name":"ios","full_name":"digipost/ios","owner":{"login":"digipost","id":1013853,"avatar_url":"https://avatars.githubusercontent.com/u/1013853?v=3","gravatar_id":"","url":"https://api.github.com/users/digipost","html_url":"https://github.com/digipost","followers_url":"https://api.github.com/users/digipost/followers","following_url":"https://api.github.com/users/digipost/following{/other_user}","gists_url":"https://api.github.com/users/digipost/gists{/gist_id}","starred_url":"https://api.github.com/users/digipost/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digipost/subscriptions","organizations_url":"https://api.github.com/users/digipost/orgs","repos_url":"https://api.github.com/users/digipost/repos","events_url":"https://api.github.com/users/digipost/events{/privacy}","received_events_url":"https://api.github.com/users/digipost/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/digipost/ios","description":"Digipost for iOS","fork":false,"url":"https://api.github.com/repos/digipost/ios","forks_url":"https://api.github.com/repos/digipost/ios/forks","keys_url":"https://api.github.com/repos/digipost/ios/keys{/key_id}","collaborators_url":"https://api.github.com/repos/digipost/ios/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/digipost/ios/teams","hooks_url":"https://api.github.com/repos/digipost/ios/hooks","issue_events_url":"https://api.github.com/repos/digipost/ios/issues/events{/number}","events_url":"https://api.github.com/repos/digipost/ios/events","assignees_url":"https://api.github.com/repos/digipost/ios/assignees{/user}","branches_url":"https://api.github.com/repos/digipost/ios/branches{/branch}","tags_url":"https://api.github.com/repos/digipost/ios/tags","blobs_url":"https://api.github.com/repos/digipost/ios/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/digipost/ios/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/digipost/ios/git/refs{/sha}","trees_url":"https://api.github.com/repos/digipost/ios/git/trees{/sha}","statuses_url":"https://api.github.com/repos/digipost/ios/statuses/{sha}","languages_url":"https://api.github.com/repos/digipost/ios/languages","stargazers_url":"https://api.github.com/repos/digipost/ios/stargazers","contributors_url":"https://api.github.com/repos/digipost/ios/contributors","subscribers_url":"https://api.github.com/repos/digipost/ios/subscribers","subscription_url":"https://api.github.com/repos/digipost/ios/subscription","commits_url":"https://api.github.com/repos/digipost/ios/commits{/sha}","git_commits_url":"https://api.github.com/repos/digipost/ios/git/commits{/sha}","comments_url":"https://api.github.com/repos/digipost/ios/comments{/number}","issue_comment_url":"https://api.github.com/repos/digipost/ios/issues/comments{/number}","contents_url":"https://api.github.com/repos/digipost/ios/contents/{+path}","compare_url":"https://api.github.com/repos/digipost/ios/compare/{base}...{head}","merges_url":"https://api.github.com/repos/digipost/ios/merges","archive_url":"https://api.github.com/repos/digipost/ios/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/digipost/ios/downloads","issues_url":"https://api.github.com/repos/digipost/ios/issues{/number}","pulls_url":"https://api.github.com/repos/digipost/ios/pulls{/number}","milestones_url":"https://api.github.com/repos/digipost/ios/milestones{/number}","notifications_url":"https://api.github.com/repos/digipost/ios/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/digipost/ios/labels{/name}","releases_url":"https://api.github.com/repos/digipost/ios/releases{/id}","created_at":"2013-12-06T09:48:19Z","updated_at":"2015-04-30T17:16:29Z","pushed_at":"2015-05-18T12:54:46Z","git_url":"git://github.com/digipost/ios.git","ssh_url":"git@github.com:digipost/ios.git","clone_url":"https://github.com/digipost/ios.git","svn_url":"https://github.com/digipost/ios","homepage":null,"size":210559,"stargazers_count":11,"watchers_count":11,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":1,"forks":4,"open_issues":1,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/digipost/ios/pulls/2"},"html":{"href":"https://github.com/digipost/ios/pull/2"},"issue":{"href":"https://api.github.com/repos/digipost/ios/issues/2"},"comments":{"href":"https://api.github.com/repos/digipost/ios/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/digipost/ios/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/digipost/ios/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/digipost/ios/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/digipost/ios/statuses/058838ed85248f0dd4391491c3a92cb14b7819d1"}}}}