{"action":"created","comment":{"url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/pulls/comments/93924602","pull_request_review_id":14455960,"id":93924602,"diff_hunk":"@@ -0,0 +1,83 @@\n+<?php\n+\n+namespace BlizzardApi\\Tokens;\n+\n+use BlizzardApi\\BlizzardClient;\n+use BlizzardApi\\Tokens\\Exceptions\\Expired;\n+use GuzzleHttp\\Client;\n+use GuzzleHttp\\Psr7\\Response;\n+\n+/**\n+ * Class Access Token\n+ *\n+ * @author Hristo Mitev <duronrulez@gmail.com>\n+ */\n+class Access\n+{\n+    /**\n+     * @var string $token The access token itself\n+     */\n+    protected $token;\n+\n+    /**\n+     * @var string $tokenType The type of the token\n+     */\n+    protected $tokenType;\n+\n+    /**\n+     * @var int $expiresIn The time for the token to expire in seconds\n+     */\n+    protected $expiresIn;\n+\n+    /**\n+     * @var \\DateTime $createdAt when was the token created\n+     */\n+    protected $createdAt;\n+\n+    /**\n+     * @var \\DateTime $expiresAt when is the token expiring\n+     */\n+    protected $expiresAt;\n+\n+    /**\n+     * Access constructor.\n+     * @param string $accessToken\n+     * @param string $tokenType\n+     * @param int $expiresIn\n+     */\n+    public function __construct($accessToken, $tokenType, $expiresIn)\n+    {\n+        $this->token = $accessToken;\n+        $this->tokenType = $tokenType;\n+        $this->expiresIn = $expiresIn;\n+        $this->createdAt = new \\DateTime();\n+        $this->expiresAt = new \\DateTime();;\n+        $this->expiresAt->add(new \\DateInterval('PT'.$this->expiresIn.'S'));\n+    }\n+\n+    /**\n+     * Create token from json object\n+     * @param \\stdClass $jsonObject\n+     * @return \\BlizzardApi\\Tokens\\Access\n+     */\n+    public static function fromJson($jsonObject)\n+    {\n+        return new self($jsonObject->access_token, $jsonObject->token_type, $jsonObject->expires_in);\n+    }\n+\n+    public function isExpired() {\n+        if ($this->expiresAt > new \\DateTime()) {\n+            return false;\n+        }\n+\n+        return true;\n+    }\n+\n+    public function getToken() {","path":"src/Tokens/Access.php","position":76,"original_position":76,"commit_id":"2683186397917921bca7d788199f2445c052c6ad","original_commit_id":"2683186397917921bca7d788199f2445c052c6ad","user":{"login":"LogansUA","id":7515743,"avatar_url":"https://avatars.githubusercontent.com/u/7515743?v=3","gravatar_id":"","url":"https://api.github.com/users/LogansUA","html_url":"https://github.com/LogansUA","followers_url":"https://api.github.com/users/LogansUA/followers","following_url":"https://api.github.com/users/LogansUA/following{/other_user}","gists_url":"https://api.github.com/users/LogansUA/gists{/gist_id}","starred_url":"https://api.github.com/users/LogansUA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LogansUA/subscriptions","organizations_url":"https://api.github.com/users/LogansUA/orgs","repos_url":"https://api.github.com/users/LogansUA/repos","events_url":"https://api.github.com/users/LogansUA/events{/privacy}","received_events_url":"https://api.github.com/users/LogansUA/received_events","type":"User","site_admin":false},"body":"Reformat, add DocBlock","created_at":"2016-12-27T12:03:13Z","updated_at":"2016-12-27T12:03:26Z","html_url":"https://github.com/LogansUA/blizzard-api-php-client/pull/19#discussion_r93924602","pull_request_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/pulls/19","_links":{"self":{"href":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/pulls/comments/93924602"},"html":{"href":"https://github.com/LogansUA/blizzard-api-php-client/pull/19#discussion_r93924602"},"pull_request":{"href":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/pulls/19"}}},"pull_request":{"url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/pulls/19","id":99437181,"html_url":"https://github.com/LogansUA/blizzard-api-php-client/pull/19","diff_url":"https://github.com/LogansUA/blizzard-api-php-client/pull/19.diff","patch_url":"https://github.com/LogansUA/blizzard-api-php-client/pull/19.patch","issue_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/issues/19","number":19,"state":"open","locked":false,"title":"Add basic oAuth2 support","user":{"login":"duronrulez","id":981088,"avatar_url":"https://avatars.githubusercontent.com/u/981088?v=3","gravatar_id":"","url":"https://api.github.com/users/duronrulez","html_url":"https://github.com/duronrulez","followers_url":"https://api.github.com/users/duronrulez/followers","following_url":"https://api.github.com/users/duronrulez/following{/other_user}","gists_url":"https://api.github.com/users/duronrulez/gists{/gist_id}","starred_url":"https://api.github.com/users/duronrulez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duronrulez/subscriptions","organizations_url":"https://api.github.com/users/duronrulez/orgs","repos_url":"https://api.github.com/users/duronrulez/repos","events_url":"https://api.github.com/users/duronrulez/events{/privacy}","received_events_url":"https://api.github.com/users/duronrulez/received_events","type":"User","site_admin":false},"body":"Allow for basic oAuth2 operations to be performed against the blizzard Community and Game Data endpoints.","created_at":"2016-12-27T11:58:29Z","updated_at":"2016-12-27T12:03:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6f65fbea0994d8b75375ade3445b8c5f60c35391","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/pulls/19/commits","review_comments_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/pulls/19/comments","review_comment_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/issues/19/comments","statuses_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/statuses/2683186397917921bca7d788199f2445c052c6ad","head":{"label":"duronrulez:feature/oauth2","ref":"feature/oauth2","sha":"2683186397917921bca7d788199f2445c052c6ad","user":{"login":"duronrulez","id":981088,"avatar_url":"https://avatars.githubusercontent.com/u/981088?v=3","gravatar_id":"","url":"https://api.github.com/users/duronrulez","html_url":"https://github.com/duronrulez","followers_url":"https://api.github.com/users/duronrulez/followers","following_url":"https://api.github.com/users/duronrulez/following{/other_user}","gists_url":"https://api.github.com/users/duronrulez/gists{/gist_id}","starred_url":"https://api.github.com/users/duronrulez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duronrulez/subscriptions","organizations_url":"https://api.github.com/users/duronrulez/orgs","repos_url":"https://api.github.com/users/duronrulez/repos","events_url":"https://api.github.com/users/duronrulez/events{/privacy}","received_events_url":"https://api.github.com/users/duronrulez/received_events","type":"User","site_admin":false},"repo":{"id":77452076,"name":"blizzard-api-php-client","full_name":"duronrulez/blizzard-api-php-client","owner":{"login":"duronrulez","id":981088,"avatar_url":"https://avatars.githubusercontent.com/u/981088?v=3","gravatar_id":"","url":"https://api.github.com/users/duronrulez","html_url":"https://github.com/duronrulez","followers_url":"https://api.github.com/users/duronrulez/followers","following_url":"https://api.github.com/users/duronrulez/following{/other_user}","gists_url":"https://api.github.com/users/duronrulez/gists{/gist_id}","starred_url":"https://api.github.com/users/duronrulez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duronrulez/subscriptions","organizations_url":"https://api.github.com/users/duronrulez/orgs","repos_url":"https://api.github.com/users/duronrulez/repos","events_url":"https://api.github.com/users/duronrulez/events{/privacy}","received_events_url":"https://api.github.com/users/duronrulez/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/duronrulez/blizzard-api-php-client","description":"PHP API client for Blizzard API","fork":true,"url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client","forks_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/forks","keys_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/teams","hooks_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/hooks","issue_events_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/issues/events{/number}","events_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/events","assignees_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/assignees{/user}","branches_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/branches{/branch}","tags_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/tags","blobs_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/statuses/{sha}","languages_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/languages","stargazers_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/stargazers","contributors_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/contributors","subscribers_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/subscribers","subscription_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/subscription","commits_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/contents/{+path}","compare_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/merges","archive_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/downloads","issues_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/issues{/number}","pulls_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/pulls{/number}","milestones_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/milestones{/number}","notifications_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/labels{/name}","releases_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/releases{/id}","deployments_url":"https://api.github.com/repos/duronrulez/blizzard-api-php-client/deployments","created_at":"2016-12-27T11:56:46Z","updated_at":"2016-12-27T11:56:48Z","pushed_at":"2016-12-27T12:01:35Z","git_url":"git://github.com/duronrulez/blizzard-api-php-client.git","ssh_url":"git@github.com:duronrulez/blizzard-api-php-client.git","clone_url":"https://github.com/duronrulez/blizzard-api-php-client.git","svn_url":"https://github.com/duronrulez/blizzard-api-php-client","homepage":"https://github.com/LogansUA/blizzard-api-php-client","size":128,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"LogansUA:master","ref":"master","sha":"9d7c7bdfcb6a5b4964f267c8d8ae8c8ca115dd47","user":{"login":"LogansUA","id":7515743,"avatar_url":"https://avatars.githubusercontent.com/u/7515743?v=3","gravatar_id":"","url":"https://api.github.com/users/LogansUA","html_url":"https://github.com/LogansUA","followers_url":"https://api.github.com/users/LogansUA/followers","following_url":"https://api.github.com/users/LogansUA/following{/other_user}","gists_url":"https://api.github.com/users/LogansUA/gists{/gist_id}","starred_url":"https://api.github.com/users/LogansUA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LogansUA/subscriptions","organizations_url":"https://api.github.com/users/LogansUA/orgs","repos_url":"https://api.github.com/users/LogansUA/repos","events_url":"https://api.github.com/users/LogansUA/events{/privacy}","received_events_url":"https://api.github.com/users/LogansUA/received_events","type":"User","site_admin":false},"repo":{"id":47888937,"name":"blizzard-api-php-client","full_name":"LogansUA/blizzard-api-php-client","owner":{"login":"LogansUA","id":7515743,"avatar_url":"https://avatars.githubusercontent.com/u/7515743?v=3","gravatar_id":"","url":"https://api.github.com/users/LogansUA","html_url":"https://github.com/LogansUA","followers_url":"https://api.github.com/users/LogansUA/followers","following_url":"https://api.github.com/users/LogansUA/following{/other_user}","gists_url":"https://api.github.com/users/LogansUA/gists{/gist_id}","starred_url":"https://api.github.com/users/LogansUA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LogansUA/subscriptions","organizations_url":"https://api.github.com/users/LogansUA/orgs","repos_url":"https://api.github.com/users/LogansUA/repos","events_url":"https://api.github.com/users/LogansUA/events{/privacy}","received_events_url":"https://api.github.com/users/LogansUA/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/LogansUA/blizzard-api-php-client","description":"PHP API client for Blizzard API","fork":false,"url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client","forks_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/forks","keys_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/teams","hooks_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/hooks","issue_events_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/issues/events{/number}","events_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/events","assignees_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/assignees{/user}","branches_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/branches{/branch}","tags_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/tags","blobs_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/statuses/{sha}","languages_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/languages","stargazers_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/stargazers","contributors_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/contributors","subscribers_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/subscribers","subscription_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/subscription","commits_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/contents/{+path}","compare_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/merges","archive_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/downloads","issues_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/issues{/number}","pulls_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/pulls{/number}","milestones_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/milestones{/number}","notifications_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/labels{/name}","releases_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/releases{/id}","deployments_url":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/deployments","created_at":"2015-12-12T18:09:34Z","updated_at":"2016-11-05T00:27:13Z","pushed_at":"2016-12-27T11:58:30Z","git_url":"git://github.com/LogansUA/blizzard-api-php-client.git","ssh_url":"git@github.com:LogansUA/blizzard-api-php-client.git","clone_url":"https://github.com/LogansUA/blizzard-api-php-client.git","svn_url":"https://github.com/LogansUA/blizzard-api-php-client","homepage":"https://github.com/LogansUA/blizzard-api-php-client","size":128,"stargazers_count":6,"watchers_count":6,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/pulls/19"},"html":{"href":"https://github.com/LogansUA/blizzard-api-php-client/pull/19"},"issue":{"href":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/issues/19"},"comments":{"href":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/LogansUA/blizzard-api-php-client/statuses/2683186397917921bca7d788199f2445c052c6ad"}}}}
{"actor":{"display_login":"LogansUA"}}