{"action":"created","issue":{"url":"https://api.github.com/repos/handshakejp/dashboard-api/issues/40","labels_url":"https://api.github.com/repos/handshakejp/dashboard-api/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/handshakejp/dashboard-api/issues/40/comments","events_url":"https://api.github.com/repos/handshakejp/dashboard-api/issues/40/events","html_url":"https://github.com/handshakejp/dashboard-api/pull/40","id":102923238,"number":40,"title":"ログイン機能実装","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},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-25T00:51:49Z","updated_at":"2015-08-30T03:35:54Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/handshakejp/dashboard-api/pulls/40","html_url":"https://github.com/handshakejp/dashboard-api/pull/40","diff_url":"https://github.com/handshakejp/dashboard-api/pull/40.diff","patch_url":"https://github.com/handshakejp/dashboard-api/pull/40.patch"},"body":"# 概要\r\n\r\n以下のユーザー管理機能APIを実装した。\r\n\r\n* 新規ユーザー登録API\r\n* ログイン機能API\r\n* ログアウト機能API\r\n* ログイン状態の取得API\r\n\r\n## 新規ユーザー登録\r\n\r\nParse のユーザー管理に従って、以下の情報で新規登録できる。\r\n\r\n* ユーザー名（すでに登録済みのユーザー名だと弾かれる）\r\n* パスワード\r\n* メールアドレス（すでに登録済みのメアドだと弾かれる）\r\n\r\n### endpoint\r\n\r\n* `http://localhost:4567/users/create` \r\n* `POST`\r\n* パラメータ\r\n```\r\n{\r\n \"name\": \"name\",\r\n \"password\": \"password\",\r\n \"email\": \"email@example.com\"\r\n}\r\n```\r\n\r\n### レスポンス\r\n\r\n**新規登録に成功した場合**\r\n```\r\nstatus: 201\r\n{\r\n\"user_id\": \"RHz7T7Vfh7\"\r\n}\r\n```\r\n**失敗した場合**\r\n```\r\nstatus: 400\r\n{\r\n\"error_message\": \"unrecognized error\"   # 情報なさすぎるので後ほど追記します\r\n}\r\n```\r\n\r\n## ログイン\r\n\r\n以下の情報でログインする。\r\n\r\n* ユーザー名\r\n* パスワード\r\n\r\n### endpoint\r\n\r\n* `http://localhost:4567/session/create` \r\n* `POST`\r\n* パラメータ\r\n```\r\n{\r\n \"name\": \"name\",\r\n \"password\": \"password\"\r\n}\r\n```\r\n\r\n**ログイン成功した場合**\r\n```\r\nstatus: 201\r\n{\r\n\"user_id\": \"RHz7T7Vfh7\"\r\n}\r\n```\r\n**失敗した場合**\r\n```\r\nstatus: 400\r\n{\r\n\"error_message\": \"cannot login\"   # 情報なさすぎるので後ほど追記します\r\n}\r\n```\r\n\r\n## ログアウト\r\n\r\nログアウトをする（セッションの破棄をする）\r\n\r\n### endpoint\r\n\r\n* `http://localhost:4567/session/destroy`\r\n* `POST`\r\n\r\n\r\n## ログイン状態の取得\r\n\r\nユーザーがログイン中かどうかチェックする。\r\n\r\n### endpoint\r\n\r\n* `http://localhost:4567/session/statusP\r\n* `GET`\r\n\r\n**ログイン**\r\n```\r\n{\r\n\"result\":\"LOGIN\",\r\n\"user_id\":\"U3JxLFceNs\"\r\n}\r\n```\r\n\r\n**ログアウト**\r\n```\r\n{\r\n\"result\":\"LOGOUT\"\r\n}\r\n```\r\n\r\n# TODO\r\n\r\n* エラー処理\r\n* テストコード"},"comment":{"url":"https://api.github.com/repos/handshakejp/dashboard-api/issues/comments/136082449","html_url":"https://github.com/handshakejp/dashboard-api/pull/40#issuecomment-136082449","issue_url":"https://api.github.com/repos/handshakejp/dashboard-api/issues/40","id":136082449,"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},"created_at":"2015-08-30T03:35:54Z","updated_at":"2015-08-30T03:35:54Z","body":"## 概要を見た時点でのコメント\r\n\r\n比較的RESTなAPIを作っていってる感じなのでendpointは再考すると良さそうに見えました。\r\n（URLパスにやりたいことが入っているので、HTTPメソッドで表現したほうが適切に見えました）\r\n\r\n* http://localhost:4567/users/create に POST → http://localhost:4567/users にPOST\r\n* http://localhost:4567/session/create に POST →  http://localhost:4567/session にPOST\r\n* http://localhost:4567/session/destroy にPOST → http://localhost:4567/session にDELETE\r\n* http://localhost:4567/session/status にGET → http://localhost:4567/session にGET"}}