{"action":"closed","number":4,"pull_request":{"url":"https://api.github.com/repos/tomoasleep/ews/pulls/4","id":37563663,"html_url":"https://github.com/tomoasleep/ews/pull/4","diff_url":"https://github.com/tomoasleep/ews/pull/4.diff","patch_url":"https://github.com/tomoasleep/ews/pull/4.patch","issue_url":"https://api.github.com/repos/tomoasleep/ews/issues/4","number":4,"state":"closed","locked":false,"title":"DB上で仮想マシンが扱えるようにする","user":{"login":"tomoasleep","id":1477130,"avatar_url":"https://avatars.githubusercontent.com/u/1477130?v=3","gravatar_id":"","url":"https://api.github.com/users/tomoasleep","html_url":"https://github.com/tomoasleep","followers_url":"https://api.github.com/users/tomoasleep/followers","following_url":"https://api.github.com/users/tomoasleep/following{/other_user}","gists_url":"https://api.github.com/users/tomoasleep/gists{/gist_id}","starred_url":"https://api.github.com/users/tomoasleep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomoasleep/subscriptions","organizations_url":"https://api.github.com/users/tomoasleep/orgs","repos_url":"https://api.github.com/users/tomoasleep/repos","events_url":"https://api.github.com/users/tomoasleep/events{/privacy}","received_events_url":"https://api.github.com/users/tomoasleep/received_events","type":"User","site_admin":false},"body":"vmアプリ上で、`create_vm`でデータベースにvmを保存するようにして、`index`でユーザーに紐付けられたvmの情報だけ表示するようにしました。\r\n\r\n## 実装\r\nVirtualMachine, VirtualMachineRecordというクラスを追加しました。\r\n\r\nVirtualMachineRecordはデータベースに保存する情報だけ扱います。\r\n\r\nVirtualMachineは`os`とか`state`とか`memorysize`とかdatabaseに保存しない情報も扱います。\r\n`VirtualMachine#save`メソッドで、データベースとハイパーバイザーにvmの作成をして、\r\n`VirtualMachine.from_record`メソッドで、データベースにあるuuidを使ってハイパーバイザーからvmの情報を読み込みます。\r\n\r\n割と急ぎで作ったのでなんかわからないところがあったら聞いてください… :pray: \r\n(本番環境で試してないので試せるなら試して欲しい :pray: )\r\nhttps://edu.jar.jp/redmine/issues/426","created_at":"2015-06-12T13:32:58Z","updated_at":"2015-06-14T09:41:10Z","closed_at":"2015-06-14T09:41:10Z","merged_at":null,"merge_commit_sha":"adddf901fb1c14efe0db74f97fc37efc7b5e7bcf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tomoasleep/ews/pulls/4/commits","review_comments_url":"https://api.github.com/repos/tomoasleep/ews/pulls/4/comments","review_comment_url":"https://api.github.com/repos/tomoasleep/ews/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tomoasleep/ews/issues/4/comments","statuses_url":"https://api.github.com/repos/tomoasleep/ews/statuses/487ab806ebfb9e736a0c59c044ed68f77d58625e","head":{"label":"tomoasleep:virtualmachine-model","ref":"virtualmachine-model","sha":"487ab806ebfb9e736a0c59c044ed68f77d58625e","user":{"login":"tomoasleep","id":1477130,"avatar_url":"https://avatars.githubusercontent.com/u/1477130?v=3","gravatar_id":"","url":"https://api.github.com/users/tomoasleep","html_url":"https://github.com/tomoasleep","followers_url":"https://api.github.com/users/tomoasleep/followers","following_url":"https://api.github.com/users/tomoasleep/following{/other_user}","gists_url":"https://api.github.com/users/tomoasleep/gists{/gist_id}","starred_url":"https://api.github.com/users/tomoasleep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomoasleep/subscriptions","organizations_url":"https://api.github.com/users/tomoasleep/orgs","repos_url":"https://api.github.com/users/tomoasleep/repos","events_url":"https://api.github.com/users/tomoasleep/events{/privacy}","received_events_url":"https://api.github.com/users/tomoasleep/received_events","type":"User","site_admin":false},"repo":{"id":36923029,"name":"ews","full_name":"tomoasleep/ews","owner":{"login":"tomoasleep","id":1477130,"avatar_url":"https://avatars.githubusercontent.com/u/1477130?v=3","gravatar_id":"","url":"https://api.github.com/users/tomoasleep","html_url":"https://github.com/tomoasleep","followers_url":"https://api.github.com/users/tomoasleep/followers","following_url":"https://api.github.com/users/tomoasleep/following{/other_user}","gists_url":"https://api.github.com/users/tomoasleep/gists{/gist_id}","starred_url":"https://api.github.com/users/tomoasleep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomoasleep/subscriptions","organizations_url":"https://api.github.com/users/tomoasleep/orgs","repos_url":"https://api.github.com/users/tomoasleep/repos","events_url":"https://api.github.com/users/tomoasleep/events{/privacy}","received_events_url":"https://api.github.com/users/tomoasleep/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tomoasleep/ews","description":"Enpit Web Service(仮)","fork":false,"url":"https://api.github.com/repos/tomoasleep/ews","forks_url":"https://api.github.com/repos/tomoasleep/ews/forks","keys_url":"https://api.github.com/repos/tomoasleep/ews/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tomoasleep/ews/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tomoasleep/ews/teams","hooks_url":"https://api.github.com/repos/tomoasleep/ews/hooks","issue_events_url":"https://api.github.com/repos/tomoasleep/ews/issues/events{/number}","events_url":"https://api.github.com/repos/tomoasleep/ews/events","assignees_url":"https://api.github.com/repos/tomoasleep/ews/assignees{/user}","branches_url":"https://api.github.com/repos/tomoasleep/ews/branches{/branch}","tags_url":"https://api.github.com/repos/tomoasleep/ews/tags","blobs_url":"https://api.github.com/repos/tomoasleep/ews/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tomoasleep/ews/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tomoasleep/ews/git/refs{/sha}","trees_url":"https://api.github.com/repos/tomoasleep/ews/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tomoasleep/ews/statuses/{sha}","languages_url":"https://api.github.com/repos/tomoasleep/ews/languages","stargazers_url":"https://api.github.com/repos/tomoasleep/ews/stargazers","contributors_url":"https://api.github.com/repos/tomoasleep/ews/contributors","subscribers_url":"https://api.github.com/repos/tomoasleep/ews/subscribers","subscription_url":"https://api.github.com/repos/tomoasleep/ews/subscription","commits_url":"https://api.github.com/repos/tomoasleep/ews/commits{/sha}","git_commits_url":"https://api.github.com/repos/tomoasleep/ews/git/commits{/sha}","comments_url":"https://api.github.com/repos/tomoasleep/ews/comments{/number}","issue_comment_url":"https://api.github.com/repos/tomoasleep/ews/issues/comments{/number}","contents_url":"https://api.github.com/repos/tomoasleep/ews/contents/{+path}","compare_url":"https://api.github.com/repos/tomoasleep/ews/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tomoasleep/ews/merges","archive_url":"https://api.github.com/repos/tomoasleep/ews/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tomoasleep/ews/downloads","issues_url":"https://api.github.com/repos/tomoasleep/ews/issues{/number}","pulls_url":"https://api.github.com/repos/tomoasleep/ews/pulls{/number}","milestones_url":"https://api.github.com/repos/tomoasleep/ews/milestones{/number}","notifications_url":"https://api.github.com/repos/tomoasleep/ews/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tomoasleep/ews/labels{/name}","releases_url":"https://api.github.com/repos/tomoasleep/ews/releases{/id}","created_at":"2015-06-05T09:03:57Z","updated_at":"2015-06-12T10:00:39Z","pushed_at":"2015-06-14T09:31:56Z","git_url":"git://github.com/tomoasleep/ews.git","ssh_url":"git@github.com:tomoasleep/ews.git","clone_url":"https://github.com/tomoasleep/ews.git","svn_url":"https://github.com/tomoasleep/ews","homepage":null,"size":305,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"tomoasleep:master","ref":"master","sha":"d44ffe4a9b0b88f16d82dc55ac50ef287d86a28c","user":{"login":"tomoasleep","id":1477130,"avatar_url":"https://avatars.githubusercontent.com/u/1477130?v=3","gravatar_id":"","url":"https://api.github.com/users/tomoasleep","html_url":"https://github.com/tomoasleep","followers_url":"https://api.github.com/users/tomoasleep/followers","following_url":"https://api.github.com/users/tomoasleep/following{/other_user}","gists_url":"https://api.github.com/users/tomoasleep/gists{/gist_id}","starred_url":"https://api.github.com/users/tomoasleep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomoasleep/subscriptions","organizations_url":"https://api.github.com/users/tomoasleep/orgs","repos_url":"https://api.github.com/users/tomoasleep/repos","events_url":"https://api.github.com/users/tomoasleep/events{/privacy}","received_events_url":"https://api.github.com/users/tomoasleep/received_events","type":"User","site_admin":false},"repo":{"id":36923029,"name":"ews","full_name":"tomoasleep/ews","owner":{"login":"tomoasleep","id":1477130,"avatar_url":"https://avatars.githubusercontent.com/u/1477130?v=3","gravatar_id":"","url":"https://api.github.com/users/tomoasleep","html_url":"https://github.com/tomoasleep","followers_url":"https://api.github.com/users/tomoasleep/followers","following_url":"https://api.github.com/users/tomoasleep/following{/other_user}","gists_url":"https://api.github.com/users/tomoasleep/gists{/gist_id}","starred_url":"https://api.github.com/users/tomoasleep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomoasleep/subscriptions","organizations_url":"https://api.github.com/users/tomoasleep/orgs","repos_url":"https://api.github.com/users/tomoasleep/repos","events_url":"https://api.github.com/users/tomoasleep/events{/privacy}","received_events_url":"https://api.github.com/users/tomoasleep/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tomoasleep/ews","description":"Enpit Web Service(仮)","fork":false,"url":"https://api.github.com/repos/tomoasleep/ews","forks_url":"https://api.github.com/repos/tomoasleep/ews/forks","keys_url":"https://api.github.com/repos/tomoasleep/ews/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tomoasleep/ews/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tomoasleep/ews/teams","hooks_url":"https://api.github.com/repos/tomoasleep/ews/hooks","issue_events_url":"https://api.github.com/repos/tomoasleep/ews/issues/events{/number}","events_url":"https://api.github.com/repos/tomoasleep/ews/events","assignees_url":"https://api.github.com/repos/tomoasleep/ews/assignees{/user}","branches_url":"https://api.github.com/repos/tomoasleep/ews/branches{/branch}","tags_url":"https://api.github.com/repos/tomoasleep/ews/tags","blobs_url":"https://api.github.com/repos/tomoasleep/ews/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tomoasleep/ews/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tomoasleep/ews/git/refs{/sha}","trees_url":"https://api.github.com/repos/tomoasleep/ews/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tomoasleep/ews/statuses/{sha}","languages_url":"https://api.github.com/repos/tomoasleep/ews/languages","stargazers_url":"https://api.github.com/repos/tomoasleep/ews/stargazers","contributors_url":"https://api.github.com/repos/tomoasleep/ews/contributors","subscribers_url":"https://api.github.com/repos/tomoasleep/ews/subscribers","subscription_url":"https://api.github.com/repos/tomoasleep/ews/subscription","commits_url":"https://api.github.com/repos/tomoasleep/ews/commits{/sha}","git_commits_url":"https://api.github.com/repos/tomoasleep/ews/git/commits{/sha}","comments_url":"https://api.github.com/repos/tomoasleep/ews/comments{/number}","issue_comment_url":"https://api.github.com/repos/tomoasleep/ews/issues/comments{/number}","contents_url":"https://api.github.com/repos/tomoasleep/ews/contents/{+path}","compare_url":"https://api.github.com/repos/tomoasleep/ews/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tomoasleep/ews/merges","archive_url":"https://api.github.com/repos/tomoasleep/ews/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tomoasleep/ews/downloads","issues_url":"https://api.github.com/repos/tomoasleep/ews/issues{/number}","pulls_url":"https://api.github.com/repos/tomoasleep/ews/pulls{/number}","milestones_url":"https://api.github.com/repos/tomoasleep/ews/milestones{/number}","notifications_url":"https://api.github.com/repos/tomoasleep/ews/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tomoasleep/ews/labels{/name}","releases_url":"https://api.github.com/repos/tomoasleep/ews/releases{/id}","created_at":"2015-06-05T09:03:57Z","updated_at":"2015-06-12T10:00:39Z","pushed_at":"2015-06-14T09:31:56Z","git_url":"git://github.com/tomoasleep/ews.git","ssh_url":"git@github.com:tomoasleep/ews.git","clone_url":"https://github.com/tomoasleep/ews.git","svn_url":"https://github.com/tomoasleep/ews","homepage":null,"size":305,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tomoasleep/ews/pulls/4"},"html":{"href":"https://github.com/tomoasleep/ews/pull/4"},"issue":{"href":"https://api.github.com/repos/tomoasleep/ews/issues/4"},"comments":{"href":"https://api.github.com/repos/tomoasleep/ews/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/tomoasleep/ews/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/tomoasleep/ews/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tomoasleep/ews/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/tomoasleep/ews/statuses/487ab806ebfb9e736a0c59c044ed68f77d58625e"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":1,"review_comments":0,"commits":2,"additions":183,"deletions":63,"changed_files":8}}