{"action":"created","comment":{"url":"https://api.github.com/repos/Katello/katello/pulls/comments/49865918","id":49865918,"diff_hunk":"@@ -0,0 +1,88 @@\n+module Katello\n+  class Api::V2::HostSubscriptionsController < Katello::Api::V2::ApiController\n+    before_filter :find_host\n+    before_filter :check_subscriptions, :only => [:add_subscriptions, :remove_subscriptions]\n+\n+    resource_description do\n+      api_version 'v2'\n+      api_base_url \"/api\"\n+    end\n+\n+    api :GET, \"/hosts/:host_id/subscriptions\", N_(\"List a host's subscriptions\")\n+    param :host_id, Integer, :desc => N_(\"Id of the host\"), :required => true\n+    def index\n+      @collection = index_response\n+      respond_for_index :collection => @collection\n+    end\n+\n+    def index_response\n+      entitlements = @host.subscription_facet.candlepin_consumer.entitlements\n+      subscriptions = entitlements.map { |entitlement| ::Katello::HostSubscriptionPresenter.new(entitlement) }\n+      full_result_response(subscriptions)\n+    end\n+\n+    api :PUT, \"/hosts/:host_id/subscriptions/auto_attach\", N_(\"Trigger an auto-attach of subscriptions\")\n+    param :host_id, Integer, :desc => N_(\"Id of the host\"), :required => true\n+    def auto_attach\n+      sync_task(::Actions::Katello::Host::AutoAttachSubscriptions, @host)\n+      respond_for_index(:collection => index_response, :template => \"index\")\n+    end\n+\n+    api :GET, \"/hosts/:host_id/subscriptions/events\", N_(\"List subscription events for the host\")\n+    param :host_id, Integer, :desc => N_(\"Id of the host\"), :required => true\n+    def events\n+      respond_for_index :collection => { :results => @host.subscription_facet.candlepin_consumer.events.map { |e| OpenStruct.new(e) } }","path":"app/controllers/katello/api/v2/host_subscriptions_controller.rb","position":34,"original_position":34,"commit_id":"5ef73fb0c060ca946295b0d3ef63cc43b74d1427","original_commit_id":"5ef73fb0c060ca946295b0d3ef63cc43b74d1427","user":{"login":"jlsherrill","id":395077,"avatar_url":"https://avatars.githubusercontent.com/u/395077?v=3","gravatar_id":"","url":"https://api.github.com/users/jlsherrill","html_url":"https://github.com/jlsherrill","followers_url":"https://api.github.com/users/jlsherrill/followers","following_url":"https://api.github.com/users/jlsherrill/following{/other_user}","gists_url":"https://api.github.com/users/jlsherrill/gists{/gist_id}","starred_url":"https://api.github.com/users/jlsherrill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlsherrill/subscriptions","organizations_url":"https://api.github.com/users/jlsherrill/orgs","repos_url":"https://api.github.com/users/jlsherrill/repos","events_url":"https://api.github.com/users/jlsherrill/events{/privacy}","received_events_url":"https://api.github.com/users/jlsherrill/received_events","type":"User","site_admin":false},"body":"Will update to fix the nulls, but you should be getting events.  Try adding and removing a subscription?  or clicking the auto-attach button?","created_at":"2016-01-15T15:33:29Z","updated_at":"2016-01-15T15:33:29Z","html_url":"https://github.com/Katello/katello/pull/5695#discussion_r49865918","pull_request_url":"https://api.github.com/repos/Katello/katello/pulls/5695","_links":{"self":{"href":"https://api.github.com/repos/Katello/katello/pulls/comments/49865918"},"html":{"href":"https://github.com/Katello/katello/pull/5695#discussion_r49865918"},"pull_request":{"href":"https://api.github.com/repos/Katello/katello/pulls/5695"}}},"pull_request":{"url":"https://api.github.com/repos/Katello/katello/pulls/5695","id":55472834,"html_url":"https://github.com/Katello/katello/pull/5695","diff_url":"https://github.com/Katello/katello/pull/5695.diff","patch_url":"https://github.com/Katello/katello/pull/5695.patch","issue_url":"https://api.github.com/repos/Katello/katello/issues/5695","number":5695,"state":"open","locked":false,"title":"fixes #13086 - migrating system subscription apis to hosts","user":{"login":"jlsherrill","id":395077,"avatar_url":"https://avatars.githubusercontent.com/u/395077?v=3","gravatar_id":"","url":"https://api.github.com/users/jlsherrill","html_url":"https://github.com/jlsherrill","followers_url":"https://api.github.com/users/jlsherrill/followers","following_url":"https://api.github.com/users/jlsherrill/following{/other_user}","gists_url":"https://api.github.com/users/jlsherrill/gists{/gist_id}","starred_url":"https://api.github.com/users/jlsherrill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlsherrill/subscriptions","organizations_url":"https://api.github.com/users/jlsherrill/orgs","repos_url":"https://api.github.com/users/jlsherrill/repos","events_url":"https://api.github.com/users/jlsherrill/events{/privacy}","received_events_url":"https://api.github.com/users/jlsherrill/received_events","type":"User","site_admin":false},"body":"covered apis migrated:\r\n * adding/removing subscriptions\r\n * subscription events\r\n * auto attach","created_at":"2016-01-08T15:23:35Z","updated_at":"2016-01-15T15:33:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a0a4709b2f657e4bc5f7708fe1d518efb8649550","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Katello/katello/pulls/5695/commits","review_comments_url":"https://api.github.com/repos/Katello/katello/pulls/5695/comments","review_comment_url":"https://api.github.com/repos/Katello/katello/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Katello/katello/issues/5695/comments","statuses_url":"https://api.github.com/repos/Katello/katello/statuses/5ef73fb0c060ca946295b0d3ef63cc43b74d1427","head":{"label":"jlsherrill:subscriptions2","ref":"subscriptions2","sha":"5ef73fb0c060ca946295b0d3ef63cc43b74d1427","user":{"login":"jlsherrill","id":395077,"avatar_url":"https://avatars.githubusercontent.com/u/395077?v=3","gravatar_id":"","url":"https://api.github.com/users/jlsherrill","html_url":"https://github.com/jlsherrill","followers_url":"https://api.github.com/users/jlsherrill/followers","following_url":"https://api.github.com/users/jlsherrill/following{/other_user}","gists_url":"https://api.github.com/users/jlsherrill/gists{/gist_id}","starred_url":"https://api.github.com/users/jlsherrill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlsherrill/subscriptions","organizations_url":"https://api.github.com/users/jlsherrill/orgs","repos_url":"https://api.github.com/users/jlsherrill/repos","events_url":"https://api.github.com/users/jlsherrill/events{/privacy}","received_events_url":"https://api.github.com/users/jlsherrill/received_events","type":"User","site_admin":false},"repo":{"id":4041376,"name":"katello","full_name":"jlsherrill/katello","owner":{"login":"jlsherrill","id":395077,"avatar_url":"https://avatars.githubusercontent.com/u/395077?v=3","gravatar_id":"","url":"https://api.github.com/users/jlsherrill","html_url":"https://github.com/jlsherrill","followers_url":"https://api.github.com/users/jlsherrill/followers","following_url":"https://api.github.com/users/jlsherrill/following{/other_user}","gists_url":"https://api.github.com/users/jlsherrill/gists{/gist_id}","starred_url":"https://api.github.com/users/jlsherrill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlsherrill/subscriptions","organizations_url":"https://api.github.com/users/jlsherrill/orgs","repos_url":"https://api.github.com/users/jlsherrill/repos","events_url":"https://api.github.com/users/jlsherrill/events{/privacy}","received_events_url":"https://api.github.com/users/jlsherrill/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jlsherrill/katello","description":"Katello integrates open source systems management tools into a single solution for controlling the lifecycle of your machines.","fork":true,"url":"https://api.github.com/repos/jlsherrill/katello","forks_url":"https://api.github.com/repos/jlsherrill/katello/forks","keys_url":"https://api.github.com/repos/jlsherrill/katello/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jlsherrill/katello/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jlsherrill/katello/teams","hooks_url":"https://api.github.com/repos/jlsherrill/katello/hooks","issue_events_url":"https://api.github.com/repos/jlsherrill/katello/issues/events{/number}","events_url":"https://api.github.com/repos/jlsherrill/katello/events","assignees_url":"https://api.github.com/repos/jlsherrill/katello/assignees{/user}","branches_url":"https://api.github.com/repos/jlsherrill/katello/branches{/branch}","tags_url":"https://api.github.com/repos/jlsherrill/katello/tags","blobs_url":"https://api.github.com/repos/jlsherrill/katello/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jlsherrill/katello/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jlsherrill/katello/git/refs{/sha}","trees_url":"https://api.github.com/repos/jlsherrill/katello/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jlsherrill/katello/statuses/{sha}","languages_url":"https://api.github.com/repos/jlsherrill/katello/languages","stargazers_url":"https://api.github.com/repos/jlsherrill/katello/stargazers","contributors_url":"https://api.github.com/repos/jlsherrill/katello/contributors","subscribers_url":"https://api.github.com/repos/jlsherrill/katello/subscribers","subscription_url":"https://api.github.com/repos/jlsherrill/katello/subscription","commits_url":"https://api.github.com/repos/jlsherrill/katello/commits{/sha}","git_commits_url":"https://api.github.com/repos/jlsherrill/katello/git/commits{/sha}","comments_url":"https://api.github.com/repos/jlsherrill/katello/comments{/number}","issue_comment_url":"https://api.github.com/repos/jlsherrill/katello/issues/comments{/number}","contents_url":"https://api.github.com/repos/jlsherrill/katello/contents/{+path}","compare_url":"https://api.github.com/repos/jlsherrill/katello/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jlsherrill/katello/merges","archive_url":"https://api.github.com/repos/jlsherrill/katello/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jlsherrill/katello/downloads","issues_url":"https://api.github.com/repos/jlsherrill/katello/issues{/number}","pulls_url":"https://api.github.com/repos/jlsherrill/katello/pulls{/number}","milestones_url":"https://api.github.com/repos/jlsherrill/katello/milestones{/number}","notifications_url":"https://api.github.com/repos/jlsherrill/katello/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jlsherrill/katello/labels{/name}","releases_url":"https://api.github.com/repos/jlsherrill/katello/releases{/id}","created_at":"2012-04-16T14:06:55Z","updated_at":"2014-07-31T00:15:04Z","pushed_at":"2016-01-15T14:40:03Z","git_url":"git://github.com/jlsherrill/katello.git","ssh_url":"git@github.com:jlsherrill/katello.git","clone_url":"https://github.com/jlsherrill/katello.git","svn_url":"https://github.com/jlsherrill/katello","homepage":"katello.org","size":74268,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"Katello:master","ref":"master","sha":"02378bb2bbc826fe353a0ce9a560e8b78e973cdc","user":{"login":"Katello","id":1316386,"avatar_url":"https://avatars.githubusercontent.com/u/1316386?v=3","gravatar_id":"","url":"https://api.github.com/users/Katello","html_url":"https://github.com/Katello","followers_url":"https://api.github.com/users/Katello/followers","following_url":"https://api.github.com/users/Katello/following{/other_user}","gists_url":"https://api.github.com/users/Katello/gists{/gist_id}","starred_url":"https://api.github.com/users/Katello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Katello/subscriptions","organizations_url":"https://api.github.com/users/Katello/orgs","repos_url":"https://api.github.com/users/Katello/repos","events_url":"https://api.github.com/users/Katello/events{/privacy}","received_events_url":"https://api.github.com/users/Katello/received_events","type":"Organization","site_admin":false},"repo":{"id":4007018,"name":"katello","full_name":"Katello/katello","owner":{"login":"Katello","id":1316386,"avatar_url":"https://avatars.githubusercontent.com/u/1316386?v=3","gravatar_id":"","url":"https://api.github.com/users/Katello","html_url":"https://github.com/Katello","followers_url":"https://api.github.com/users/Katello/followers","following_url":"https://api.github.com/users/Katello/following{/other_user}","gists_url":"https://api.github.com/users/Katello/gists{/gist_id}","starred_url":"https://api.github.com/users/Katello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Katello/subscriptions","organizations_url":"https://api.github.com/users/Katello/orgs","repos_url":"https://api.github.com/users/Katello/repos","events_url":"https://api.github.com/users/Katello/events{/privacy}","received_events_url":"https://api.github.com/users/Katello/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Katello/katello","description":"Katello integrates open source systems management tools into a single solution for controlling the lifecycle of your machines.","fork":false,"url":"https://api.github.com/repos/Katello/katello","forks_url":"https://api.github.com/repos/Katello/katello/forks","keys_url":"https://api.github.com/repos/Katello/katello/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Katello/katello/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Katello/katello/teams","hooks_url":"https://api.github.com/repos/Katello/katello/hooks","issue_events_url":"https://api.github.com/repos/Katello/katello/issues/events{/number}","events_url":"https://api.github.com/repos/Katello/katello/events","assignees_url":"https://api.github.com/repos/Katello/katello/assignees{/user}","branches_url":"https://api.github.com/repos/Katello/katello/branches{/branch}","tags_url":"https://api.github.com/repos/Katello/katello/tags","blobs_url":"https://api.github.com/repos/Katello/katello/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Katello/katello/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Katello/katello/git/refs{/sha}","trees_url":"https://api.github.com/repos/Katello/katello/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Katello/katello/statuses/{sha}","languages_url":"https://api.github.com/repos/Katello/katello/languages","stargazers_url":"https://api.github.com/repos/Katello/katello/stargazers","contributors_url":"https://api.github.com/repos/Katello/katello/contributors","subscribers_url":"https://api.github.com/repos/Katello/katello/subscribers","subscription_url":"https://api.github.com/repos/Katello/katello/subscription","commits_url":"https://api.github.com/repos/Katello/katello/commits{/sha}","git_commits_url":"https://api.github.com/repos/Katello/katello/git/commits{/sha}","comments_url":"https://api.github.com/repos/Katello/katello/comments{/number}","issue_comment_url":"https://api.github.com/repos/Katello/katello/issues/comments{/number}","contents_url":"https://api.github.com/repos/Katello/katello/contents/{+path}","compare_url":"https://api.github.com/repos/Katello/katello/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Katello/katello/merges","archive_url":"https://api.github.com/repos/Katello/katello/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Katello/katello/downloads","issues_url":"https://api.github.com/repos/Katello/katello/issues{/number}","pulls_url":"https://api.github.com/repos/Katello/katello/pulls{/number}","milestones_url":"https://api.github.com/repos/Katello/katello/milestones{/number}","notifications_url":"https://api.github.com/repos/Katello/katello/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Katello/katello/labels{/name}","releases_url":"https://api.github.com/repos/Katello/katello/releases{/id}","created_at":"2012-04-12T16:59:08Z","updated_at":"2016-01-14T05:15:22Z","pushed_at":"2016-01-15T14:41:36Z","git_url":"git://github.com/Katello/katello.git","ssh_url":"git@github.com:Katello/katello.git","clone_url":"https://github.com/Katello/katello.git","svn_url":"https://github.com/Katello/katello","homepage":"katello.org","size":89208,"stargazers_count":170,"watchers_count":170,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":116,"mirror_url":null,"open_issues_count":97,"forks":116,"open_issues":97,"watchers":170,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Katello/katello/pulls/5695"},"html":{"href":"https://github.com/Katello/katello/pull/5695"},"issue":{"href":"https://api.github.com/repos/Katello/katello/issues/5695"},"comments":{"href":"https://api.github.com/repos/Katello/katello/issues/5695/comments"},"review_comments":{"href":"https://api.github.com/repos/Katello/katello/pulls/5695/comments"},"review_comment":{"href":"https://api.github.com/repos/Katello/katello/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Katello/katello/pulls/5695/commits"},"statuses":{"href":"https://api.github.com/repos/Katello/katello/statuses/5ef73fb0c060ca946295b0d3ef63cc43b74d1427"}}}}