{"action":"created","comment":{"url":"https://api.github.com/repos/houndci/hound/pulls/comments/187482972","pull_request_review_id":119275064,"id":187482972,"diff_hunk":"@@ -0,0 +1,62 @@\n+class GitHubEventsController < ApplicationController\n+  skip_before_action :authenticate, only: :create\n+  skip_before_action :verify_authenticity_token, only: :create\n+\n+  def create\n+    case request.headers[\"X-GitHub-Event\"]\n+    when \"marketplace_purchase\"\n+      request_body = request.raw_post\n+      signature = request.headers[\"X-Hub-Signature\"]\n+\n+      if verified_github_request?(request_body, signature)\n+        event = JSON.parse(request_body)\n+\n+        case event.fetch(\"action\")\n+        when \"purchased\"\n+          owner = upsert_owner(event)\n+          owner.update!(\n+            marketplace_plan_id: event[\"marketplace_purchase\"][\"plan\"][\"id\"]\n+          )\n+        when \"changed\"\n+          owner = upsert_owner(event)\n+          owner.update!(\n+            marketplace_plan_id: event[\"marketplace_purchase\"][\"plan\"][\"id\"]\n+          )\n+        when \"cancelled\"\n+          owner = upsert_owner(event)\n+          owner.update!(\n+            marketplace_plan_id: nil\n+          )\n+        else\n+          raise \"Unknown GitHub Marketplace action (#{event[\"action\"]})\"\n+        end\n+      else\n+        raise \"Could not verify GitHub request (#{request.headers[\"X-GitHub-Delivery\"]})\"\n+      end\n+    else\n+      raise \"Unknown GitHub event (#{request.headers[\"X-GitHub-Event\"]})\"","path":"app/controllers/github_events_controller.rb","position":37,"original_position":37,"commit_id":"7f4505989648d111e0c9deb60c9b7c78499806f9","original_commit_id":"7f4505989648d111e0c9deb60c9b7c78499806f9","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars0.githubusercontent.com/u/6697940?v=4","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Prefer single-quoted strings inside interpolations.","created_at":"2018-05-10T22:59:42Z","updated_at":"2018-05-10T22:59:43Z","html_url":"https://github.com/houndci/hound/pull/1537#discussion_r187482972","pull_request_url":"https://api.github.com/repos/houndci/hound/pulls/1537","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/houndci/hound/pulls/comments/187482972"},"html":{"href":"https://github.com/houndci/hound/pull/1537#discussion_r187482972"},"pull_request":{"href":"https://api.github.com/repos/houndci/hound/pulls/1537"}}},"pull_request":{"url":"https://api.github.com/repos/houndci/hound/pulls/1537","id":187328916,"html_url":"https://github.com/houndci/hound/pull/1537","diff_url":"https://github.com/houndci/hound/pull/1537.diff","patch_url":"https://github.com/houndci/hound/pull/1537.patch","issue_url":"https://api.github.com/repos/houndci/hound/issues/1537","number":1537,"state":"open","locked":false,"title":"Handle Marketplace purchases","user":{"login":"salbertson","id":154463,"avatar_url":"https://avatars2.githubusercontent.com/u/154463?v=4","gravatar_id":"","url":"https://api.github.com/users/salbertson","html_url":"https://github.com/salbertson","followers_url":"https://api.github.com/users/salbertson/followers","following_url":"https://api.github.com/users/salbertson/following{/other_user}","gists_url":"https://api.github.com/users/salbertson/gists{/gist_id}","starred_url":"https://api.github.com/users/salbertson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/salbertson/subscriptions","organizations_url":"https://api.github.com/users/salbertson/orgs","repos_url":"https://api.github.com/users/salbertson/repos","events_url":"https://api.github.com/users/salbertson/events{/privacy}","received_events_url":"https://api.github.com/users/salbertson/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-05-10T22:59:13Z","updated_at":"2018-05-10T22:59:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5b8825e3cd3de65f947fbd007cdf4a479ddb0388","assignee":null,"assignees":[],"requested_reviewers":[{"login":"gylaz","id":116327,"avatar_url":"https://avatars3.githubusercontent.com/u/116327?v=4","gravatar_id":"","url":"https://api.github.com/users/gylaz","html_url":"https://github.com/gylaz","followers_url":"https://api.github.com/users/gylaz/followers","following_url":"https://api.github.com/users/gylaz/following{/other_user}","gists_url":"https://api.github.com/users/gylaz/gists{/gist_id}","starred_url":"https://api.github.com/users/gylaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gylaz/subscriptions","organizations_url":"https://api.github.com/users/gylaz/orgs","repos_url":"https://api.github.com/users/gylaz/repos","events_url":"https://api.github.com/users/gylaz/events{/privacy}","received_events_url":"https://api.github.com/users/gylaz/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/houndci/hound/pulls/1537/commits","review_comments_url":"https://api.github.com/repos/houndci/hound/pulls/1537/comments","review_comment_url":"https://api.github.com/repos/houndci/hound/pulls/comments{/number}","comments_url":"https://api.github.com/repos/houndci/hound/issues/1537/comments","statuses_url":"https://api.github.com/repos/houndci/hound/statuses/7f4505989648d111e0c9deb60c9b7c78499806f9","head":{"label":"houndci:marketplace-updates","ref":"marketplace-updates","sha":"7f4505989648d111e0c9deb60c9b7c78499806f9","user":{"login":"houndci","id":17184073,"avatar_url":"https://avatars0.githubusercontent.com/u/17184073?v=4","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"Organization","site_admin":false},"repo":{"id":7411076,"name":"hound","full_name":"houndci/hound","owner":{"login":"houndci","id":17184073,"avatar_url":"https://avatars0.githubusercontent.com/u/17184073?v=4","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/houndci/hound","description":"Code review for GitHub pull requests.","fork":false,"url":"https://api.github.com/repos/houndci/hound","forks_url":"https://api.github.com/repos/houndci/hound/forks","keys_url":"https://api.github.com/repos/houndci/hound/keys{/key_id}","collaborators_url":"https://api.github.com/repos/houndci/hound/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/houndci/hound/teams","hooks_url":"https://api.github.com/repos/houndci/hound/hooks","issue_events_url":"https://api.github.com/repos/houndci/hound/issues/events{/number}","events_url":"https://api.github.com/repos/houndci/hound/events","assignees_url":"https://api.github.com/repos/houndci/hound/assignees{/user}","branches_url":"https://api.github.com/repos/houndci/hound/branches{/branch}","tags_url":"https://api.github.com/repos/houndci/hound/tags","blobs_url":"https://api.github.com/repos/houndci/hound/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/houndci/hound/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/houndci/hound/git/refs{/sha}","trees_url":"https://api.github.com/repos/houndci/hound/git/trees{/sha}","statuses_url":"https://api.github.com/repos/houndci/hound/statuses/{sha}","languages_url":"https://api.github.com/repos/houndci/hound/languages","stargazers_url":"https://api.github.com/repos/houndci/hound/stargazers","contributors_url":"https://api.github.com/repos/houndci/hound/contributors","subscribers_url":"https://api.github.com/repos/houndci/hound/subscribers","subscription_url":"https://api.github.com/repos/houndci/hound/subscription","commits_url":"https://api.github.com/repos/houndci/hound/commits{/sha}","git_commits_url":"https://api.github.com/repos/houndci/hound/git/commits{/sha}","comments_url":"https://api.github.com/repos/houndci/hound/comments{/number}","issue_comment_url":"https://api.github.com/repos/houndci/hound/issues/comments{/number}","contents_url":"https://api.github.com/repos/houndci/hound/contents/{+path}","compare_url":"https://api.github.com/repos/houndci/hound/compare/{base}...{head}","merges_url":"https://api.github.com/repos/houndci/hound/merges","archive_url":"https://api.github.com/repos/houndci/hound/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/houndci/hound/downloads","issues_url":"https://api.github.com/repos/houndci/hound/issues{/number}","pulls_url":"https://api.github.com/repos/houndci/hound/pulls{/number}","milestones_url":"https://api.github.com/repos/houndci/hound/milestones{/number}","notifications_url":"https://api.github.com/repos/houndci/hound/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/houndci/hound/labels{/name}","releases_url":"https://api.github.com/repos/houndci/hound/releases{/id}","deployments_url":"https://api.github.com/repos/houndci/hound/deployments","created_at":"2013-01-02T18:12:40Z","updated_at":"2018-05-10T02:18:43Z","pushed_at":"2018-05-10T22:59:14Z","git_url":"git://github.com/houndci/hound.git","ssh_url":"git@github.com:houndci/hound.git","clone_url":"https://github.com/houndci/hound.git","svn_url":"https://github.com/houndci/hound","homepage":"https://houndci.com","size":4423,"stargazers_count":1575,"watchers_count":1575,"language":"Ruby","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":356,"mirror_url":null,"archived":false,"open_issues_count":19,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":356,"open_issues":19,"watchers":1575,"default_branch":"master"}},"base":{"label":"houndci:master","ref":"master","sha":"c177c277702f59a708705184cf2c78812f2afa52","user":{"login":"houndci","id":17184073,"avatar_url":"https://avatars0.githubusercontent.com/u/17184073?v=4","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"Organization","site_admin":false},"repo":{"id":7411076,"name":"hound","full_name":"houndci/hound","owner":{"login":"houndci","id":17184073,"avatar_url":"https://avatars0.githubusercontent.com/u/17184073?v=4","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/houndci/hound","description":"Code review for GitHub pull requests.","fork":false,"url":"https://api.github.com/repos/houndci/hound","forks_url":"https://api.github.com/repos/houndci/hound/forks","keys_url":"https://api.github.com/repos/houndci/hound/keys{/key_id}","collaborators_url":"https://api.github.com/repos/houndci/hound/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/houndci/hound/teams","hooks_url":"https://api.github.com/repos/houndci/hound/hooks","issue_events_url":"https://api.github.com/repos/houndci/hound/issues/events{/number}","events_url":"https://api.github.com/repos/houndci/hound/events","assignees_url":"https://api.github.com/repos/houndci/hound/assignees{/user}","branches_url":"https://api.github.com/repos/houndci/hound/branches{/branch}","tags_url":"https://api.github.com/repos/houndci/hound/tags","blobs_url":"https://api.github.com/repos/houndci/hound/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/houndci/hound/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/houndci/hound/git/refs{/sha}","trees_url":"https://api.github.com/repos/houndci/hound/git/trees{/sha}","statuses_url":"https://api.github.com/repos/houndci/hound/statuses/{sha}","languages_url":"https://api.github.com/repos/houndci/hound/languages","stargazers_url":"https://api.github.com/repos/houndci/hound/stargazers","contributors_url":"https://api.github.com/repos/houndci/hound/contributors","subscribers_url":"https://api.github.com/repos/houndci/hound/subscribers","subscription_url":"https://api.github.com/repos/houndci/hound/subscription","commits_url":"https://api.github.com/repos/houndci/hound/commits{/sha}","git_commits_url":"https://api.github.com/repos/houndci/hound/git/commits{/sha}","comments_url":"https://api.github.com/repos/houndci/hound/comments{/number}","issue_comment_url":"https://api.github.com/repos/houndci/hound/issues/comments{/number}","contents_url":"https://api.github.com/repos/houndci/hound/contents/{+path}","compare_url":"https://api.github.com/repos/houndci/hound/compare/{base}...{head}","merges_url":"https://api.github.com/repos/houndci/hound/merges","archive_url":"https://api.github.com/repos/houndci/hound/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/houndci/hound/downloads","issues_url":"https://api.github.com/repos/houndci/hound/issues{/number}","pulls_url":"https://api.github.com/repos/houndci/hound/pulls{/number}","milestones_url":"https://api.github.com/repos/houndci/hound/milestones{/number}","notifications_url":"https://api.github.com/repos/houndci/hound/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/houndci/hound/labels{/name}","releases_url":"https://api.github.com/repos/houndci/hound/releases{/id}","deployments_url":"https://api.github.com/repos/houndci/hound/deployments","created_at":"2013-01-02T18:12:40Z","updated_at":"2018-05-10T02:18:43Z","pushed_at":"2018-05-10T22:59:14Z","git_url":"git://github.com/houndci/hound.git","ssh_url":"git@github.com:houndci/hound.git","clone_url":"https://github.com/houndci/hound.git","svn_url":"https://github.com/houndci/hound","homepage":"https://houndci.com","size":4423,"stargazers_count":1575,"watchers_count":1575,"language":"Ruby","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":356,"mirror_url":null,"archived":false,"open_issues_count":19,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":356,"open_issues":19,"watchers":1575,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/houndci/hound/pulls/1537"},"html":{"href":"https://github.com/houndci/hound/pull/1537"},"issue":{"href":"https://api.github.com/repos/houndci/hound/issues/1537"},"comments":{"href":"https://api.github.com/repos/houndci/hound/issues/1537/comments"},"review_comments":{"href":"https://api.github.com/repos/houndci/hound/pulls/1537/comments"},"review_comment":{"href":"https://api.github.com/repos/houndci/hound/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/houndci/hound/pulls/1537/commits"},"statuses":{"href":"https://api.github.com/repos/houndci/hound/statuses/7f4505989648d111e0c9deb60c9b7c78499806f9"}},"author_association":"OWNER"}}
{"actor":{"display_login":"houndci-bot"}}