{"action":"created","comment":{"url":"https://api.github.com/repos/lodqa/lodqa_email_agent/pulls/comments/218694571","pull_request_review_id":156683919,"id":218694571,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxODY5NDU3MQ==","diff_hunk":"@@ -7,17 +7,25 @@ class << self\n     def post_query(question, address_to_send, query_option)\n       return WarningMailer.deliver_email('warning mail', address_to_send) if question.blank?\n       callback_url = \"http://#{ENV['HOST_LODQA_EMAIL_AGENT']}/mail/#{address_to_send}/events\"\n-      post_params = { query: question,\n-                      read_timeout: query_option['read_timeout'],\n-                      sparql_limit: query_option['sparql_limit'],\n-                      answer_limit: query_option['answer_limit'],\n-                      cache: query_option['cache'],\n-                      callback_url: callback_url }\n+      post_params = { query: question, callback_url: callback_url }\n+      post_params = post_params_add(post_params, query_option) unless query_option.blank?\n+\n       RestClient::Request.execute method: :post, url: SERVER_URL, payload: post_params\n       puts 'POST succcess.'\n     rescue Errno::ECONNREFUSED, Net::OpenTimeout, SocketError\n       puts 'POST failed.'\n       FailureMailer.deliver_email('failure mail', address_to_send)\n     end\n+\n+    private\n+\n+    # query_optionがある場合はpost_paramsに追加する\n+    def post_params_add(post_params, query_option)\n+      post_params[:read_timeout] = query_option['read_timeout'] unless query_option['read_timeout'].blank?\n+      post_params[:sparql_limit] = query_option['sparql_limit'] unless query_option['sparql_limit'].blank?\n+      post_params[:answer_limit] = query_option['answer_limit'] unless query_option['answer_limit'].blank?\n+      post_params[:cache] = query_option['cache'] unless query_option['cache'].blank?","path":"app/labor/lodqa_client.rb","position":27,"original_position":27,"commit_id":"17dfebd528bda16344e0d4b1f6060bc8b22a5878","original_commit_id":"17dfebd528bda16344e0d4b1f6060bc8b22a5878","user":{"login":"ledsun","id":1079508,"node_id":"MDQ6VXNlcjEwNzk1MDg=","avatar_url":"https://avatars3.githubusercontent.com/u/1079508?v=4","gravatar_id":"","url":"https://api.github.com/users/ledsun","html_url":"https://github.com/ledsun","followers_url":"https://api.github.com/users/ledsun/followers","following_url":"https://api.github.com/users/ledsun/following{/other_user}","gists_url":"https://api.github.com/users/ledsun/gists{/gist_id}","starred_url":"https://api.github.com/users/ledsun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ledsun/subscriptions","organizations_url":"https://api.github.com/users/ledsun/orgs","repos_url":"https://api.github.com/users/ledsun/repos","events_url":"https://api.github.com/users/ledsun/events{/privacy}","received_events_url":"https://api.github.com/users/ledsun/received_events","type":"User","site_admin":false},"body":"`unless hoge.blank?`はi`f hoge.present?`でかけます。\r\nhttps://qiita.com/somewhatgood@github/items/b74107480ee3821784e6#present%E3%81%AFblank%E3%81%A8%E5%90%8C%E3%81%98%E6%84%8F%E5%91%B3\r\nすこしシンプルになると思います。","created_at":"2018-09-19T07:29:13Z","updated_at":"2018-09-19T07:29:15Z","html_url":"https://github.com/lodqa/lodqa_email_agent/pull/115#discussion_r218694571","pull_request_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/pulls/115","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/lodqa/lodqa_email_agent/pulls/comments/218694571"},"html":{"href":"https://github.com/lodqa/lodqa_email_agent/pull/115#discussion_r218694571"},"pull_request":{"href":"https://api.github.com/repos/lodqa/lodqa_email_agent/pulls/115"}},"in_reply_to_id":218693036},"pull_request":{"url":"https://api.github.com/repos/lodqa/lodqa_email_agent/pulls/115","id":216512769,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE2NTEyNzY5","html_url":"https://github.com/lodqa/lodqa_email_agent/pull/115","diff_url":"https://github.com/lodqa/lodqa_email_agent/pull/115.diff","patch_url":"https://github.com/lodqa/lodqa_email_agent/pull/115.patch","issue_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/issues/115","number":115,"state":"open","locked":false,"title":"DEV-112 受信メールの本文が空の場合はlodqa_client.rbにてRestClient::InternalServerError発生している","user":{"login":"shsukh","id":39178089,"node_id":"MDQ6VXNlcjM5MTc4MDg5","avatar_url":"https://avatars3.githubusercontent.com/u/39178089?v=4","gravatar_id":"","url":"https://api.github.com/users/shsukh","html_url":"https://github.com/shsukh","followers_url":"https://api.github.com/users/shsukh/followers","following_url":"https://api.github.com/users/shsukh/following{/other_user}","gists_url":"https://api.github.com/users/shsukh/gists{/gist_id}","starred_url":"https://api.github.com/users/shsukh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shsukh/subscriptions","organizations_url":"https://api.github.com/users/shsukh/orgs","repos_url":"https://api.github.com/users/shsukh/repos","events_url":"https://api.github.com/users/shsukh/events{/privacy}","received_events_url":"https://api.github.com/users/shsukh/received_events","type":"User","site_admin":false},"body":"Closed #112\r\n\r\n[対応内容]\r\n・受信メールの本文が空の場合はlodqa_client.rbにてRestClient::InternalServerErrorが発生している\r\n\r\n[確認内容]\r\n・labor/lodqa_client.rbファイルが修正されていること\r\n\r\n[受信するメール確認]\r\n![image](https://user-images.githubusercontent.com/39178089/45731270-aeec7c80-bc11-11e8-9d91-412fefbbe9c8.png)\r\n_本文が空のメール_\r\n![image](https://user-images.githubusercontent.com/39178089/45731272-b1e76d00-bc11-11e8-8f5b-5122381b8d11.png)\r\n\r\n実行\r\n（docker-compose run --rm lodqa_email_agent sh）\r\n　（bundle exec rails runner lib/check_new_mails.rb）\r\n![image](https://user-images.githubusercontent.com/39178089/45731284-be6bc580-bc11-11e8-9c03-3098c7966db6.png)\r\n\r\n実行結果（メール削除・メール通知（4通））\r\n![image](https://user-images.githubusercontent.com/39178089/45731291-c88dc400-bc11-11e8-9d83-1a44440fac81.png)\r\n\r\n_lodemailagent@gmail.comへの送信_\r\n![image](https://user-images.githubusercontent.com/39178089/45731299-d2172c00-bc11-11e8-9be8-5124f475ad56.png)\r\n\r\n実行結果（メール本文内容確認）\r\n※以下、上記の画像メールの順で追加している\r\n```\r\nI am beginning to find the answer to the following question:\r\n\"What drugs can be used to treat pain?\"\r\n\r\nI will send you the answer when the search is completed.\r\n\r\nIf you want, you can check the progress at any time:\r\nhttp://lodqa.org/answer?search_id=9ae5bc80-2168-4873-9f4c-0aaea16c0c22\r\n```\r\n\r\n```\r\n39 items have been found as the answer to your question.\r\nYou can see the results at:\r\nhttp://lodqa.org/answer?search_id=9ae5bc80-2168-4873-9f4c-0aaea16c0c22\r\n```\r\n\r\n```\r\nI am beginning to find the answer to the following question:\r\n\"Which genes are associated with Endothelin receptor type B?\"\r\n\r\nI will send you the answer when the search is completed.\r\n\r\nIf you want, you can check the progress at any time:\r\nhttp://lodqa.org/answer?search_id=737736d8-fc36-4f35-9194-2f341a2dda8f\r\n```\r\n\r\n```\r\n11 items have been found as the answer to your question.\r\nYou can see the results at:\r\nhttp://lodqa.org/answer?search_id=737736d8-fc36-4f35-9194-2f341a2dda8f\r\n```\r\n\r\n修正後（ 17dfebd）\r\n受信メール（3通）\r\n![image](https://user-images.githubusercontent.com/39178089/45737008-a606a580-bc27-11e8-8c58-799999b8d2ed.png)\r\n\r\n![image](https://user-images.githubusercontent.com/39178089/45737011-a99a2c80-bc27-11e8-8ff6-95912995e9fa.png)\r\n\r\n![image](https://user-images.githubusercontent.com/39178089/45737014-abfc8680-bc27-11e8-8d8a-4678bc17f2e6.png)\r\n\r\n実行結果（メール通知（6通））\r\n![image](https://user-images.githubusercontent.com/39178089/45737047-bfa7ed00-bc27-11e8-89df-316e6f6c1d34.png)\r\n\r\n\r\n","created_at":"2018-09-19T04:43:45Z","updated_at":"2018-09-19T07:29:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eac9ee2845224d3befc47e8ba7e91364465dc92f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/pulls/115/commits","review_comments_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/pulls/115/comments","review_comment_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/issues/115/comments","statuses_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/statuses/17dfebd528bda16344e0d4b1f6060bc8b22a5878","head":{"label":"lodqa:DEV-112","ref":"DEV-112","sha":"17dfebd528bda16344e0d4b1f6060bc8b22a5878","user":{"login":"lodqa","id":6194150,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYxOTQxNTA=","avatar_url":"https://avatars0.githubusercontent.com/u/6194150?v=4","gravatar_id":"","url":"https://api.github.com/users/lodqa","html_url":"https://github.com/lodqa","followers_url":"https://api.github.com/users/lodqa/followers","following_url":"https://api.github.com/users/lodqa/following{/other_user}","gists_url":"https://api.github.com/users/lodqa/gists{/gist_id}","starred_url":"https://api.github.com/users/lodqa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lodqa/subscriptions","organizations_url":"https://api.github.com/users/lodqa/orgs","repos_url":"https://api.github.com/users/lodqa/repos","events_url":"https://api.github.com/users/lodqa/events{/privacy}","received_events_url":"https://api.github.com/users/lodqa/received_events","type":"Organization","site_admin":false},"repo":{"id":142971425,"node_id":"MDEwOlJlcG9zaXRvcnkxNDI5NzE0MjU=","name":"lodqa_email_agent","full_name":"lodqa/lodqa_email_agent","private":false,"owner":{"login":"lodqa","id":6194150,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYxOTQxNTA=","avatar_url":"https://avatars0.githubusercontent.com/u/6194150?v=4","gravatar_id":"","url":"https://api.github.com/users/lodqa","html_url":"https://github.com/lodqa","followers_url":"https://api.github.com/users/lodqa/followers","following_url":"https://api.github.com/users/lodqa/following{/other_user}","gists_url":"https://api.github.com/users/lodqa/gists{/gist_id}","starred_url":"https://api.github.com/users/lodqa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lodqa/subscriptions","organizations_url":"https://api.github.com/users/lodqa/orgs","repos_url":"https://api.github.com/users/lodqa/repos","events_url":"https://api.github.com/users/lodqa/events{/privacy}","received_events_url":"https://api.github.com/users/lodqa/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/lodqa/lodqa_email_agent","description":"The e-mail agent server for LODQA","fork":false,"url":"https://api.github.com/repos/lodqa/lodqa_email_agent","forks_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/forks","keys_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/teams","hooks_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/hooks","issue_events_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/issues/events{/number}","events_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/events","assignees_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/assignees{/user}","branches_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/branches{/branch}","tags_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/tags","blobs_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/git/refs{/sha}","trees_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/statuses/{sha}","languages_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/languages","stargazers_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/stargazers","contributors_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/contributors","subscribers_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/subscribers","subscription_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/subscription","commits_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/commits{/sha}","git_commits_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/git/commits{/sha}","comments_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/comments{/number}","issue_comment_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/issues/comments{/number}","contents_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/contents/{+path}","compare_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/merges","archive_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/downloads","issues_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/issues{/number}","pulls_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/pulls{/number}","milestones_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/milestones{/number}","notifications_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/labels{/name}","releases_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/releases{/id}","deployments_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/deployments","created_at":"2018-07-31T06:24:26Z","updated_at":"2018-09-19T04:03:13Z","pushed_at":"2018-09-19T07:16:31Z","git_url":"git://github.com/lodqa/lodqa_email_agent.git","ssh_url":"git@github.com:lodqa/lodqa_email_agent.git","clone_url":"https://github.com/lodqa/lodqa_email_agent.git","svn_url":"https://github.com/lodqa/lodqa_email_agent","homepage":null,"size":67,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"lodqa:master","ref":"master","sha":"8ca89ee29c01895943331d32b160c4e1705cd514","user":{"login":"lodqa","id":6194150,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYxOTQxNTA=","avatar_url":"https://avatars0.githubusercontent.com/u/6194150?v=4","gravatar_id":"","url":"https://api.github.com/users/lodqa","html_url":"https://github.com/lodqa","followers_url":"https://api.github.com/users/lodqa/followers","following_url":"https://api.github.com/users/lodqa/following{/other_user}","gists_url":"https://api.github.com/users/lodqa/gists{/gist_id}","starred_url":"https://api.github.com/users/lodqa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lodqa/subscriptions","organizations_url":"https://api.github.com/users/lodqa/orgs","repos_url":"https://api.github.com/users/lodqa/repos","events_url":"https://api.github.com/users/lodqa/events{/privacy}","received_events_url":"https://api.github.com/users/lodqa/received_events","type":"Organization","site_admin":false},"repo":{"id":142971425,"node_id":"MDEwOlJlcG9zaXRvcnkxNDI5NzE0MjU=","name":"lodqa_email_agent","full_name":"lodqa/lodqa_email_agent","private":false,"owner":{"login":"lodqa","id":6194150,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYxOTQxNTA=","avatar_url":"https://avatars0.githubusercontent.com/u/6194150?v=4","gravatar_id":"","url":"https://api.github.com/users/lodqa","html_url":"https://github.com/lodqa","followers_url":"https://api.github.com/users/lodqa/followers","following_url":"https://api.github.com/users/lodqa/following{/other_user}","gists_url":"https://api.github.com/users/lodqa/gists{/gist_id}","starred_url":"https://api.github.com/users/lodqa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lodqa/subscriptions","organizations_url":"https://api.github.com/users/lodqa/orgs","repos_url":"https://api.github.com/users/lodqa/repos","events_url":"https://api.github.com/users/lodqa/events{/privacy}","received_events_url":"https://api.github.com/users/lodqa/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/lodqa/lodqa_email_agent","description":"The e-mail agent server for LODQA","fork":false,"url":"https://api.github.com/repos/lodqa/lodqa_email_agent","forks_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/forks","keys_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/teams","hooks_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/hooks","issue_events_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/issues/events{/number}","events_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/events","assignees_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/assignees{/user}","branches_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/branches{/branch}","tags_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/tags","blobs_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/git/refs{/sha}","trees_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/statuses/{sha}","languages_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/languages","stargazers_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/stargazers","contributors_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/contributors","subscribers_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/subscribers","subscription_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/subscription","commits_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/commits{/sha}","git_commits_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/git/commits{/sha}","comments_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/comments{/number}","issue_comment_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/issues/comments{/number}","contents_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/contents/{+path}","compare_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/merges","archive_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/downloads","issues_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/issues{/number}","pulls_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/pulls{/number}","milestones_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/milestones{/number}","notifications_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/labels{/name}","releases_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/releases{/id}","deployments_url":"https://api.github.com/repos/lodqa/lodqa_email_agent/deployments","created_at":"2018-07-31T06:24:26Z","updated_at":"2018-09-19T04:03:13Z","pushed_at":"2018-09-19T07:16:31Z","git_url":"git://github.com/lodqa/lodqa_email_agent.git","ssh_url":"git@github.com:lodqa/lodqa_email_agent.git","clone_url":"https://github.com/lodqa/lodqa_email_agent.git","svn_url":"https://github.com/lodqa/lodqa_email_agent","homepage":null,"size":67,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lodqa/lodqa_email_agent/pulls/115"},"html":{"href":"https://github.com/lodqa/lodqa_email_agent/pull/115"},"issue":{"href":"https://api.github.com/repos/lodqa/lodqa_email_agent/issues/115"},"comments":{"href":"https://api.github.com/repos/lodqa/lodqa_email_agent/issues/115/comments"},"review_comments":{"href":"https://api.github.com/repos/lodqa/lodqa_email_agent/pulls/115/comments"},"review_comment":{"href":"https://api.github.com/repos/lodqa/lodqa_email_agent/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lodqa/lodqa_email_agent/pulls/115/commits"},"statuses":{"href":"https://api.github.com/repos/lodqa/lodqa_email_agent/statuses/17dfebd528bda16344e0d4b1f6060bc8b22a5878"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"ledsun"}}