{"action":"created","comment":{"url":"https://api.github.com/repos/meyasubaco/dashboard-api/pulls/comments/52850999","id":52850999,"diff_hunk":"@@ -0,0 +1,33 @@\n+require_relative './integration_test_helper.rb'\n+require_relative '../../dashboard_api.rb'\n+require_relative '../../models/comment_thread.rb'\n+\n+class DeveloperCommentsTest < Test::Unit::TestCase\n+  include Rack::Test::Methods\n+\n+  def app\n+    Sinatra::Application\n+  end\n+\n+  def setup\n+    CommentThread.any_instance.stubs(:get_parse_object_id).returns('hoge')\n+    CommentThread.stubs(:find_by_id).returns(@comment_thread)\n+    CommentThread.any_instance.stubs(:save).returns(@comment_thread)\n+  end\n+\n+  def test_it_can_get_threads\n+    createtime = Parse::Date.new(DateTime.now)\n+    comment_thread = CommentThread.new('objectId' => 'hoge', 'app' => 'sample_app', 'appliUser' => 'sample_appli_user', 'lastCommentContent' => 'comment', 'lastCommentUpdatetime' => createtime, 'lastUserShowTime' => createtime, 'lastDeveloperShowTime' => nil, 'lastCommentPoster' => 'user', 'developerReplied' => true)\n+    CommentThread.stubs(:find_all_by_app_id).returns([comment_thread, comment_thread, comment_thread])","path":"test/integration-test/comment_thread_test.rb","position":21,"original_position":21,"commit_id":"bb12dcde9bdf55e87f5fa1299f152a764aeef764","original_commit_id":"bb12dcde9bdf55e87f5fa1299f152a764aeef764","user":{"login":"shoma2da","id":2342648,"avatar_url":"https://avatars.githubusercontent.com/u/2342648?v=3","gravatar_id":"","url":"https://api.github.com/users/shoma2da","html_url":"https://github.com/shoma2da","followers_url":"https://api.github.com/users/shoma2da/followers","following_url":"https://api.github.com/users/shoma2da/following{/other_user}","gists_url":"https://api.github.com/users/shoma2da/gists{/gist_id}","starred_url":"https://api.github.com/users/shoma2da/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shoma2da/subscriptions","organizations_url":"https://api.github.com/users/shoma2da/orgs","repos_url":"https://api.github.com/users/shoma2da/repos","events_url":"https://api.github.com/users/shoma2da/events{/privacy}","received_events_url":"https://api.github.com/users/shoma2da/received_events","type":"User","site_admin":false},"body":"responseが200が返ってくる確認だけなので↓みたいな感じで良さそう\r\n```\r\ncomment_stub = stub(:to_json).returns({})\r\nCommentThread.stubs(:find_all_by_app_id).returns([comment_stub, comment_stub, comment_stub])\r\n```","created_at":"2016-02-14T23:22:46Z","updated_at":"2016-02-14T23:22:46Z","html_url":"https://github.com/meyasubaco/dashboard-api/pull/82#discussion_r52850999","pull_request_url":"https://api.github.com/repos/meyasubaco/dashboard-api/pulls/82","_links":{"self":{"href":"https://api.github.com/repos/meyasubaco/dashboard-api/pulls/comments/52850999"},"html":{"href":"https://github.com/meyasubaco/dashboard-api/pull/82#discussion_r52850999"},"pull_request":{"href":"https://api.github.com/repos/meyasubaco/dashboard-api/pulls/82"}}},"pull_request":{"url":"https://api.github.com/repos/meyasubaco/dashboard-api/pulls/82","id":59286840,"html_url":"https://github.com/meyasubaco/dashboard-api/pull/82","diff_url":"https://github.com/meyasubaco/dashboard-api/pull/82.diff","patch_url":"https://github.com/meyasubaco/dashboard-api/pull/82.patch","issue_url":"https://api.github.com/repos/meyasubaco/dashboard-api/issues/82","number":82,"state":"open","locked":false,"title":"ダッシュボードから使う DeveloperComment 投稿API、 Thread一覧取得API実装","user":{"login":"himaratsu","id":1206009,"avatar_url":"https://avatars.githubusercontent.com/u/1206009?v=3","gravatar_id":"","url":"https://api.github.com/users/himaratsu","html_url":"https://github.com/himaratsu","followers_url":"https://api.github.com/users/himaratsu/followers","following_url":"https://api.github.com/users/himaratsu/following{/other_user}","gists_url":"https://api.github.com/users/himaratsu/gists{/gist_id}","starred_url":"https://api.github.com/users/himaratsu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/himaratsu/subscriptions","organizations_url":"https://api.github.com/users/himaratsu/orgs","repos_url":"https://api.github.com/users/himaratsu/repos","events_url":"https://api.github.com/users/himaratsu/events{/privacy}","received_events_url":"https://api.github.com/users/himaratsu/received_events","type":"User","site_admin":false},"body":"# やったこと\r\n\r\n* コメント投稿部分のAPIの実装\r\n* スレッド一覧取得APIの実装\r\n\r\n![image](https://cloud.githubusercontent.com/assets/1206009/12998489/89e067f2-d187-11e5-82f4-ac486c49003e.png)\r\n\r\nこの画像の*青字◯*で書かれた部分の実装をやりました。\r\n\r\n# フロー\r\n\r\n* コメント投稿\r\n * ダッシュボード側からコメントが投稿される\r\n * スレッドに紐づく形でコメントを登録\r\n * スレッドの「最終コメント情報」を更新する\r\n* スレッド一覧取得\r\n * スレッド一覧の情報を取得する（アプリユーザー情報をJoinした状態で）\r\n\r\n# 追加したクラス\r\n\r\n* **AppliUser**\r\n * アプリユーザーを表す\r\n* **CommentThread**\r\n * スレッドを表す（Thread は ruby の予約クラスで使えなかった）\r\n* **DeveloperComment**\r\n * コメント情報（既存の Comment クラスを拡張するのではなく新規でつくった）\r\n\r\n# APIの叩き方\r\n\r\n## コメント投稿API\r\n\r\n* POST\r\n* `/applications/:app_id/developer_comments`\r\n\r\n|key名|valueの説明|valueの例|\r\n|----|----|----|\r\n|thread_id|スレッドのid|UGxV3VD1Nl|\r\n|content|コメントの内容|Cool app!|\r\n\r\n\r\n#### sample\r\n\r\n* POST \r\n* `localhost:4567/applications/Uk13xgkohr/developer_comments`\r\n\r\n```\r\n{\r\n    \"thread_id\": \"vRnP4rT8NP\",\r\n    \"content\": \"reply from developer\"\r\n}\r\n```\r\n\r\n## スレッド一覧取得API\r\n\r\n* GET\r\n* `applications/:app_id/threads`\r\n\r\n```\r\n[{\r\n\t\"id\": \"oBt1tm8PCA\",\r\n\t\"app_id\": \"Uk13xgkohr\",\r\n\t\"appli_user\": {\r\n\t\t\"id\": \"FMYxgLsFNE\",\r\n\t\t\"appli_user_id\": \"random_string_AAA\",\r\n\t\t\"push_token\": \"device_token\",\r\n\t\t\"os\": \"ios\",\r\n\t\t\"model\": \"iPhone7.2\"\r\n\t},\r\n\t\"last_info\": {\r\n\t\t\"comment_content\": \"Hello\",\r\n\t\t\"comment_updatetime\": {\r\n\t\t\t\"__type\": \"Date\",\r\n\t\t\t\"iso\": \"2016-02-11T04:37:31.484Z\"\r\n\t\t},\r\n\t\t\"user_show_time\": {\r\n\t\t\t\"__type\": \"Date\",\r\n\t\t\t\"iso\": \"2016-02-11T04:37:31.484Z\"\r\n\t\t},\r\n\t\t\"developer_show_time\": null,\r\n\t\t\"comment_poster\": \"developer\"\r\n\t},\r\n\t\"developer_replied\": false\r\n}]\r\n```\r\n\r\n\r\n# Issue \r\n\r\nhttps://github.com/meyasubaco/dashboard-api/issues/81","created_at":"2016-02-14T04:33:42Z","updated_at":"2016-02-14T23:22:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8aaa628114dadd4828e0304b393b363ec5b42cdc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/meyasubaco/dashboard-api/pulls/82/commits","review_comments_url":"https://api.github.com/repos/meyasubaco/dashboard-api/pulls/82/comments","review_comment_url":"https://api.github.com/repos/meyasubaco/dashboard-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/meyasubaco/dashboard-api/issues/82/comments","statuses_url":"https://api.github.com/repos/meyasubaco/dashboard-api/statuses/bb12dcde9bdf55e87f5fa1299f152a764aeef764","head":{"label":"meyasubaco:post_developer_comment","ref":"post_developer_comment","sha":"bb12dcde9bdf55e87f5fa1299f152a764aeef764","user":{"login":"meyasubaco","id":10242909,"avatar_url":"https://avatars.githubusercontent.com/u/10242909?v=3","gravatar_id":"","url":"https://api.github.com/users/meyasubaco","html_url":"https://github.com/meyasubaco","followers_url":"https://api.github.com/users/meyasubaco/followers","following_url":"https://api.github.com/users/meyasubaco/following{/other_user}","gists_url":"https://api.github.com/users/meyasubaco/gists{/gist_id}","starred_url":"https://api.github.com/users/meyasubaco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meyasubaco/subscriptions","organizations_url":"https://api.github.com/users/meyasubaco/orgs","repos_url":"https://api.github.com/users/meyasubaco/repos","events_url":"https://api.github.com/users/meyasubaco/events{/privacy}","received_events_url":"https://api.github.com/users/meyasubaco/received_events","type":"Organization","site_admin":false},"repo":{"id":35916652,"name":"dashboard-api","full_name":"meyasubaco/dashboard-api","owner":{"login":"meyasubaco","id":10242909,"avatar_url":"https://avatars.githubusercontent.com/u/10242909?v=3","gravatar_id":"","url":"https://api.github.com/users/meyasubaco","html_url":"https://github.com/meyasubaco","followers_url":"https://api.github.com/users/meyasubaco/followers","following_url":"https://api.github.com/users/meyasubaco/following{/other_user}","gists_url":"https://api.github.com/users/meyasubaco/gists{/gist_id}","starred_url":"https://api.github.com/users/meyasubaco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meyasubaco/subscriptions","organizations_url":"https://api.github.com/users/meyasubaco/orgs","repos_url":"https://api.github.com/users/meyasubaco/repos","events_url":"https://api.github.com/users/meyasubaco/events{/privacy}","received_events_url":"https://api.github.com/users/meyasubaco/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/meyasubaco/dashboard-api","description":"","fork":false,"url":"https://api.github.com/repos/meyasubaco/dashboard-api","forks_url":"https://api.github.com/repos/meyasubaco/dashboard-api/forks","keys_url":"https://api.github.com/repos/meyasubaco/dashboard-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/meyasubaco/dashboard-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/meyasubaco/dashboard-api/teams","hooks_url":"https://api.github.com/repos/meyasubaco/dashboard-api/hooks","issue_events_url":"https://api.github.com/repos/meyasubaco/dashboard-api/issues/events{/number}","events_url":"https://api.github.com/repos/meyasubaco/dashboard-api/events","assignees_url":"https://api.github.com/repos/meyasubaco/dashboard-api/assignees{/user}","branches_url":"https://api.github.com/repos/meyasubaco/dashboard-api/branches{/branch}","tags_url":"https://api.github.com/repos/meyasubaco/dashboard-api/tags","blobs_url":"https://api.github.com/repos/meyasubaco/dashboard-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/meyasubaco/dashboard-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/meyasubaco/dashboard-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/meyasubaco/dashboard-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/meyasubaco/dashboard-api/statuses/{sha}","languages_url":"https://api.github.com/repos/meyasubaco/dashboard-api/languages","stargazers_url":"https://api.github.com/repos/meyasubaco/dashboard-api/stargazers","contributors_url":"https://api.github.com/repos/meyasubaco/dashboard-api/contributors","subscribers_url":"https://api.github.com/repos/meyasubaco/dashboard-api/subscribers","subscription_url":"https://api.github.com/repos/meyasubaco/dashboard-api/subscription","commits_url":"https://api.github.com/repos/meyasubaco/dashboard-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/meyasubaco/dashboard-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/meyasubaco/dashboard-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/meyasubaco/dashboard-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/meyasubaco/dashboard-api/contents/{+path}","compare_url":"https://api.github.com/repos/meyasubaco/dashboard-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/meyasubaco/dashboard-api/merges","archive_url":"https://api.github.com/repos/meyasubaco/dashboard-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/meyasubaco/dashboard-api/downloads","issues_url":"https://api.github.com/repos/meyasubaco/dashboard-api/issues{/number}","pulls_url":"https://api.github.com/repos/meyasubaco/dashboard-api/pulls{/number}","milestones_url":"https://api.github.com/repos/meyasubaco/dashboard-api/milestones{/number}","notifications_url":"https://api.github.com/repos/meyasubaco/dashboard-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/meyasubaco/dashboard-api/labels{/name}","releases_url":"https://api.github.com/repos/meyasubaco/dashboard-api/releases{/id}","deployments_url":"https://api.github.com/repos/meyasubaco/dashboard-api/deployments","created_at":"2015-05-20T00:45:03Z","updated_at":"2016-01-14T01:30:13Z","pushed_at":"2016-02-14T07:05:12Z","git_url":"git://github.com/meyasubaco/dashboard-api.git","ssh_url":"git@github.com:meyasubaco/dashboard-api.git","clone_url":"https://github.com/meyasubaco/dashboard-api.git","svn_url":"https://github.com/meyasubaco/dashboard-api","homepage":null,"size":115,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":0,"default_branch":"master"}},"base":{"label":"meyasubaco:master","ref":"master","sha":"5378ba532ce85655b46809714e22a7aca78a482f","user":{"login":"meyasubaco","id":10242909,"avatar_url":"https://avatars.githubusercontent.com/u/10242909?v=3","gravatar_id":"","url":"https://api.github.com/users/meyasubaco","html_url":"https://github.com/meyasubaco","followers_url":"https://api.github.com/users/meyasubaco/followers","following_url":"https://api.github.com/users/meyasubaco/following{/other_user}","gists_url":"https://api.github.com/users/meyasubaco/gists{/gist_id}","starred_url":"https://api.github.com/users/meyasubaco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meyasubaco/subscriptions","organizations_url":"https://api.github.com/users/meyasubaco/orgs","repos_url":"https://api.github.com/users/meyasubaco/repos","events_url":"https://api.github.com/users/meyasubaco/events{/privacy}","received_events_url":"https://api.github.com/users/meyasubaco/received_events","type":"Organization","site_admin":false},"repo":{"id":35916652,"name":"dashboard-api","full_name":"meyasubaco/dashboard-api","owner":{"login":"meyasubaco","id":10242909,"avatar_url":"https://avatars.githubusercontent.com/u/10242909?v=3","gravatar_id":"","url":"https://api.github.com/users/meyasubaco","html_url":"https://github.com/meyasubaco","followers_url":"https://api.github.com/users/meyasubaco/followers","following_url":"https://api.github.com/users/meyasubaco/following{/other_user}","gists_url":"https://api.github.com/users/meyasubaco/gists{/gist_id}","starred_url":"https://api.github.com/users/meyasubaco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meyasubaco/subscriptions","organizations_url":"https://api.github.com/users/meyasubaco/orgs","repos_url":"https://api.github.com/users/meyasubaco/repos","events_url":"https://api.github.com/users/meyasubaco/events{/privacy}","received_events_url":"https://api.github.com/users/meyasubaco/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/meyasubaco/dashboard-api","description":"","fork":false,"url":"https://api.github.com/repos/meyasubaco/dashboard-api","forks_url":"https://api.github.com/repos/meyasubaco/dashboard-api/forks","keys_url":"https://api.github.com/repos/meyasubaco/dashboard-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/meyasubaco/dashboard-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/meyasubaco/dashboard-api/teams","hooks_url":"https://api.github.com/repos/meyasubaco/dashboard-api/hooks","issue_events_url":"https://api.github.com/repos/meyasubaco/dashboard-api/issues/events{/number}","events_url":"https://api.github.com/repos/meyasubaco/dashboard-api/events","assignees_url":"https://api.github.com/repos/meyasubaco/dashboard-api/assignees{/user}","branches_url":"https://api.github.com/repos/meyasubaco/dashboard-api/branches{/branch}","tags_url":"https://api.github.com/repos/meyasubaco/dashboard-api/tags","blobs_url":"https://api.github.com/repos/meyasubaco/dashboard-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/meyasubaco/dashboard-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/meyasubaco/dashboard-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/meyasubaco/dashboard-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/meyasubaco/dashboard-api/statuses/{sha}","languages_url":"https://api.github.com/repos/meyasubaco/dashboard-api/languages","stargazers_url":"https://api.github.com/repos/meyasubaco/dashboard-api/stargazers","contributors_url":"https://api.github.com/repos/meyasubaco/dashboard-api/contributors","subscribers_url":"https://api.github.com/repos/meyasubaco/dashboard-api/subscribers","subscription_url":"https://api.github.com/repos/meyasubaco/dashboard-api/subscription","commits_url":"https://api.github.com/repos/meyasubaco/dashboard-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/meyasubaco/dashboard-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/meyasubaco/dashboard-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/meyasubaco/dashboard-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/meyasubaco/dashboard-api/contents/{+path}","compare_url":"https://api.github.com/repos/meyasubaco/dashboard-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/meyasubaco/dashboard-api/merges","archive_url":"https://api.github.com/repos/meyasubaco/dashboard-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/meyasubaco/dashboard-api/downloads","issues_url":"https://api.github.com/repos/meyasubaco/dashboard-api/issues{/number}","pulls_url":"https://api.github.com/repos/meyasubaco/dashboard-api/pulls{/number}","milestones_url":"https://api.github.com/repos/meyasubaco/dashboard-api/milestones{/number}","notifications_url":"https://api.github.com/repos/meyasubaco/dashboard-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/meyasubaco/dashboard-api/labels{/name}","releases_url":"https://api.github.com/repos/meyasubaco/dashboard-api/releases{/id}","deployments_url":"https://api.github.com/repos/meyasubaco/dashboard-api/deployments","created_at":"2015-05-20T00:45:03Z","updated_at":"2016-01-14T01:30:13Z","pushed_at":"2016-02-14T07:05:12Z","git_url":"git://github.com/meyasubaco/dashboard-api.git","ssh_url":"git@github.com:meyasubaco/dashboard-api.git","clone_url":"https://github.com/meyasubaco/dashboard-api.git","svn_url":"https://github.com/meyasubaco/dashboard-api","homepage":null,"size":115,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/meyasubaco/dashboard-api/pulls/82"},"html":{"href":"https://github.com/meyasubaco/dashboard-api/pull/82"},"issue":{"href":"https://api.github.com/repos/meyasubaco/dashboard-api/issues/82"},"comments":{"href":"https://api.github.com/repos/meyasubaco/dashboard-api/issues/82/comments"},"review_comments":{"href":"https://api.github.com/repos/meyasubaco/dashboard-api/pulls/82/comments"},"review_comment":{"href":"https://api.github.com/repos/meyasubaco/dashboard-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/meyasubaco/dashboard-api/pulls/82/commits"},"statuses":{"href":"https://api.github.com/repos/meyasubaco/dashboard-api/statuses/bb12dcde9bdf55e87f5fa1299f152a764aeef764"}}}}