{"action":"created","comment":{"url":"https://api.github.com/repos/aliang/google_contacts_api/pulls/comments/48520251","id":48520251,"diff_hunk":"@@ -40,5 +40,18 @@ def edit_link\n       _link = self[\"link\"].find { |l| l.rel == \"edit\" }\n       _link ? _link.href : nil\n     end\n+\n+    def self.create(attrs, api)\n+      response = api.post('groups/default/full', xml_for_create(attrs), {}, 'Content-Type' => 'application/atom+xml')\n+      Group.new(Hashie::Mash.new(JSON.parse(response.body)).entry)\n+    end\n+\n+    def self.xml_for_create(group_attrs)\n+      @@new_group_template ||=\n+        File.new(File.dirname(__FILE__) + '/templates/group.xml.erb').read\n+\n+      # Passes in group_attrs to the template via binding\n+      ERB.new(@@new_group_template).result(binding)","path":"lib/google_contacts_api/group.rb","position":15,"original_position":15,"commit_id":"11c3a6857182265aa6217e15ad37de545cf6097c","original_commit_id":"11c3a6857182265aa6217e15ad37de545cf6097c","user":{"login":"aliang","id":162961,"avatar_url":"https://avatars.githubusercontent.com/u/162961?v=3","gravatar_id":"","url":"https://api.github.com/users/aliang","html_url":"https://github.com/aliang","followers_url":"https://api.github.com/users/aliang/followers","following_url":"https://api.github.com/users/aliang/following{/other_user}","gists_url":"https://api.github.com/users/aliang/gists{/gist_id}","starred_url":"https://api.github.com/users/aliang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aliang/subscriptions","organizations_url":"https://api.github.com/users/aliang/orgs","repos_url":"https://api.github.com/users/aliang/repos","events_url":"https://api.github.com/users/aliang/events{/privacy}","received_events_url":"https://api.github.com/users/aliang/received_events","type":"User","site_admin":false},"body":"That having been said, it might be better to use a heredoc to load the template instead of doing a file read.","created_at":"2015-12-29T03:37:47Z","updated_at":"2015-12-29T03:37:47Z","html_url":"https://github.com/aliang/google_contacts_api/pull/15#discussion_r48520251","pull_request_url":"https://api.github.com/repos/aliang/google_contacts_api/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/aliang/google_contacts_api/pulls/comments/48520251"},"html":{"href":"https://github.com/aliang/google_contacts_api/pull/15#discussion_r48520251"},"pull_request":{"href":"https://api.github.com/repos/aliang/google_contacts_api/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/aliang/google_contacts_api/pulls/15","id":49637916,"html_url":"https://github.com/aliang/google_contacts_api/pull/15","diff_url":"https://github.com/aliang/google_contacts_api/pull/15.diff","patch_url":"https://github.com/aliang/google_contacts_api/pull/15.patch","issue_url":"https://api.github.com/repos/aliang/google_contacts_api/issues/15","number":15,"state":"open","locked":false,"title":"Support creation of Google groups","user":{"login":"draffensperger","id":2855507,"avatar_url":"https://avatars.githubusercontent.com/u/2855507?v=3","gravatar_id":"","url":"https://api.github.com/users/draffensperger","html_url":"https://github.com/draffensperger","followers_url":"https://api.github.com/users/draffensperger/followers","following_url":"https://api.github.com/users/draffensperger/following{/other_user}","gists_url":"https://api.github.com/users/draffensperger/gists{/gist_id}","starred_url":"https://api.github.com/users/draffensperger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/draffensperger/subscriptions","organizations_url":"https://api.github.com/users/draffensperger/orgs","repos_url":"https://api.github.com/users/draffensperger/repos","events_url":"https://api.github.com/users/draffensperger/events{/privacy}","received_events_url":"https://api.github.com/users/draffensperger/received_events","type":"User","site_admin":false},"body":"This allows creation of new Google groups, and it also implements the other HTTP methods for the api.","created_at":"2015-11-04T01:37:20Z","updated_at":"2015-12-29T03:37:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d961505c6de146324d5d8b3c310b228ecd91820f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/aliang/google_contacts_api/pulls/15/commits","review_comments_url":"https://api.github.com/repos/aliang/google_contacts_api/pulls/15/comments","review_comment_url":"https://api.github.com/repos/aliang/google_contacts_api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aliang/google_contacts_api/issues/15/comments","statuses_url":"https://api.github.com/repos/aliang/google_contacts_api/statuses/11c3a6857182265aa6217e15ad37de545cf6097c","head":{"label":"draffensperger:group-creation","ref":"group-creation","sha":"11c3a6857182265aa6217e15ad37de545cf6097c","user":{"login":"draffensperger","id":2855507,"avatar_url":"https://avatars.githubusercontent.com/u/2855507?v=3","gravatar_id":"","url":"https://api.github.com/users/draffensperger","html_url":"https://github.com/draffensperger","followers_url":"https://api.github.com/users/draffensperger/followers","following_url":"https://api.github.com/users/draffensperger/following{/other_user}","gists_url":"https://api.github.com/users/draffensperger/gists{/gist_id}","starred_url":"https://api.github.com/users/draffensperger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/draffensperger/subscriptions","organizations_url":"https://api.github.com/users/draffensperger/orgs","repos_url":"https://api.github.com/users/draffensperger/repos","events_url":"https://api.github.com/users/draffensperger/events{/privacy}","received_events_url":"https://api.github.com/users/draffensperger/received_events","type":"User","site_admin":false},"repo":{"id":45504241,"name":"google_contacts_api","full_name":"draffensperger/google_contacts_api","owner":{"login":"draffensperger","id":2855507,"avatar_url":"https://avatars.githubusercontent.com/u/2855507?v=3","gravatar_id":"","url":"https://api.github.com/users/draffensperger","html_url":"https://github.com/draffensperger","followers_url":"https://api.github.com/users/draffensperger/followers","following_url":"https://api.github.com/users/draffensperger/following{/other_user}","gists_url":"https://api.github.com/users/draffensperger/gists{/gist_id}","starred_url":"https://api.github.com/users/draffensperger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/draffensperger/subscriptions","organizations_url":"https://api.github.com/users/draffensperger/orgs","repos_url":"https://api.github.com/users/draffensperger/repos","events_url":"https://api.github.com/users/draffensperger/events{/privacy}","received_events_url":"https://api.github.com/users/draffensperger/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/draffensperger/google_contacts_api","description":"Google Contacts API for ruby, unofficial","fork":true,"url":"https://api.github.com/repos/draffensperger/google_contacts_api","forks_url":"https://api.github.com/repos/draffensperger/google_contacts_api/forks","keys_url":"https://api.github.com/repos/draffensperger/google_contacts_api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/draffensperger/google_contacts_api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/draffensperger/google_contacts_api/teams","hooks_url":"https://api.github.com/repos/draffensperger/google_contacts_api/hooks","issue_events_url":"https://api.github.com/repos/draffensperger/google_contacts_api/issues/events{/number}","events_url":"https://api.github.com/repos/draffensperger/google_contacts_api/events","assignees_url":"https://api.github.com/repos/draffensperger/google_contacts_api/assignees{/user}","branches_url":"https://api.github.com/repos/draffensperger/google_contacts_api/branches{/branch}","tags_url":"https://api.github.com/repos/draffensperger/google_contacts_api/tags","blobs_url":"https://api.github.com/repos/draffensperger/google_contacts_api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/draffensperger/google_contacts_api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/draffensperger/google_contacts_api/git/refs{/sha}","trees_url":"https://api.github.com/repos/draffensperger/google_contacts_api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/draffensperger/google_contacts_api/statuses/{sha}","languages_url":"https://api.github.com/repos/draffensperger/google_contacts_api/languages","stargazers_url":"https://api.github.com/repos/draffensperger/google_contacts_api/stargazers","contributors_url":"https://api.github.com/repos/draffensperger/google_contacts_api/contributors","subscribers_url":"https://api.github.com/repos/draffensperger/google_contacts_api/subscribers","subscription_url":"https://api.github.com/repos/draffensperger/google_contacts_api/subscription","commits_url":"https://api.github.com/repos/draffensperger/google_contacts_api/commits{/sha}","git_commits_url":"https://api.github.com/repos/draffensperger/google_contacts_api/git/commits{/sha}","comments_url":"https://api.github.com/repos/draffensperger/google_contacts_api/comments{/number}","issue_comment_url":"https://api.github.com/repos/draffensperger/google_contacts_api/issues/comments{/number}","contents_url":"https://api.github.com/repos/draffensperger/google_contacts_api/contents/{+path}","compare_url":"https://api.github.com/repos/draffensperger/google_contacts_api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/draffensperger/google_contacts_api/merges","archive_url":"https://api.github.com/repos/draffensperger/google_contacts_api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/draffensperger/google_contacts_api/downloads","issues_url":"https://api.github.com/repos/draffensperger/google_contacts_api/issues{/number}","pulls_url":"https://api.github.com/repos/draffensperger/google_contacts_api/pulls{/number}","milestones_url":"https://api.github.com/repos/draffensperger/google_contacts_api/milestones{/number}","notifications_url":"https://api.github.com/repos/draffensperger/google_contacts_api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/draffensperger/google_contacts_api/labels{/name}","releases_url":"https://api.github.com/repos/draffensperger/google_contacts_api/releases{/id}","created_at":"2015-11-04T00:12:32Z","updated_at":"2015-11-04T00:12:33Z","pushed_at":"2015-11-04T01:35:24Z","git_url":"git://github.com/draffensperger/google_contacts_api.git","ssh_url":"git@github.com:draffensperger/google_contacts_api.git","clone_url":"https://github.com/draffensperger/google_contacts_api.git","svn_url":"https://github.com/draffensperger/google_contacts_api","homepage":"","size":212,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"aliang:master","ref":"master","sha":"d9ca41692800dacd15c0a204050f5ff869ce0c54","user":{"login":"aliang","id":162961,"avatar_url":"https://avatars.githubusercontent.com/u/162961?v=3","gravatar_id":"","url":"https://api.github.com/users/aliang","html_url":"https://github.com/aliang","followers_url":"https://api.github.com/users/aliang/followers","following_url":"https://api.github.com/users/aliang/following{/other_user}","gists_url":"https://api.github.com/users/aliang/gists{/gist_id}","starred_url":"https://api.github.com/users/aliang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aliang/subscriptions","organizations_url":"https://api.github.com/users/aliang/orgs","repos_url":"https://api.github.com/users/aliang/repos","events_url":"https://api.github.com/users/aliang/events{/privacy}","received_events_url":"https://api.github.com/users/aliang/received_events","type":"User","site_admin":false},"repo":{"id":2020858,"name":"google_contacts_api","full_name":"aliang/google_contacts_api","owner":{"login":"aliang","id":162961,"avatar_url":"https://avatars.githubusercontent.com/u/162961?v=3","gravatar_id":"","url":"https://api.github.com/users/aliang","html_url":"https://github.com/aliang","followers_url":"https://api.github.com/users/aliang/followers","following_url":"https://api.github.com/users/aliang/following{/other_user}","gists_url":"https://api.github.com/users/aliang/gists{/gist_id}","starred_url":"https://api.github.com/users/aliang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aliang/subscriptions","organizations_url":"https://api.github.com/users/aliang/orgs","repos_url":"https://api.github.com/users/aliang/repos","events_url":"https://api.github.com/users/aliang/events{/privacy}","received_events_url":"https://api.github.com/users/aliang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aliang/google_contacts_api","description":"Google Contacts API for ruby, unofficial","fork":false,"url":"https://api.github.com/repos/aliang/google_contacts_api","forks_url":"https://api.github.com/repos/aliang/google_contacts_api/forks","keys_url":"https://api.github.com/repos/aliang/google_contacts_api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aliang/google_contacts_api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aliang/google_contacts_api/teams","hooks_url":"https://api.github.com/repos/aliang/google_contacts_api/hooks","issue_events_url":"https://api.github.com/repos/aliang/google_contacts_api/issues/events{/number}","events_url":"https://api.github.com/repos/aliang/google_contacts_api/events","assignees_url":"https://api.github.com/repos/aliang/google_contacts_api/assignees{/user}","branches_url":"https://api.github.com/repos/aliang/google_contacts_api/branches{/branch}","tags_url":"https://api.github.com/repos/aliang/google_contacts_api/tags","blobs_url":"https://api.github.com/repos/aliang/google_contacts_api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aliang/google_contacts_api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aliang/google_contacts_api/git/refs{/sha}","trees_url":"https://api.github.com/repos/aliang/google_contacts_api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aliang/google_contacts_api/statuses/{sha}","languages_url":"https://api.github.com/repos/aliang/google_contacts_api/languages","stargazers_url":"https://api.github.com/repos/aliang/google_contacts_api/stargazers","contributors_url":"https://api.github.com/repos/aliang/google_contacts_api/contributors","subscribers_url":"https://api.github.com/repos/aliang/google_contacts_api/subscribers","subscription_url":"https://api.github.com/repos/aliang/google_contacts_api/subscription","commits_url":"https://api.github.com/repos/aliang/google_contacts_api/commits{/sha}","git_commits_url":"https://api.github.com/repos/aliang/google_contacts_api/git/commits{/sha}","comments_url":"https://api.github.com/repos/aliang/google_contacts_api/comments{/number}","issue_comment_url":"https://api.github.com/repos/aliang/google_contacts_api/issues/comments{/number}","contents_url":"https://api.github.com/repos/aliang/google_contacts_api/contents/{+path}","compare_url":"https://api.github.com/repos/aliang/google_contacts_api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aliang/google_contacts_api/merges","archive_url":"https://api.github.com/repos/aliang/google_contacts_api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aliang/google_contacts_api/downloads","issues_url":"https://api.github.com/repos/aliang/google_contacts_api/issues{/number}","pulls_url":"https://api.github.com/repos/aliang/google_contacts_api/pulls{/number}","milestones_url":"https://api.github.com/repos/aliang/google_contacts_api/milestones{/number}","notifications_url":"https://api.github.com/repos/aliang/google_contacts_api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aliang/google_contacts_api/labels{/name}","releases_url":"https://api.github.com/repos/aliang/google_contacts_api/releases{/id}","created_at":"2011-07-09T01:51:59Z","updated_at":"2015-12-28T10:35:36Z","pushed_at":"2015-12-28T11:05:22Z","git_url":"git://github.com/aliang/google_contacts_api.git","ssh_url":"git@github.com:aliang/google_contacts_api.git","clone_url":"https://github.com/aliang/google_contacts_api.git","svn_url":"https://github.com/aliang/google_contacts_api","homepage":"","size":672,"stargazers_count":35,"watchers_count":35,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":9,"forks":18,"open_issues":9,"watchers":35,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/aliang/google_contacts_api/pulls/15"},"html":{"href":"https://github.com/aliang/google_contacts_api/pull/15"},"issue":{"href":"https://api.github.com/repos/aliang/google_contacts_api/issues/15"},"comments":{"href":"https://api.github.com/repos/aliang/google_contacts_api/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/aliang/google_contacts_api/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/aliang/google_contacts_api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aliang/google_contacts_api/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/aliang/google_contacts_api/statuses/11c3a6857182265aa6217e15ad37de545cf6097c"}}}}