{"action":"created","comment":{"url":"https://api.github.com/repos/bitzesty/qae/pulls/comments/25593176","id":25593176,"diff_hunk":"@@ -0,0 +1,59 @@\n+class Users::AuditCertificatesController < Users::BaseController\n+  before_action :check_certificate_if_exists, only: [:create]\n+\n+  expose(:form_answer) {\n+    current_user.account\n+                .form_answers\n+                .find(params[:form_answer_id])\n+  }\n+\n+  expose(:csv_data) {\n+    AuditCertificateCsvGenerator.new(form_answer)\n+                                .run\n+  }\n+\n+  expose(:audit_certificate) {\n+    form_answer.audit_certificate\n+  }\n+\n+  def show\n+    respond_to do |format|\n+      format.html\n+      format.csv do\n+        send_data(\n+          csv_data,\n+          filename: \"audit_certificate_#{form_answer.decorate.csv_filename}\",\n+          type: \"application/csv\"\n+        )\n+      end\n+    end\n+  end\n+\n+  def create\n+    self.audit_certificate = form_answer.build_audit_certificate(audit_certificate_params)\n+\n+    if audit_certificate.save\n+      redirect_to users_form_answer_audit_certificate_path(form_answer),\n+                  notice: \"Audit Certificate successfully uploaded!\"\n+    else\n+      render :show\n+    end\n+  end\n+\n+  private\n+    def audit_certificate_params\n+      # This is fix of \"missing 'audit_certificate' param\"\n+      # if no any file selected in file input\n+      params.merge!({audit_certificate: {attachment: ''}}) if params[:audit_certificate].blank?\n+\n+      params.require(:audit_certificate).permit(\n+        :attachment\n+      )\n+    end\n+\n+    def check_certificate_if_exists","path":"app/controllers/users/audit_certificates_controller.rb","position":54,"original_position":54,"commit_id":"2070125c5754d1212ce5eb9d0aefcaa21f9e40be","original_commit_id":"2070125c5754d1212ce5eb9d0aefcaa21f9e40be","user":{"login":"matthewford","id":215,"avatar_url":"https://avatars.githubusercontent.com/u/215?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewford","html_url":"https://github.com/matthewford","followers_url":"https://api.github.com/users/matthewford/followers","following_url":"https://api.github.com/users/matthewford/following{/other_user}","gists_url":"https://api.github.com/users/matthewford/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewford/subscriptions","organizations_url":"https://api.github.com/users/matthewford/orgs","repos_url":"https://api.github.com/users/matthewford/repos","events_url":"https://api.github.com/users/matthewford/events{/privacy}","received_events_url":"https://api.github.com/users/matthewford/received_events","type":"User","site_admin":false},"body":"Inconsistent indentation detected.","created_at":"2015-03-02T11:56:56Z","updated_at":"2015-03-02T11:56:56Z","html_url":"https://github.com/bitzesty/qae/pull/140#discussion_r25593176","pull_request_url":"https://api.github.com/repos/bitzesty/qae/pulls/140","_links":{"self":{"href":"https://api.github.com/repos/bitzesty/qae/pulls/comments/25593176"},"html":{"href":"https://github.com/bitzesty/qae/pull/140#discussion_r25593176"},"pull_request":{"href":"https://api.github.com/repos/bitzesty/qae/pulls/140"}}},"pull_request":{"url":"https://api.github.com/repos/bitzesty/qae/pulls/140","id":30277614,"html_url":"https://github.com/bitzesty/qae/pull/140","diff_url":"https://github.com/bitzesty/qae/pull/140.diff","patch_url":"https://github.com/bitzesty/qae/pull/140.patch","issue_url":"https://api.github.com/repos/bitzesty/qae/issues/140","number":140,"state":"open","locked":false,"title":"[QAE1057] Audit Certificates implementation","user":{"login":"RuslanHamidullin","id":358508,"avatar_url":"https://avatars.githubusercontent.com/u/358508?v=3","gravatar_id":"","url":"https://api.github.com/users/RuslanHamidullin","html_url":"https://github.com/RuslanHamidullin","followers_url":"https://api.github.com/users/RuslanHamidullin/followers","following_url":"https://api.github.com/users/RuslanHamidullin/following{/other_user}","gists_url":"https://api.github.com/users/RuslanHamidullin/gists{/gist_id}","starred_url":"https://api.github.com/users/RuslanHamidullin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RuslanHamidullin/subscriptions","organizations_url":"https://api.github.com/users/RuslanHamidullin/orgs","repos_url":"https://api.github.com/users/RuslanHamidullin/repos","events_url":"https://api.github.com/users/RuslanHamidullin/events{/privacy}","received_events_url":"https://api.github.com/users/RuslanHamidullin/received_events","type":"User","site_admin":false},"body":"* Implemented receiving of email with link to section with ability\r\n      to download generated AuditCertificate file with preselected\r\n      Financial Data and then upload checked and completed version to the app\r\n* Covered with Rspec","created_at":"2015-03-02T11:56:48Z","updated_at":"2015-03-02T11:56:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0b70be4d9d45fd347d565397b587c455a7ff664f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bitzesty/qae/pulls/140/commits","review_comments_url":"https://api.github.com/repos/bitzesty/qae/pulls/140/comments","review_comment_url":"https://api.github.com/repos/bitzesty/qae/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bitzesty/qae/issues/140/comments","statuses_url":"https://api.github.com/repos/bitzesty/qae/statuses/2070125c5754d1212ce5eb9d0aefcaa21f9e40be","head":{"label":"bitzesty:QAE1057-audit-certificate-implementation","ref":"QAE1057-audit-certificate-implementation","sha":"2070125c5754d1212ce5eb9d0aefcaa21f9e40be","user":{"login":"bitzesty","id":70534,"avatar_url":"https://avatars.githubusercontent.com/u/70534?v=3","gravatar_id":"","url":"https://api.github.com/users/bitzesty","html_url":"https://github.com/bitzesty","followers_url":"https://api.github.com/users/bitzesty/followers","following_url":"https://api.github.com/users/bitzesty/following{/other_user}","gists_url":"https://api.github.com/users/bitzesty/gists{/gist_id}","starred_url":"https://api.github.com/users/bitzesty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitzesty/subscriptions","organizations_url":"https://api.github.com/users/bitzesty/orgs","repos_url":"https://api.github.com/users/bitzesty/repos","events_url":"https://api.github.com/users/bitzesty/events{/privacy}","received_events_url":"https://api.github.com/users/bitzesty/received_events","type":"Organization","site_admin":false},"repo":{"id":26758825,"name":"qae","full_name":"bitzesty/qae","owner":{"login":"bitzesty","id":70534,"avatar_url":"https://avatars.githubusercontent.com/u/70534?v=3","gravatar_id":"","url":"https://api.github.com/users/bitzesty","html_url":"https://github.com/bitzesty","followers_url":"https://api.github.com/users/bitzesty/followers","following_url":"https://api.github.com/users/bitzesty/following{/other_user}","gists_url":"https://api.github.com/users/bitzesty/gists{/gist_id}","starred_url":"https://api.github.com/users/bitzesty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitzesty/subscriptions","organizations_url":"https://api.github.com/users/bitzesty/orgs","repos_url":"https://api.github.com/users/bitzesty/repos","events_url":"https://api.github.com/users/bitzesty/events{/privacy}","received_events_url":"https://api.github.com/users/bitzesty/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bitzesty/qae","description":"[Alpha] Queens Award for Enterprise","fork":false,"url":"https://api.github.com/repos/bitzesty/qae","forks_url":"https://api.github.com/repos/bitzesty/qae/forks","keys_url":"https://api.github.com/repos/bitzesty/qae/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bitzesty/qae/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bitzesty/qae/teams","hooks_url":"https://api.github.com/repos/bitzesty/qae/hooks","issue_events_url":"https://api.github.com/repos/bitzesty/qae/issues/events{/number}","events_url":"https://api.github.com/repos/bitzesty/qae/events","assignees_url":"https://api.github.com/repos/bitzesty/qae/assignees{/user}","branches_url":"https://api.github.com/repos/bitzesty/qae/branches{/branch}","tags_url":"https://api.github.com/repos/bitzesty/qae/tags","blobs_url":"https://api.github.com/repos/bitzesty/qae/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bitzesty/qae/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bitzesty/qae/git/refs{/sha}","trees_url":"https://api.github.com/repos/bitzesty/qae/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bitzesty/qae/statuses/{sha}","languages_url":"https://api.github.com/repos/bitzesty/qae/languages","stargazers_url":"https://api.github.com/repos/bitzesty/qae/stargazers","contributors_url":"https://api.github.com/repos/bitzesty/qae/contributors","subscribers_url":"https://api.github.com/repos/bitzesty/qae/subscribers","subscription_url":"https://api.github.com/repos/bitzesty/qae/subscription","commits_url":"https://api.github.com/repos/bitzesty/qae/commits{/sha}","git_commits_url":"https://api.github.com/repos/bitzesty/qae/git/commits{/sha}","comments_url":"https://api.github.com/repos/bitzesty/qae/comments{/number}","issue_comment_url":"https://api.github.com/repos/bitzesty/qae/issues/comments{/number}","contents_url":"https://api.github.com/repos/bitzesty/qae/contents/{+path}","compare_url":"https://api.github.com/repos/bitzesty/qae/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bitzesty/qae/merges","archive_url":"https://api.github.com/repos/bitzesty/qae/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bitzesty/qae/downloads","issues_url":"https://api.github.com/repos/bitzesty/qae/issues{/number}","pulls_url":"https://api.github.com/repos/bitzesty/qae/pulls{/number}","milestones_url":"https://api.github.com/repos/bitzesty/qae/milestones{/number}","notifications_url":"https://api.github.com/repos/bitzesty/qae/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bitzesty/qae/labels{/name}","releases_url":"https://api.github.com/repos/bitzesty/qae/releases{/id}","created_at":"2014-11-17T13:56:00Z","updated_at":"2015-03-02T11:11:23Z","pushed_at":"2015-03-02T11:56:07Z","git_url":"git://github.com/bitzesty/qae.git","ssh_url":"git@github.com:bitzesty/qae.git","clone_url":"https://github.com/bitzesty/qae.git","svn_url":"https://github.com/bitzesty/qae","homepage":"","size":7393,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":1,"default_branch":"master"}},"base":{"label":"bitzesty:master","ref":"master","sha":"15a0e0316c261872d2410c0d592335706d1a3a9b","user":{"login":"bitzesty","id":70534,"avatar_url":"https://avatars.githubusercontent.com/u/70534?v=3","gravatar_id":"","url":"https://api.github.com/users/bitzesty","html_url":"https://github.com/bitzesty","followers_url":"https://api.github.com/users/bitzesty/followers","following_url":"https://api.github.com/users/bitzesty/following{/other_user}","gists_url":"https://api.github.com/users/bitzesty/gists{/gist_id}","starred_url":"https://api.github.com/users/bitzesty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitzesty/subscriptions","organizations_url":"https://api.github.com/users/bitzesty/orgs","repos_url":"https://api.github.com/users/bitzesty/repos","events_url":"https://api.github.com/users/bitzesty/events{/privacy}","received_events_url":"https://api.github.com/users/bitzesty/received_events","type":"Organization","site_admin":false},"repo":{"id":26758825,"name":"qae","full_name":"bitzesty/qae","owner":{"login":"bitzesty","id":70534,"avatar_url":"https://avatars.githubusercontent.com/u/70534?v=3","gravatar_id":"","url":"https://api.github.com/users/bitzesty","html_url":"https://github.com/bitzesty","followers_url":"https://api.github.com/users/bitzesty/followers","following_url":"https://api.github.com/users/bitzesty/following{/other_user}","gists_url":"https://api.github.com/users/bitzesty/gists{/gist_id}","starred_url":"https://api.github.com/users/bitzesty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitzesty/subscriptions","organizations_url":"https://api.github.com/users/bitzesty/orgs","repos_url":"https://api.github.com/users/bitzesty/repos","events_url":"https://api.github.com/users/bitzesty/events{/privacy}","received_events_url":"https://api.github.com/users/bitzesty/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bitzesty/qae","description":"[Alpha] Queens Award for Enterprise","fork":false,"url":"https://api.github.com/repos/bitzesty/qae","forks_url":"https://api.github.com/repos/bitzesty/qae/forks","keys_url":"https://api.github.com/repos/bitzesty/qae/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bitzesty/qae/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bitzesty/qae/teams","hooks_url":"https://api.github.com/repos/bitzesty/qae/hooks","issue_events_url":"https://api.github.com/repos/bitzesty/qae/issues/events{/number}","events_url":"https://api.github.com/repos/bitzesty/qae/events","assignees_url":"https://api.github.com/repos/bitzesty/qae/assignees{/user}","branches_url":"https://api.github.com/repos/bitzesty/qae/branches{/branch}","tags_url":"https://api.github.com/repos/bitzesty/qae/tags","blobs_url":"https://api.github.com/repos/bitzesty/qae/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bitzesty/qae/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bitzesty/qae/git/refs{/sha}","trees_url":"https://api.github.com/repos/bitzesty/qae/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bitzesty/qae/statuses/{sha}","languages_url":"https://api.github.com/repos/bitzesty/qae/languages","stargazers_url":"https://api.github.com/repos/bitzesty/qae/stargazers","contributors_url":"https://api.github.com/repos/bitzesty/qae/contributors","subscribers_url":"https://api.github.com/repos/bitzesty/qae/subscribers","subscription_url":"https://api.github.com/repos/bitzesty/qae/subscription","commits_url":"https://api.github.com/repos/bitzesty/qae/commits{/sha}","git_commits_url":"https://api.github.com/repos/bitzesty/qae/git/commits{/sha}","comments_url":"https://api.github.com/repos/bitzesty/qae/comments{/number}","issue_comment_url":"https://api.github.com/repos/bitzesty/qae/issues/comments{/number}","contents_url":"https://api.github.com/repos/bitzesty/qae/contents/{+path}","compare_url":"https://api.github.com/repos/bitzesty/qae/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bitzesty/qae/merges","archive_url":"https://api.github.com/repos/bitzesty/qae/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bitzesty/qae/downloads","issues_url":"https://api.github.com/repos/bitzesty/qae/issues{/number}","pulls_url":"https://api.github.com/repos/bitzesty/qae/pulls{/number}","milestones_url":"https://api.github.com/repos/bitzesty/qae/milestones{/number}","notifications_url":"https://api.github.com/repos/bitzesty/qae/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bitzesty/qae/labels{/name}","releases_url":"https://api.github.com/repos/bitzesty/qae/releases{/id}","created_at":"2014-11-17T13:56:00Z","updated_at":"2015-03-02T11:11:23Z","pushed_at":"2015-03-02T11:56:07Z","git_url":"git://github.com/bitzesty/qae.git","ssh_url":"git@github.com:bitzesty/qae.git","clone_url":"https://github.com/bitzesty/qae.git","svn_url":"https://github.com/bitzesty/qae","homepage":"","size":7393,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bitzesty/qae/pulls/140"},"html":{"href":"https://github.com/bitzesty/qae/pull/140"},"issue":{"href":"https://api.github.com/repos/bitzesty/qae/issues/140"},"comments":{"href":"https://api.github.com/repos/bitzesty/qae/issues/140/comments"},"review_comments":{"href":"https://api.github.com/repos/bitzesty/qae/pulls/140/comments"},"review_comment":{"href":"https://api.github.com/repos/bitzesty/qae/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bitzesty/qae/pulls/140/commits"},"statuses":{"href":"https://api.github.com/repos/bitzesty/qae/statuses/2070125c5754d1212ce5eb9d0aefcaa21f9e40be"}}}}