{"action":"created","comment":{"url":"https://api.github.com/repos/voxpupuli/puppet_webhook/pulls/comments/185271084","pull_request_review_id":116625385,"id":185271084,"diff_hunk":"@@ -0,0 +1,59 @@\n+require 'rocket-chat-notifier'\n+\n+class PuppetWebhook\n+  class Chatops\n+    class Rocketchat\n+      def initialize(channel, url, user, message, options = {})\n+        @channel = channel\n+        @url = url\n+        @user = user\n+        @message = message\n+        @options = options\n+      end\n+\n+      def notify\n+        notifier = RocketChat::Notifier.new @url, http_options: @options[:http_options]\n+        notifier.username = @user\n+        notifier.channel = @channel\n+\n+        target = if @message[:branch]\n+                   @message[:branch]\n+                 elsif @message[:module]\n+                   @message[:module]\n+                 end\n+\n+        msg = \"r10k deployment of Puppet environment/module #{target} started...\"\n+\n+        attachment = format_attachment(target)\n+\n+        notifier.ping(msg, icon_emoji: @options[:icon_emoji], attachments: [attachment])\n+      end\n+\n+      private\n+\n+      def format_attachment(target)\n+        attachment = {\n+            author: 'r10k for Puppet',\n+            title: \"r10k deployment of Puppet environment #{target}\",\n+        }\n+\n+        case @message[:status_code]\n+        when 200\n+          attachment.merge!(\n+            color: 'good',\n+            text: \"Successfully started deployment of #{target}\",\n+            fallback: \"Successfully started deployment of #{target}\"\n+            )","path":"lib/plugins/chatops/rocketchat.rb","position":46,"original_position":46,"commit_id":"9b17cc8a44b833fc54b92d0dcc0460bc9d9e7f11","original_commit_id":"9b17cc8a44b833fc54b92d0dcc0460bc9d9e7f11","user":{"login":"codacy-bot","id":19940114,"avatar_url":"https://avatars1.githubusercontent.com/u/19940114?v=4","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://app.codacy.com/assets/images/favicon.png) Issue found: [Indent `)` the same as the start of the line where `(` is.](https://app.codacy.com/app/VoxPupuli/puppet_webhook/pullRequest?prid=1600602)","created_at":"2018-05-01T16:53:41Z","updated_at":"2018-05-01T16:53:41Z","html_url":"https://github.com/voxpupuli/puppet_webhook/pull/53#discussion_r185271084","pull_request_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/pulls/53","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/voxpupuli/puppet_webhook/pulls/comments/185271084"},"html":{"href":"https://github.com/voxpupuli/puppet_webhook/pull/53#discussion_r185271084"},"pull_request":{"href":"https://api.github.com/repos/voxpupuli/puppet_webhook/pulls/53"}}},"pull_request":{"url":"https://api.github.com/repos/voxpupuli/puppet_webhook/pulls/53","id":185218350,"html_url":"https://github.com/voxpupuli/puppet_webhook/pull/53","diff_url":"https://github.com/voxpupuli/puppet_webhook/pull/53.diff","patch_url":"https://github.com/voxpupuli/puppet_webhook/pull/53.patch","issue_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/issues/53","number":53,"state":"open","locked":false,"title":"Rocketchat plugin","user":{"login":"dhollinger","id":2914211,"avatar_url":"https://avatars1.githubusercontent.com/u/2914211?v=4","gravatar_id":"","url":"https://api.github.com/users/dhollinger","html_url":"https://github.com/dhollinger","followers_url":"https://api.github.com/users/dhollinger/followers","following_url":"https://api.github.com/users/dhollinger/following{/other_user}","gists_url":"https://api.github.com/users/dhollinger/gists{/gist_id}","starred_url":"https://api.github.com/users/dhollinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhollinger/subscriptions","organizations_url":"https://api.github.com/users/dhollinger/orgs","repos_url":"https://api.github.com/users/dhollinger/repos","events_url":"https://api.github.com/users/dhollinger/events{/privacy}","received_events_url":"https://api.github.com/users/dhollinger/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-05-01T16:39:15Z","updated_at":"2018-05-01T16:53:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c055f5bb44f94f4d793c98d2f162161a9c68022e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":735675152,"url":"https://api.github.com/repos/voxpupuli/puppet_webhook/labels/enhancement","name":"enhancement","color":"0052cc","default":true},{"id":735753292,"url":"https://api.github.com/repos/voxpupuli/puppet_webhook/labels/needs-docs","name":"needs-docs","color":"006b75","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/pulls/53/commits","review_comments_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/pulls/53/comments","review_comment_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/pulls/comments{/number}","comments_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/issues/53/comments","statuses_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/statuses/9b17cc8a44b833fc54b92d0dcc0460bc9d9e7f11","head":{"label":"dhollinger:rocketchat_plugin","ref":"rocketchat_plugin","sha":"9b17cc8a44b833fc54b92d0dcc0460bc9d9e7f11","user":{"login":"dhollinger","id":2914211,"avatar_url":"https://avatars1.githubusercontent.com/u/2914211?v=4","gravatar_id":"","url":"https://api.github.com/users/dhollinger","html_url":"https://github.com/dhollinger","followers_url":"https://api.github.com/users/dhollinger/followers","following_url":"https://api.github.com/users/dhollinger/following{/other_user}","gists_url":"https://api.github.com/users/dhollinger/gists{/gist_id}","starred_url":"https://api.github.com/users/dhollinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhollinger/subscriptions","organizations_url":"https://api.github.com/users/dhollinger/orgs","repos_url":"https://api.github.com/users/dhollinger/repos","events_url":"https://api.github.com/users/dhollinger/events{/privacy}","received_events_url":"https://api.github.com/users/dhollinger/received_events","type":"User","site_admin":false},"repo":{"id":109018225,"name":"puppet_webhook","full_name":"dhollinger/puppet_webhook","owner":{"login":"dhollinger","id":2914211,"avatar_url":"https://avatars1.githubusercontent.com/u/2914211?v=4","gravatar_id":"","url":"https://api.github.com/users/dhollinger","html_url":"https://github.com/dhollinger","followers_url":"https://api.github.com/users/dhollinger/followers","following_url":"https://api.github.com/users/dhollinger/following{/other_user}","gists_url":"https://api.github.com/users/dhollinger/gists{/gist_id}","starred_url":"https://api.github.com/users/dhollinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhollinger/subscriptions","organizations_url":"https://api.github.com/users/dhollinger/orgs","repos_url":"https://api.github.com/users/dhollinger/repos","events_url":"https://api.github.com/users/dhollinger/events{/privacy}","received_events_url":"https://api.github.com/users/dhollinger/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dhollinger/puppet_webhook","description":"Sinatra-based application that triggers puppet-related commands from VCS Webhook calss","fork":true,"url":"https://api.github.com/repos/dhollinger/puppet_webhook","forks_url":"https://api.github.com/repos/dhollinger/puppet_webhook/forks","keys_url":"https://api.github.com/repos/dhollinger/puppet_webhook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dhollinger/puppet_webhook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dhollinger/puppet_webhook/teams","hooks_url":"https://api.github.com/repos/dhollinger/puppet_webhook/hooks","issue_events_url":"https://api.github.com/repos/dhollinger/puppet_webhook/issues/events{/number}","events_url":"https://api.github.com/repos/dhollinger/puppet_webhook/events","assignees_url":"https://api.github.com/repos/dhollinger/puppet_webhook/assignees{/user}","branches_url":"https://api.github.com/repos/dhollinger/puppet_webhook/branches{/branch}","tags_url":"https://api.github.com/repos/dhollinger/puppet_webhook/tags","blobs_url":"https://api.github.com/repos/dhollinger/puppet_webhook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dhollinger/puppet_webhook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dhollinger/puppet_webhook/git/refs{/sha}","trees_url":"https://api.github.com/repos/dhollinger/puppet_webhook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dhollinger/puppet_webhook/statuses/{sha}","languages_url":"https://api.github.com/repos/dhollinger/puppet_webhook/languages","stargazers_url":"https://api.github.com/repos/dhollinger/puppet_webhook/stargazers","contributors_url":"https://api.github.com/repos/dhollinger/puppet_webhook/contributors","subscribers_url":"https://api.github.com/repos/dhollinger/puppet_webhook/subscribers","subscription_url":"https://api.github.com/repos/dhollinger/puppet_webhook/subscription","commits_url":"https://api.github.com/repos/dhollinger/puppet_webhook/commits{/sha}","git_commits_url":"https://api.github.com/repos/dhollinger/puppet_webhook/git/commits{/sha}","comments_url":"https://api.github.com/repos/dhollinger/puppet_webhook/comments{/number}","issue_comment_url":"https://api.github.com/repos/dhollinger/puppet_webhook/issues/comments{/number}","contents_url":"https://api.github.com/repos/dhollinger/puppet_webhook/contents/{+path}","compare_url":"https://api.github.com/repos/dhollinger/puppet_webhook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dhollinger/puppet_webhook/merges","archive_url":"https://api.github.com/repos/dhollinger/puppet_webhook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dhollinger/puppet_webhook/downloads","issues_url":"https://api.github.com/repos/dhollinger/puppet_webhook/issues{/number}","pulls_url":"https://api.github.com/repos/dhollinger/puppet_webhook/pulls{/number}","milestones_url":"https://api.github.com/repos/dhollinger/puppet_webhook/milestones{/number}","notifications_url":"https://api.github.com/repos/dhollinger/puppet_webhook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dhollinger/puppet_webhook/labels{/name}","releases_url":"https://api.github.com/repos/dhollinger/puppet_webhook/releases{/id}","deployments_url":"https://api.github.com/repos/dhollinger/puppet_webhook/deployments","created_at":"2017-10-31T15:50:23Z","updated_at":"2018-04-27T02:39:48Z","pushed_at":"2018-05-01T16:51:19Z","git_url":"git://github.com/dhollinger/puppet_webhook.git","ssh_url":"git@github.com:dhollinger/puppet_webhook.git","clone_url":"https://github.com/dhollinger/puppet_webhook.git","svn_url":"https://github.com/dhollinger/puppet_webhook","homepage":null,"size":198,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"voxpupuli:master","ref":"master","sha":"c5ebd2ea67e045a35eb384c8b1cca07c77897567","user":{"login":"voxpupuli","id":8693967,"avatar_url":"https://avatars3.githubusercontent.com/u/8693967?v=4","gravatar_id":"","url":"https://api.github.com/users/voxpupuli","html_url":"https://github.com/voxpupuli","followers_url":"https://api.github.com/users/voxpupuli/followers","following_url":"https://api.github.com/users/voxpupuli/following{/other_user}","gists_url":"https://api.github.com/users/voxpupuli/gists{/gist_id}","starred_url":"https://api.github.com/users/voxpupuli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/voxpupuli/subscriptions","organizations_url":"https://api.github.com/users/voxpupuli/orgs","repos_url":"https://api.github.com/users/voxpupuli/repos","events_url":"https://api.github.com/users/voxpupuli/events{/privacy}","received_events_url":"https://api.github.com/users/voxpupuli/received_events","type":"Organization","site_admin":false},"repo":{"id":108903620,"name":"puppet_webhook","full_name":"voxpupuli/puppet_webhook","owner":{"login":"voxpupuli","id":8693967,"avatar_url":"https://avatars3.githubusercontent.com/u/8693967?v=4","gravatar_id":"","url":"https://api.github.com/users/voxpupuli","html_url":"https://github.com/voxpupuli","followers_url":"https://api.github.com/users/voxpupuli/followers","following_url":"https://api.github.com/users/voxpupuli/following{/other_user}","gists_url":"https://api.github.com/users/voxpupuli/gists{/gist_id}","starred_url":"https://api.github.com/users/voxpupuli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/voxpupuli/subscriptions","organizations_url":"https://api.github.com/users/voxpupuli/orgs","repos_url":"https://api.github.com/users/voxpupuli/repos","events_url":"https://api.github.com/users/voxpupuli/events{/privacy}","received_events_url":"https://api.github.com/users/voxpupuli/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/voxpupuli/puppet_webhook","description":"Sinatra-based application that triggers puppet-related commands from VCS Webhook calls","fork":false,"url":"https://api.github.com/repos/voxpupuli/puppet_webhook","forks_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/forks","keys_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/teams","hooks_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/hooks","issue_events_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/issues/events{/number}","events_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/events","assignees_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/assignees{/user}","branches_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/branches{/branch}","tags_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/tags","blobs_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/git/refs{/sha}","trees_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/statuses/{sha}","languages_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/languages","stargazers_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/stargazers","contributors_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/contributors","subscribers_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/subscribers","subscription_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/subscription","commits_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/commits{/sha}","git_commits_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/git/commits{/sha}","comments_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/comments{/number}","issue_comment_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/issues/comments{/number}","contents_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/contents/{+path}","compare_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/merges","archive_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/downloads","issues_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/issues{/number}","pulls_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/pulls{/number}","milestones_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/milestones{/number}","notifications_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/labels{/name}","releases_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/releases{/id}","deployments_url":"https://api.github.com/repos/voxpupuli/puppet_webhook/deployments","created_at":"2017-10-30T20:16:39Z","updated_at":"2018-05-01T16:08:48Z","pushed_at":"2018-05-01T16:51:21Z","git_url":"git://github.com/voxpupuli/puppet_webhook.git","ssh_url":"git@github.com:voxpupuli/puppet_webhook.git","clone_url":"https://github.com/voxpupuli/puppet_webhook.git","svn_url":"https://github.com/voxpupuli/puppet_webhook","homepage":"","size":174,"stargazers_count":8,"watchers_count":8,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":7,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":5,"open_issues":7,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/voxpupuli/puppet_webhook/pulls/53"},"html":{"href":"https://github.com/voxpupuli/puppet_webhook/pull/53"},"issue":{"href":"https://api.github.com/repos/voxpupuli/puppet_webhook/issues/53"},"comments":{"href":"https://api.github.com/repos/voxpupuli/puppet_webhook/issues/53/comments"},"review_comments":{"href":"https://api.github.com/repos/voxpupuli/puppet_webhook/pulls/53/comments"},"review_comment":{"href":"https://api.github.com/repos/voxpupuli/puppet_webhook/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/voxpupuli/puppet_webhook/pulls/53/commits"},"statuses":{"href":"https://api.github.com/repos/voxpupuli/puppet_webhook/statuses/9b17cc8a44b833fc54b92d0dcc0460bc9d9e7f11"}},"author_association":"OWNER"}}
{"actor":{"display_login":"codacy-bot"}}