GitHub PullRequestReviewCommentEvent at 2014-10-04 21:31:13
Repository: doorkeeper
Actor: houndci
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls/comments/18431821","id":18431821,"diff_hunk":"@@ -0,0 +1,121 @@\n+module Doorkeeper\n+  module AccessTokenMixin\n+    extend ActiveSupport::Concern\n+\n+    include OAuth::Helpers\n+    include Models::Expirable\n+    include Models::Revocable\n+    include Models::Accessible\n+    include Models::Scopes\n+\n+    included do\n+      belongs_to :application,\n+                 class_name: 'Doorkeeper::Application',\n+                 inverse_of: :access_tokens\n+\n+      validates :token, presence: true, uniqueness: true\n+      validates :refresh_token, uniqueness: true, if: :use_refresh_token?\n+\n+      attr_writer :use_refresh_token\n+\n+      if ::Rails.version.to_i < 4 || defined?(::ProtectedAttributes)\n+        attr_accessible :application_id, :resource_owner_id, :expires_in,\n+                        :scopes, :use_refresh_token\n+      end\n+\n+      before_validation :generate_token, on: :create\n+      before_validation :generate_refresh_token,\n+                        on: :create,\n+                        if: :use_refresh_token?\n+    end\n+\n+    module ClassMethods\n+      def by_token(token)\n+        where(token: token).first\n+      end\n+\n+      def by_refresh_token(refresh_token)\n+        where(refresh_token: refresh_token).first\n+      end\n+\n+      def revoke_all_for(application_id, resource_owner)\n+        where(application_id: application_id,\n+              resource_owner_id: resource_owner.id,\n+              revoked_at: nil).\n+          map(&:revoke)\n+      end\n+\n+      def matching_token_for(application, resource_owner_or_id, scopes)\n+        resource_owner_id = if resource_owner_or_id.respond_to?(:to_key)\n+                              resource_owner_or_id.id\n+                            else\n+                              resource_owner_or_id\n+                            end\n+        token = last_authorized_token_for(application.try(:id), resource_owner_id)\n+        token if token && Doorkeeper::OAuth::Helpers::ScopeChecker.matches?(token.scopes, scopes)","path":"lib/doorkeeper/models/access_token_mixin.rb","position":55,"original_position":55,"commit_id":"fe24b55a7d8ed196e1999b9517f5eadf528bd53a","original_commit_id":"fe24b55a7d8ed196e1999b9517f5eadf528bd53a","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=2","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":"User","site_admin":false},"body":"Line is too long. [97/80]","created_at":"2014-10-04T21:31:13Z","updated_at":"2014-10-04T21:31:13Z","html_url":"https://github.com/doorkeeper-gem/doorkeeper/pull/491#discussion_r18431821","pull_request_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls/491","_links":{"self":{"href":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls/comments/18431821"},"html":{"href":"https://github.com/doorkeeper-gem/doorkeeper/pull/491#discussion_r18431821"},"pull_request":{"href":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls/491"}}},"pull_request":{"url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls/491","id":22248253,"html_url":"https://github.com/doorkeeper-gem/doorkeeper/pull/491","diff_url":"https://github.com/doorkeeper-gem/doorkeeper/pull/491.diff","patch_url":"https://github.com/doorkeeper-gem/doorkeeper/pull/491.patch","issue_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues/491","number":491,"state":"open","locked":false,"title":"ORM refactors","user":{"login":"tute","id":54260,"avatar_url":"https://avatars.githubusercontent.com/u/54260?v=2","gravatar_id":"","url":"https://api.github.com/users/tute","html_url":"https://github.com/tute","followers_url":"https://api.github.com/users/tute/followers","following_url":"https://api.github.com/users/tute/following{/other_user}","gists_url":"https://api.github.com/users/tute/gists{/gist_id}","starred_url":"https://api.github.com/users/tute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tute/subscriptions","organizations_url":"https://api.github.com/users/tute/orgs","repos_url":"https://api.github.com/users/tute/repos","events_url":"https://api.github.com/users/tute/events{/privacy}","received_events_url":"https://api.github.com/users/tute/received_events","type":"User","site_admin":false},"body":"Working together with @jasl (see source PR in https://github.com/doorkeeper-gem/doorkeeper/pull/478).","created_at":"2014-10-04T21:31:05Z","updated_at":"2014-10-04T21:31:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"199f2c8ee972876834159fe2f37fcceb9744f1c2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls/491/commits","review_comments_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls/491/comments","review_comment_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls/comments/{number}","comments_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues/491/comments","statuses_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/statuses/fe24b55a7d8ed196e1999b9517f5eadf528bd53a","head":{"label":"doorkeeper-gem:pr/478","ref":"pr/478","sha":"fe24b55a7d8ed196e1999b9517f5eadf528bd53a","user":{"login":"doorkeeper-gem","id":7275750,"avatar_url":"https://avatars.githubusercontent.com/u/7275750?v=2","gravatar_id":"","url":"https://api.github.com/users/doorkeeper-gem","html_url":"https://github.com/doorkeeper-gem","followers_url":"https://api.github.com/users/doorkeeper-gem/followers","following_url":"https://api.github.com/users/doorkeeper-gem/following{/other_user}","gists_url":"https://api.github.com/users/doorkeeper-gem/gists{/gist_id}","starred_url":"https://api.github.com/users/doorkeeper-gem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doorkeeper-gem/subscriptions","organizations_url":"https://api.github.com/users/doorkeeper-gem/orgs","repos_url":"https://api.github.com/users/doorkeeper-gem/repos","events_url":"https://api.github.com/users/doorkeeper-gem/events{/privacy}","received_events_url":"https://api.github.com/users/doorkeeper-gem/received_events","type":"Organization","site_admin":false},"repo":{"id":2802565,"name":"doorkeeper","full_name":"doorkeeper-gem/doorkeeper","owner":{"login":"doorkeeper-gem","id":7275750,"avatar_url":"https://avatars.githubusercontent.com/u/7275750?v=2","gravatar_id":"","url":"https://api.github.com/users/doorkeeper-gem","html_url":"https://github.com/doorkeeper-gem","followers_url":"https://api.github.com/users/doorkeeper-gem/followers","following_url":"https://api.github.com/users/doorkeeper-gem/following{/other_user}","gists_url":"https://api.github.com/users/doorkeeper-gem/gists{/gist_id}","starred_url":"https://api.github.com/users/doorkeeper-gem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doorkeeper-gem/subscriptions","organizations_url":"https://api.github.com/users/doorkeeper-gem/orgs","repos_url":"https://api.github.com/users/doorkeeper-gem/repos","events_url":"https://api.github.com/users/doorkeeper-gem/events{/privacy}","received_events_url":"https://api.github.com/users/doorkeeper-gem/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/doorkeeper-gem/doorkeeper","description":"Doorkeeper is an OAuth 2 provider for Rails.","fork":false,"url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper","forks_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/forks","keys_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/teams","hooks_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/hooks","issue_events_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues/events{/number}","events_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/events","assignees_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/assignees{/user}","branches_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/branches{/branch}","tags_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/tags","blobs_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/git/refs{/sha}","trees_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/statuses/{sha}","languages_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/languages","stargazers_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/stargazers","contributors_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/contributors","subscribers_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/subscribers","subscription_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/subscription","commits_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/commits{/sha}","git_commits_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/git/commits{/sha}","comments_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/comments{/number}","issue_comment_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues/comments/{number}","contents_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/contents/{+path}","compare_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/merges","archive_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/downloads","issues_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues{/number}","pulls_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls{/number}","milestones_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/milestones{/number}","notifications_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/labels{/name}","releases_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/releases{/id}","created_at":"2011-11-18T13:02:01Z","updated_at":"2014-10-03T06:30:26Z","pushed_at":"2014-10-04T21:30:39Z","git_url":"git://github.com/doorkeeper-gem/doorkeeper.git","ssh_url":"git@github.com:doorkeeper-gem/doorkeeper.git","clone_url":"https://github.com/doorkeeper-gem/doorkeeper.git","svn_url":"https://github.com/doorkeeper-gem/doorkeeper","homepage":"https://github.com/doorkeeper-gem/doorkeeper","size":8170,"stargazers_count":1729,"watchers_count":1729,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":378,"mirror_url":null,"open_issues_count":13,"forks":378,"open_issues":13,"watchers":1729,"default_branch":"master"}},"base":{"label":"doorkeeper-gem:master","ref":"master","sha":"2138b5f2c01797e4e3e9b93b6912deccec5dd6eb","user":{"login":"doorkeeper-gem","id":7275750,"avatar_url":"https://avatars.githubusercontent.com/u/7275750?v=2","gravatar_id":"","url":"https://api.github.com/users/doorkeeper-gem","html_url":"https://github.com/doorkeeper-gem","followers_url":"https://api.github.com/users/doorkeeper-gem/followers","following_url":"https://api.github.com/users/doorkeeper-gem/following{/other_user}","gists_url":"https://api.github.com/users/doorkeeper-gem/gists{/gist_id}","starred_url":"https://api.github.com/users/doorkeeper-gem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doorkeeper-gem/subscriptions","organizations_url":"https://api.github.com/users/doorkeeper-gem/orgs","repos_url":"https://api.github.com/users/doorkeeper-gem/repos","events_url":"https://api.github.com/users/doorkeeper-gem/events{/privacy}","received_events_url":"https://api.github.com/users/doorkeeper-gem/received_events","type":"Organization","site_admin":false},"repo":{"id":2802565,"name":"doorkeeper","full_name":"doorkeeper-gem/doorkeeper","owner":{"login":"doorkeeper-gem","id":7275750,"avatar_url":"https://avatars.githubusercontent.com/u/7275750?v=2","gravatar_id":"","url":"https://api.github.com/users/doorkeeper-gem","html_url":"https://github.com/doorkeeper-gem","followers_url":"https://api.github.com/users/doorkeeper-gem/followers","following_url":"https://api.github.com/users/doorkeeper-gem/following{/other_user}","gists_url":"https://api.github.com/users/doorkeeper-gem/gists{/gist_id}","starred_url":"https://api.github.com/users/doorkeeper-gem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doorkeeper-gem/subscriptions","organizations_url":"https://api.github.com/users/doorkeeper-gem/orgs","repos_url":"https://api.github.com/users/doorkeeper-gem/repos","events_url":"https://api.github.com/users/doorkeeper-gem/events{/privacy}","received_events_url":"https://api.github.com/users/doorkeeper-gem/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/doorkeeper-gem/doorkeeper","description":"Doorkeeper is an OAuth 2 provider for Rails.","fork":false,"url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper","forks_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/forks","keys_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/teams","hooks_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/hooks","issue_events_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues/events{/number}","events_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/events","assignees_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/assignees{/user}","branches_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/branches{/branch}","tags_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/tags","blobs_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/git/refs{/sha}","trees_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/statuses/{sha}","languages_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/languages","stargazers_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/stargazers","contributors_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/contributors","subscribers_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/subscribers","subscription_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/subscription","commits_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/commits{/sha}","git_commits_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/git/commits{/sha}","comments_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/comments{/number}","issue_comment_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues/comments/{number}","contents_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/contents/{+path}","compare_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/merges","archive_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/downloads","issues_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues{/number}","pulls_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls{/number}","milestones_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/milestones{/number}","notifications_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/labels{/name}","releases_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/releases{/id}","created_at":"2011-11-18T13:02:01Z","updated_at":"2014-10-03T06:30:26Z","pushed_at":"2014-10-04T21:30:39Z","git_url":"git://github.com/doorkeeper-gem/doorkeeper.git","ssh_url":"git@github.com:doorkeeper-gem/doorkeeper.git","clone_url":"https://github.com/doorkeeper-gem/doorkeeper.git","svn_url":"https://github.com/doorkeeper-gem/doorkeeper","homepage":"https://github.com/doorkeeper-gem/doorkeeper","size":8170,"stargazers_count":1729,"watchers_count":1729,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":378,"mirror_url":null,"open_issues_count":13,"forks":378,"open_issues":13,"watchers":1729,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls/491"},"html":{"href":"https://github.com/doorkeeper-gem/doorkeeper/pull/491"},"issue":{"href":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues/491"},"comments":{"href":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues/491/comments"},"review_comments":{"href":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls/491/comments"},"review_comment":{"href":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls/491/commits"},"statuses":{"href":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/statuses/fe24b55a7d8ed196e1999b9517f5eadf528bd53a"}}}}