{"action":"created","comment":{"url":"https://api.github.com/repos/chompasina/salary/pulls/comments/80080852","id":80080852,"diff_hunk":"@@ -1,34 +1,82 @@\n require 'slack'\n \n class SlackClientService\n-  attr_reader :client\n+  attr_reader :client,\n+              :input,\n+              :user\n \n-  def initialize\n+  def initialize(input, user)\n+    @input = input\n     @client = Slack::Client.new(token: ENV['app_access_token'])\n-    # @conn = Faraday.post(\"https://hooks.slack.com/services/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\") do |faraday|\n-    # # @_conn = Faraday.new(\"https://api.github.com/rtm.start\") do |faraday|\n-    #   faraday.adapter           Faraday.default_adapter\n-    #   faraday.params['token'] = ENV['SLACK_API_TOKEN']\n-    #   faraday.headers['Content-type'] = 'application/json'\n-    # end\n+    @user = user\n   end\n \n   def post_job_info(title, salary)\n     client.chat_postMessage(channel: \"#practice-jobs\", text: \"A Turing alum just posted a new job as a #{title} making #{salary}.\", icon_emoji: \":monkey_face:\")\n   end\n   \n-  def confirm_name(name, channel)\n+  def add_job\n+    Rails.logger.debug\n+  end\n+    \n+  def confirm_name\n+    user_input = input[\"text\"]\n+    channel = input[\"channel\"]\n+    user_handler = UserInfoHandler.new(user_input)\n     client2 = Slack::Client.new(token: ENV['bot_access_token'])\n-    response = client2.chat_postMessage(\n+    unless user\n+      response = client2.chat_postMessage(\n+                        channel: channel, \n+                        text: \"We weren't able to find your name in our list. Please try again or email Turing staff to look into this issue.\"\n+                        )\n+                        Rails.logger.debug(YAML.dump(response))                  \n+      return\n+    end\n+    if user && user.input_counter == 0\n+        response = client2.chat_postMessage(\n                        channel: channel, \n-                       text: \"Hi #{name}! So, you want to add a job? What's your job title?\"\n+                       text: \"Hi #{user.first_name}! So, you want to add a job? What's your job title?\"\n                        )\n-    # Rails.logger.debug(YAML.dump(response))                  \n+        user.increment!(:input_counter, by = 1)\n+       Rails.logger.debug(YAML.dump(response))                  \n+    elsif user.input_counter == 1\n+        #  job_handler.add_job_title\n+       response = client2.chat_postMessage(\n+       channel: channel, \n+       text: \"Great! What company do you work for?\"\n+       )\n+       user.increment!(:input_counter, by = 1)\n+     elsif user.input_counter == 2\n+       response = client2.chat_postMessage(\n+       channel: channel, \n+       text: \"And where is this fine company located?\"\n+       )\n+       user.increment!(:input_counter, by = 1)\n+     elsif user.input_counter == 3\n+       response = client2.chat_postMessage(\n+       channel: channel, \n+       text: \"What is your yearly salary in this job? (Again, this is all strictly confidential.)\"\n+       )\n+       user.increment!(:input_counter, by = 1)\n+     elsif user.input_counter == 4\n+       response = client2.chat_postMessage(\n+       channel: channel, \n+       text: \"Almost done. When did you start this job? If you're no longer at this job, you can provide your end date in the next question. Please enter dates like mm/dd/yyyy.\"\n+       )\n+       user.increment!(:input_counter, by = 1)\n+     elsif user.input_counter == 5\n+       response = client2.chat_postMessage(\n+       channel: channel, \n+       text: \"Last question: if this is a previous job, when did you leave this job? mm/dd/yyyy\" \n+       )\n+       user.increment!(:input_counter, by = 1)\n+     elsif user.input_counter == 6\n+       response = client2.chat_postMessage(\n+       channel: channel, \n+       text: \"Great, thanks for anonymously sharing your job data with us! Your data can now be used in the statistics to help current student, prospective students, and staff members make better decisions.\"","path":"app/services/slack_client_service.rb","position":88,"original_position":88,"commit_id":"413853102735a47db01c16b98f6f4e4d8bd6d25a","original_commit_id":"413853102735a47db01c16b98f6f4e4d8bd6d25a","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","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 when you don't need string interpolation or special symbols.<br>Line is too long. [207/80]","created_at":"2016-09-22T16:27:09Z","updated_at":"2016-09-22T16:27:09Z","html_url":"https://github.com/chompasina/salary/pull/27#discussion_r80080852","pull_request_url":"https://api.github.com/repos/chompasina/salary/pulls/27","_links":{"self":{"href":"https://api.github.com/repos/chompasina/salary/pulls/comments/80080852"},"html":{"href":"https://github.com/chompasina/salary/pull/27#discussion_r80080852"},"pull_request":{"href":"https://api.github.com/repos/chompasina/salary/pulls/27"}}},"pull_request":{"url":"https://api.github.com/repos/chompasina/salary/pulls/27","id":86370988,"html_url":"https://github.com/chompasina/salary/pull/27","diff_url":"https://github.com/chompasina/salary/pull/27.diff","patch_url":"https://github.com/chompasina/salary/pull/27.patch","issue_url":"https://api.github.com/repos/chompasina/salary/issues/27","number":27,"state":"open","locked":false,"title":"Adding job functionality","user":{"login":"chompasina","id":15034459,"avatar_url":"https://avatars.githubusercontent.com/u/15034459?v=3","gravatar_id":"","url":"https://api.github.com/users/chompasina","html_url":"https://github.com/chompasina","followers_url":"https://api.github.com/users/chompasina/followers","following_url":"https://api.github.com/users/chompasina/following{/other_user}","gists_url":"https://api.github.com/users/chompasina/gists{/gist_id}","starred_url":"https://api.github.com/users/chompasina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chompasina/subscriptions","organizations_url":"https://api.github.com/users/chompasina/orgs","repos_url":"https://api.github.com/users/chompasina/repos","events_url":"https://api.github.com/users/chompasina/events{/privacy}","received_events_url":"https://api.github.com/users/chompasina/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-09-22T16:27:01Z","updated_at":"2016-09-22T16:27:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/chompasina/salary/pulls/27/commits","review_comments_url":"https://api.github.com/repos/chompasina/salary/pulls/27/comments","review_comment_url":"https://api.github.com/repos/chompasina/salary/pulls/comments{/number}","comments_url":"https://api.github.com/repos/chompasina/salary/issues/27/comments","statuses_url":"https://api.github.com/repos/chompasina/salary/statuses/413853102735a47db01c16b98f6f4e4d8bd6d25a","head":{"label":"chompasina:adding_job_functionality","ref":"adding_job_functionality","sha":"413853102735a47db01c16b98f6f4e4d8bd6d25a","user":{"login":"chompasina","id":15034459,"avatar_url":"https://avatars.githubusercontent.com/u/15034459?v=3","gravatar_id":"","url":"https://api.github.com/users/chompasina","html_url":"https://github.com/chompasina","followers_url":"https://api.github.com/users/chompasina/followers","following_url":"https://api.github.com/users/chompasina/following{/other_user}","gists_url":"https://api.github.com/users/chompasina/gists{/gist_id}","starred_url":"https://api.github.com/users/chompasina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chompasina/subscriptions","organizations_url":"https://api.github.com/users/chompasina/orgs","repos_url":"https://api.github.com/users/chompasina/repos","events_url":"https://api.github.com/users/chompasina/events{/privacy}","received_events_url":"https://api.github.com/users/chompasina/received_events","type":"User","site_admin":false},"repo":{"id":64045633,"name":"salary","full_name":"chompasina/salary","owner":{"login":"chompasina","id":15034459,"avatar_url":"https://avatars.githubusercontent.com/u/15034459?v=3","gravatar_id":"","url":"https://api.github.com/users/chompasina","html_url":"https://github.com/chompasina","followers_url":"https://api.github.com/users/chompasina/followers","following_url":"https://api.github.com/users/chompasina/following{/other_user}","gists_url":"https://api.github.com/users/chompasina/gists{/gist_id}","starred_url":"https://api.github.com/users/chompasina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chompasina/subscriptions","organizations_url":"https://api.github.com/users/chompasina/orgs","repos_url":"https://api.github.com/users/chompasina/repos","events_url":"https://api.github.com/users/chompasina/events{/privacy}","received_events_url":"https://api.github.com/users/chompasina/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chompasina/salary","description":null,"fork":false,"url":"https://api.github.com/repos/chompasina/salary","forks_url":"https://api.github.com/repos/chompasina/salary/forks","keys_url":"https://api.github.com/repos/chompasina/salary/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chompasina/salary/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chompasina/salary/teams","hooks_url":"https://api.github.com/repos/chompasina/salary/hooks","issue_events_url":"https://api.github.com/repos/chompasina/salary/issues/events{/number}","events_url":"https://api.github.com/repos/chompasina/salary/events","assignees_url":"https://api.github.com/repos/chompasina/salary/assignees{/user}","branches_url":"https://api.github.com/repos/chompasina/salary/branches{/branch}","tags_url":"https://api.github.com/repos/chompasina/salary/tags","blobs_url":"https://api.github.com/repos/chompasina/salary/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chompasina/salary/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chompasina/salary/git/refs{/sha}","trees_url":"https://api.github.com/repos/chompasina/salary/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chompasina/salary/statuses/{sha}","languages_url":"https://api.github.com/repos/chompasina/salary/languages","stargazers_url":"https://api.github.com/repos/chompasina/salary/stargazers","contributors_url":"https://api.github.com/repos/chompasina/salary/contributors","subscribers_url":"https://api.github.com/repos/chompasina/salary/subscribers","subscription_url":"https://api.github.com/repos/chompasina/salary/subscription","commits_url":"https://api.github.com/repos/chompasina/salary/commits{/sha}","git_commits_url":"https://api.github.com/repos/chompasina/salary/git/commits{/sha}","comments_url":"https://api.github.com/repos/chompasina/salary/comments{/number}","issue_comment_url":"https://api.github.com/repos/chompasina/salary/issues/comments{/number}","contents_url":"https://api.github.com/repos/chompasina/salary/contents/{+path}","compare_url":"https://api.github.com/repos/chompasina/salary/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chompasina/salary/merges","archive_url":"https://api.github.com/repos/chompasina/salary/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chompasina/salary/downloads","issues_url":"https://api.github.com/repos/chompasina/salary/issues{/number}","pulls_url":"https://api.github.com/repos/chompasina/salary/pulls{/number}","milestones_url":"https://api.github.com/repos/chompasina/salary/milestones{/number}","notifications_url":"https://api.github.com/repos/chompasina/salary/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chompasina/salary/labels{/name}","releases_url":"https://api.github.com/repos/chompasina/salary/releases{/id}","deployments_url":"https://api.github.com/repos/chompasina/salary/deployments","created_at":"2016-07-24T02:47:50Z","updated_at":"2016-09-01T06:00:45Z","pushed_at":"2016-09-22T16:27:01Z","git_url":"git://github.com/chompasina/salary.git","ssh_url":"git@github.com:chompasina/salary.git","clone_url":"https://github.com/chompasina/salary.git","svn_url":"https://github.com/chompasina/salary","homepage":null,"size":133,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":9,"forks":0,"open_issues":9,"watchers":2,"default_branch":"master"}},"base":{"label":"chompasina:master","ref":"master","sha":"d85f94299fbca5794699591f2f3844828624543a","user":{"login":"chompasina","id":15034459,"avatar_url":"https://avatars.githubusercontent.com/u/15034459?v=3","gravatar_id":"","url":"https://api.github.com/users/chompasina","html_url":"https://github.com/chompasina","followers_url":"https://api.github.com/users/chompasina/followers","following_url":"https://api.github.com/users/chompasina/following{/other_user}","gists_url":"https://api.github.com/users/chompasina/gists{/gist_id}","starred_url":"https://api.github.com/users/chompasina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chompasina/subscriptions","organizations_url":"https://api.github.com/users/chompasina/orgs","repos_url":"https://api.github.com/users/chompasina/repos","events_url":"https://api.github.com/users/chompasina/events{/privacy}","received_events_url":"https://api.github.com/users/chompasina/received_events","type":"User","site_admin":false},"repo":{"id":64045633,"name":"salary","full_name":"chompasina/salary","owner":{"login":"chompasina","id":15034459,"avatar_url":"https://avatars.githubusercontent.com/u/15034459?v=3","gravatar_id":"","url":"https://api.github.com/users/chompasina","html_url":"https://github.com/chompasina","followers_url":"https://api.github.com/users/chompasina/followers","following_url":"https://api.github.com/users/chompasina/following{/other_user}","gists_url":"https://api.github.com/users/chompasina/gists{/gist_id}","starred_url":"https://api.github.com/users/chompasina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chompasina/subscriptions","organizations_url":"https://api.github.com/users/chompasina/orgs","repos_url":"https://api.github.com/users/chompasina/repos","events_url":"https://api.github.com/users/chompasina/events{/privacy}","received_events_url":"https://api.github.com/users/chompasina/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chompasina/salary","description":null,"fork":false,"url":"https://api.github.com/repos/chompasina/salary","forks_url":"https://api.github.com/repos/chompasina/salary/forks","keys_url":"https://api.github.com/repos/chompasina/salary/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chompasina/salary/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chompasina/salary/teams","hooks_url":"https://api.github.com/repos/chompasina/salary/hooks","issue_events_url":"https://api.github.com/repos/chompasina/salary/issues/events{/number}","events_url":"https://api.github.com/repos/chompasina/salary/events","assignees_url":"https://api.github.com/repos/chompasina/salary/assignees{/user}","branches_url":"https://api.github.com/repos/chompasina/salary/branches{/branch}","tags_url":"https://api.github.com/repos/chompasina/salary/tags","blobs_url":"https://api.github.com/repos/chompasina/salary/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chompasina/salary/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chompasina/salary/git/refs{/sha}","trees_url":"https://api.github.com/repos/chompasina/salary/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chompasina/salary/statuses/{sha}","languages_url":"https://api.github.com/repos/chompasina/salary/languages","stargazers_url":"https://api.github.com/repos/chompasina/salary/stargazers","contributors_url":"https://api.github.com/repos/chompasina/salary/contributors","subscribers_url":"https://api.github.com/repos/chompasina/salary/subscribers","subscription_url":"https://api.github.com/repos/chompasina/salary/subscription","commits_url":"https://api.github.com/repos/chompasina/salary/commits{/sha}","git_commits_url":"https://api.github.com/repos/chompasina/salary/git/commits{/sha}","comments_url":"https://api.github.com/repos/chompasina/salary/comments{/number}","issue_comment_url":"https://api.github.com/repos/chompasina/salary/issues/comments{/number}","contents_url":"https://api.github.com/repos/chompasina/salary/contents/{+path}","compare_url":"https://api.github.com/repos/chompasina/salary/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chompasina/salary/merges","archive_url":"https://api.github.com/repos/chompasina/salary/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chompasina/salary/downloads","issues_url":"https://api.github.com/repos/chompasina/salary/issues{/number}","pulls_url":"https://api.github.com/repos/chompasina/salary/pulls{/number}","milestones_url":"https://api.github.com/repos/chompasina/salary/milestones{/number}","notifications_url":"https://api.github.com/repos/chompasina/salary/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chompasina/salary/labels{/name}","releases_url":"https://api.github.com/repos/chompasina/salary/releases{/id}","deployments_url":"https://api.github.com/repos/chompasina/salary/deployments","created_at":"2016-07-24T02:47:50Z","updated_at":"2016-09-01T06:00:45Z","pushed_at":"2016-09-22T16:27:01Z","git_url":"git://github.com/chompasina/salary.git","ssh_url":"git@github.com:chompasina/salary.git","clone_url":"https://github.com/chompasina/salary.git","svn_url":"https://github.com/chompasina/salary","homepage":null,"size":133,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":9,"forks":0,"open_issues":9,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chompasina/salary/pulls/27"},"html":{"href":"https://github.com/chompasina/salary/pull/27"},"issue":{"href":"https://api.github.com/repos/chompasina/salary/issues/27"},"comments":{"href":"https://api.github.com/repos/chompasina/salary/issues/27/comments"},"review_comments":{"href":"https://api.github.com/repos/chompasina/salary/pulls/27/comments"},"review_comment":{"href":"https://api.github.com/repos/chompasina/salary/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/chompasina/salary/pulls/27/commits"},"statuses":{"href":"https://api.github.com/repos/chompasina/salary/statuses/413853102735a47db01c16b98f6f4e4d8bd6d25a"}}}}
{"actor":{"display_login":"houndci-bot"}}