{"action":"created","comment":{"url":"https://api.github.com/repos/meanbee/articles-to-podcast/pulls/comments/31216669","id":31216669,"diff_hunk":"@@ -0,0 +1,221 @@\n+<?php namespace App\\Services;\n+\n+use \\App\\Items as ItemModel;\n+use \\App\\UserItems as UserItemsModel;\n+use GuzzleHttp\\Exception\\ClientException;\n+use Goose\\Client as GooseClient;\n+use Readability;\n+use \\Log;\n+\n+class Pocket {\n+\n+    const POCKET_API_URL = \"https://getpocket.com/v3/\";\n+\n+    /**\n+     * User to make pocket requests on behalf of.\n+     * @var\n+     */\n+    protected $user;\n+\n+    /**\n+     * @var \\GuzzleHttp\\Client $httpClient\n+     */\n+    protected $httpClient;\n+\n+    public function __construct($user)\n+    {\n+        $this->user = $user;\n+    }\n+\n+    /**\n+     * Add latest pock\n+     *\n+     * @throws \\Exception\n+     */\n+    public function synchronisePocketItems()\n+    {\n+\n+        $feed = $this->getPocketFeed();\n+\n+        $urls = array();\n+        foreach ($feed as $feedItem) {\n+            $item = $this->addItem($feedItem['resolved_url'], $feedItem['resolved_title'], $feedItem['excerpt']);\n+            if ($item) {\n+                $this->addUserItem($item);\n+                $urls[] = $feedItem['resolved_url'];\n+            }\n+        }\n+\n+        // Remove previous items which are no longer in the feed\n+        $affectedRows = UserItemsModel::whereNotIn('item_id', array_map(\"md5\", $urls))->delete();","path":"app/Services/Pocket.php","position":50,"original_position":50,"commit_id":"0232f23ff6e6a33a2fc5ffda7ae5c2d7ceaf6ad2","original_commit_id":"0232f23ff6e6a33a2fc5ffda7ae5c2d7ceaf6ad2","user":{"login":"tgerulaitis","id":613076,"avatar_url":"https://avatars.githubusercontent.com/u/613076?v=3","gravatar_id":"","url":"https://api.github.com/users/tgerulaitis","html_url":"https://github.com/tgerulaitis","followers_url":"https://api.github.com/users/tgerulaitis/followers","following_url":"https://api.github.com/users/tgerulaitis/following{/other_user}","gists_url":"https://api.github.com/users/tgerulaitis/gists{/gist_id}","starred_url":"https://api.github.com/users/tgerulaitis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgerulaitis/subscriptions","organizations_url":"https://api.github.com/users/tgerulaitis/orgs","repos_url":"https://api.github.com/users/tgerulaitis/repos","events_url":"https://api.github.com/users/tgerulaitis/events{/privacy}","received_events_url":"https://api.github.com/users/tgerulaitis/received_events","type":"User","site_admin":false},"body":"There's no condition on the user_id here! Does this mean we're removing all items except for the ones that appear in the current user's feed? For each user?","created_at":"2015-05-28T09:28:20Z","updated_at":"2015-05-28T09:28:20Z","html_url":"https://github.com/meanbee/articles-to-podcast/pull/3#discussion_r31216669","pull_request_url":"https://api.github.com/repos/meanbee/articles-to-podcast/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/meanbee/articles-to-podcast/pulls/comments/31216669"},"html":{"href":"https://github.com/meanbee/articles-to-podcast/pull/3#discussion_r31216669"},"pull_request":{"href":"https://api.github.com/repos/meanbee/articles-to-podcast/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/meanbee/articles-to-podcast/pulls/3","id":36379957,"html_url":"https://github.com/meanbee/articles-to-podcast/pull/3","diff_url":"https://github.com/meanbee/articles-to-podcast/pull/3.diff","patch_url":"https://github.com/meanbee/articles-to-podcast/pull/3.patch","issue_url":"https://api.github.com/repos/meanbee/articles-to-podcast/issues/3","number":3,"state":"open","locked":false,"title":"Feature/pocket feed","user":{"login":"bobbyshaw","id":553566,"avatar_url":"https://avatars.githubusercontent.com/u/553566?v=3","gravatar_id":"","url":"https://api.github.com/users/bobbyshaw","html_url":"https://github.com/bobbyshaw","followers_url":"https://api.github.com/users/bobbyshaw/followers","following_url":"https://api.github.com/users/bobbyshaw/following{/other_user}","gists_url":"https://api.github.com/users/bobbyshaw/gists{/gist_id}","starred_url":"https://api.github.com/users/bobbyshaw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobbyshaw/subscriptions","organizations_url":"https://api.github.com/users/bobbyshaw/orgs","repos_url":"https://api.github.com/users/bobbyshaw/repos","events_url":"https://api.github.com/users/bobbyshaw/events{/privacy}","received_events_url":"https://api.github.com/users/bobbyshaw/received_events","type":"User","site_admin":false},"body":"Remove manual add item form and pull feed through from pocket.  Gets run upon login and on the hour afterwards.\r\n\r\nAlso worked on using Readability as a secondary method of getting text content if Goose fails. \r\n\r\nAdded title and excerpt from Pocket API response to items table as that's more reliable. ","created_at":"2015-05-28T07:48:54Z","updated_at":"2015-05-28T09:28:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6696f4425fe1f9fc108cea0924a2f27e06e77940","assignee":{"login":"ashsmith","id":1086841,"avatar_url":"https://avatars.githubusercontent.com/u/1086841?v=3","gravatar_id":"","url":"https://api.github.com/users/ashsmith","html_url":"https://github.com/ashsmith","followers_url":"https://api.github.com/users/ashsmith/followers","following_url":"https://api.github.com/users/ashsmith/following{/other_user}","gists_url":"https://api.github.com/users/ashsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/ashsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashsmith/subscriptions","organizations_url":"https://api.github.com/users/ashsmith/orgs","repos_url":"https://api.github.com/users/ashsmith/repos","events_url":"https://api.github.com/users/ashsmith/events{/privacy}","received_events_url":"https://api.github.com/users/ashsmith/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/meanbee/articles-to-podcast/pulls/3/commits","review_comments_url":"https://api.github.com/repos/meanbee/articles-to-podcast/pulls/3/comments","review_comment_url":"https://api.github.com/repos/meanbee/articles-to-podcast/pulls/comments{/number}","comments_url":"https://api.github.com/repos/meanbee/articles-to-podcast/issues/3/comments","statuses_url":"https://api.github.com/repos/meanbee/articles-to-podcast/statuses/0232f23ff6e6a33a2fc5ffda7ae5c2d7ceaf6ad2","head":{"label":"meanbee:feature/pocket-feed","ref":"feature/pocket-feed","sha":"0232f23ff6e6a33a2fc5ffda7ae5c2d7ceaf6ad2","user":{"login":"meanbee","id":58301,"avatar_url":"https://avatars.githubusercontent.com/u/58301?v=3","gravatar_id":"","url":"https://api.github.com/users/meanbee","html_url":"https://github.com/meanbee","followers_url":"https://api.github.com/users/meanbee/followers","following_url":"https://api.github.com/users/meanbee/following{/other_user}","gists_url":"https://api.github.com/users/meanbee/gists{/gist_id}","starred_url":"https://api.github.com/users/meanbee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meanbee/subscriptions","organizations_url":"https://api.github.com/users/meanbee/orgs","repos_url":"https://api.github.com/users/meanbee/repos","events_url":"https://api.github.com/users/meanbee/events{/privacy}","received_events_url":"https://api.github.com/users/meanbee/received_events","type":"Organization","site_admin":false},"repo":{"id":34008818,"name":"articles-to-podcast","full_name":"meanbee/articles-to-podcast","owner":{"login":"meanbee","id":58301,"avatar_url":"https://avatars.githubusercontent.com/u/58301?v=3","gravatar_id":"","url":"https://api.github.com/users/meanbee","html_url":"https://github.com/meanbee","followers_url":"https://api.github.com/users/meanbee/followers","following_url":"https://api.github.com/users/meanbee/following{/other_user}","gists_url":"https://api.github.com/users/meanbee/gists{/gist_id}","starred_url":"https://api.github.com/users/meanbee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meanbee/subscriptions","organizations_url":"https://api.github.com/users/meanbee/orgs","repos_url":"https://api.github.com/users/meanbee/repos","events_url":"https://api.github.com/users/meanbee/events{/privacy}","received_events_url":"https://api.github.com/users/meanbee/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/meanbee/articles-to-podcast","description":"Convert text articles to podcast feed.","fork":false,"url":"https://api.github.com/repos/meanbee/articles-to-podcast","forks_url":"https://api.github.com/repos/meanbee/articles-to-podcast/forks","keys_url":"https://api.github.com/repos/meanbee/articles-to-podcast/keys{/key_id}","collaborators_url":"https://api.github.com/repos/meanbee/articles-to-podcast/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/meanbee/articles-to-podcast/teams","hooks_url":"https://api.github.com/repos/meanbee/articles-to-podcast/hooks","issue_events_url":"https://api.github.com/repos/meanbee/articles-to-podcast/issues/events{/number}","events_url":"https://api.github.com/repos/meanbee/articles-to-podcast/events","assignees_url":"https://api.github.com/repos/meanbee/articles-to-podcast/assignees{/user}","branches_url":"https://api.github.com/repos/meanbee/articles-to-podcast/branches{/branch}","tags_url":"https://api.github.com/repos/meanbee/articles-to-podcast/tags","blobs_url":"https://api.github.com/repos/meanbee/articles-to-podcast/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/meanbee/articles-to-podcast/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/meanbee/articles-to-podcast/git/refs{/sha}","trees_url":"https://api.github.com/repos/meanbee/articles-to-podcast/git/trees{/sha}","statuses_url":"https://api.github.com/repos/meanbee/articles-to-podcast/statuses/{sha}","languages_url":"https://api.github.com/repos/meanbee/articles-to-podcast/languages","stargazers_url":"https://api.github.com/repos/meanbee/articles-to-podcast/stargazers","contributors_url":"https://api.github.com/repos/meanbee/articles-to-podcast/contributors","subscribers_url":"https://api.github.com/repos/meanbee/articles-to-podcast/subscribers","subscription_url":"https://api.github.com/repos/meanbee/articles-to-podcast/subscription","commits_url":"https://api.github.com/repos/meanbee/articles-to-podcast/commits{/sha}","git_commits_url":"https://api.github.com/repos/meanbee/articles-to-podcast/git/commits{/sha}","comments_url":"https://api.github.com/repos/meanbee/articles-to-podcast/comments{/number}","issue_comment_url":"https://api.github.com/repos/meanbee/articles-to-podcast/issues/comments{/number}","contents_url":"https://api.github.com/repos/meanbee/articles-to-podcast/contents/{+path}","compare_url":"https://api.github.com/repos/meanbee/articles-to-podcast/compare/{base}...{head}","merges_url":"https://api.github.com/repos/meanbee/articles-to-podcast/merges","archive_url":"https://api.github.com/repos/meanbee/articles-to-podcast/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/meanbee/articles-to-podcast/downloads","issues_url":"https://api.github.com/repos/meanbee/articles-to-podcast/issues{/number}","pulls_url":"https://api.github.com/repos/meanbee/articles-to-podcast/pulls{/number}","milestones_url":"https://api.github.com/repos/meanbee/articles-to-podcast/milestones{/number}","notifications_url":"https://api.github.com/repos/meanbee/articles-to-podcast/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/meanbee/articles-to-podcast/labels{/name}","releases_url":"https://api.github.com/repos/meanbee/articles-to-podcast/releases{/id}","created_at":"2015-04-15T17:37:22Z","updated_at":"2015-04-17T09:26:56Z","pushed_at":"2015-05-28T07:48:54Z","git_url":"git://github.com/meanbee/articles-to-podcast.git","ssh_url":"git@github.com:meanbee/articles-to-podcast.git","clone_url":"https://github.com/meanbee/articles-to-podcast.git","svn_url":"https://github.com/meanbee/articles-to-podcast","homepage":null,"size":1052,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"meanbee:master","ref":"master","sha":"d38db15cbdda2178a6cc0abf490e35420e1efbe2","user":{"login":"meanbee","id":58301,"avatar_url":"https://avatars.githubusercontent.com/u/58301?v=3","gravatar_id":"","url":"https://api.github.com/users/meanbee","html_url":"https://github.com/meanbee","followers_url":"https://api.github.com/users/meanbee/followers","following_url":"https://api.github.com/users/meanbee/following{/other_user}","gists_url":"https://api.github.com/users/meanbee/gists{/gist_id}","starred_url":"https://api.github.com/users/meanbee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meanbee/subscriptions","organizations_url":"https://api.github.com/users/meanbee/orgs","repos_url":"https://api.github.com/users/meanbee/repos","events_url":"https://api.github.com/users/meanbee/events{/privacy}","received_events_url":"https://api.github.com/users/meanbee/received_events","type":"Organization","site_admin":false},"repo":{"id":34008818,"name":"articles-to-podcast","full_name":"meanbee/articles-to-podcast","owner":{"login":"meanbee","id":58301,"avatar_url":"https://avatars.githubusercontent.com/u/58301?v=3","gravatar_id":"","url":"https://api.github.com/users/meanbee","html_url":"https://github.com/meanbee","followers_url":"https://api.github.com/users/meanbee/followers","following_url":"https://api.github.com/users/meanbee/following{/other_user}","gists_url":"https://api.github.com/users/meanbee/gists{/gist_id}","starred_url":"https://api.github.com/users/meanbee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meanbee/subscriptions","organizations_url":"https://api.github.com/users/meanbee/orgs","repos_url":"https://api.github.com/users/meanbee/repos","events_url":"https://api.github.com/users/meanbee/events{/privacy}","received_events_url":"https://api.github.com/users/meanbee/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/meanbee/articles-to-podcast","description":"Convert text articles to podcast feed.","fork":false,"url":"https://api.github.com/repos/meanbee/articles-to-podcast","forks_url":"https://api.github.com/repos/meanbee/articles-to-podcast/forks","keys_url":"https://api.github.com/repos/meanbee/articles-to-podcast/keys{/key_id}","collaborators_url":"https://api.github.com/repos/meanbee/articles-to-podcast/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/meanbee/articles-to-podcast/teams","hooks_url":"https://api.github.com/repos/meanbee/articles-to-podcast/hooks","issue_events_url":"https://api.github.com/repos/meanbee/articles-to-podcast/issues/events{/number}","events_url":"https://api.github.com/repos/meanbee/articles-to-podcast/events","assignees_url":"https://api.github.com/repos/meanbee/articles-to-podcast/assignees{/user}","branches_url":"https://api.github.com/repos/meanbee/articles-to-podcast/branches{/branch}","tags_url":"https://api.github.com/repos/meanbee/articles-to-podcast/tags","blobs_url":"https://api.github.com/repos/meanbee/articles-to-podcast/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/meanbee/articles-to-podcast/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/meanbee/articles-to-podcast/git/refs{/sha}","trees_url":"https://api.github.com/repos/meanbee/articles-to-podcast/git/trees{/sha}","statuses_url":"https://api.github.com/repos/meanbee/articles-to-podcast/statuses/{sha}","languages_url":"https://api.github.com/repos/meanbee/articles-to-podcast/languages","stargazers_url":"https://api.github.com/repos/meanbee/articles-to-podcast/stargazers","contributors_url":"https://api.github.com/repos/meanbee/articles-to-podcast/contributors","subscribers_url":"https://api.github.com/repos/meanbee/articles-to-podcast/subscribers","subscription_url":"https://api.github.com/repos/meanbee/articles-to-podcast/subscription","commits_url":"https://api.github.com/repos/meanbee/articles-to-podcast/commits{/sha}","git_commits_url":"https://api.github.com/repos/meanbee/articles-to-podcast/git/commits{/sha}","comments_url":"https://api.github.com/repos/meanbee/articles-to-podcast/comments{/number}","issue_comment_url":"https://api.github.com/repos/meanbee/articles-to-podcast/issues/comments{/number}","contents_url":"https://api.github.com/repos/meanbee/articles-to-podcast/contents/{+path}","compare_url":"https://api.github.com/repos/meanbee/articles-to-podcast/compare/{base}...{head}","merges_url":"https://api.github.com/repos/meanbee/articles-to-podcast/merges","archive_url":"https://api.github.com/repos/meanbee/articles-to-podcast/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/meanbee/articles-to-podcast/downloads","issues_url":"https://api.github.com/repos/meanbee/articles-to-podcast/issues{/number}","pulls_url":"https://api.github.com/repos/meanbee/articles-to-podcast/pulls{/number}","milestones_url":"https://api.github.com/repos/meanbee/articles-to-podcast/milestones{/number}","notifications_url":"https://api.github.com/repos/meanbee/articles-to-podcast/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/meanbee/articles-to-podcast/labels{/name}","releases_url":"https://api.github.com/repos/meanbee/articles-to-podcast/releases{/id}","created_at":"2015-04-15T17:37:22Z","updated_at":"2015-04-17T09:26:56Z","pushed_at":"2015-05-28T07:48:54Z","git_url":"git://github.com/meanbee/articles-to-podcast.git","ssh_url":"git@github.com:meanbee/articles-to-podcast.git","clone_url":"https://github.com/meanbee/articles-to-podcast.git","svn_url":"https://github.com/meanbee/articles-to-podcast","homepage":null,"size":1052,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/meanbee/articles-to-podcast/pulls/3"},"html":{"href":"https://github.com/meanbee/articles-to-podcast/pull/3"},"issue":{"href":"https://api.github.com/repos/meanbee/articles-to-podcast/issues/3"},"comments":{"href":"https://api.github.com/repos/meanbee/articles-to-podcast/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/meanbee/articles-to-podcast/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/meanbee/articles-to-podcast/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/meanbee/articles-to-podcast/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/meanbee/articles-to-podcast/statuses/0232f23ff6e6a33a2fc5ffda7ae5c2d7ceaf6ad2"}}}}