GitHub PullRequestEvent at 2014-11-25 01:09:05
Repository: mcapi2-ruby-examples
Actor: hwhelchel
Payload: {"action":"closed","number":6,"pull_request":{"url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/pulls/6","id":14981328,"html_url":"https://github.com/mailchimp/mcapi2-ruby-examples/pull/6","diff_url":"https://github.com/mailchimp/mcapi2-ruby-examples/pull/6.diff","patch_url":"https://github.com/mailchimp/mcapi2-ruby-examples/pull/6.patch","issue_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/issues/6","number":6,"state":"closed","locked":false,"title":"Refactor error rescue blocks","user":{"login":"hwhelchel","id":4792375,"avatar_url":"https://avatars.githubusercontent.com/u/4792375?v=3","gravatar_id":"","url":"https://api.github.com/users/hwhelchel","html_url":"https://github.com/hwhelchel","followers_url":"https://api.github.com/users/hwhelchel/followers","following_url":"https://api.github.com/users/hwhelchel/following{/other_user}","gists_url":"https://api.github.com/users/hwhelchel/gists{/gist_id}","starred_url":"https://api.github.com/users/hwhelchel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hwhelchel/subscriptions","organizations_url":"https://api.github.com/users/hwhelchel/orgs","repos_url":"https://api.github.com/users/hwhelchel/repos","events_url":"https://api.github.com/users/hwhelchel/events{/privacy}","received_events_url":"https://api.github.com/users/hwhelchel/received_events","type":"User","site_admin":false},"body":"This pull request provides suggestions on refactoring the controller actions to extract the error rescue logic and thereby making it easier for the user to focus on the API calls being demonstrated.\r\n\r\nUsing the Rails rescue_from controller method I extracted the error rescue login into controller helper methods.\r\nThis solution relied on using redirect_to :back in the helper methods. This method is difficult to test so I wrapped it in a method called redirect_to_back_or_default which permitted me to run tests without having to stub the HTTP referrer in the ENV variable.\r\n\r\nAlso as a minor change I renamed the actions for returning a single resource from view to show following Rails convention.","created_at":"2014-04-21T19:59:33Z","updated_at":"2014-11-25T01:09:05Z","closed_at":"2014-11-25T01:09:05Z","merged_at":null,"merge_commit_sha":"50c011d9c1bf7ccceb396fc9ef44641d8d2be17c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/pulls/6/commits","review_comments_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/pulls/6/comments","review_comment_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/issues/6/comments","statuses_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/statuses/6f5572d5bc93d19f97bf76b0120d7261fc057de4","head":{"label":"hwhelchel:refactor-error-rescue-blocks","ref":"refactor-error-rescue-blocks","sha":"6f5572d5bc93d19f97bf76b0120d7261fc057de4","user":{"login":"hwhelchel","id":4792375,"avatar_url":"https://avatars.githubusercontent.com/u/4792375?v=3","gravatar_id":"","url":"https://api.github.com/users/hwhelchel","html_url":"https://github.com/hwhelchel","followers_url":"https://api.github.com/users/hwhelchel/followers","following_url":"https://api.github.com/users/hwhelchel/following{/other_user}","gists_url":"https://api.github.com/users/hwhelchel/gists{/gist_id}","starred_url":"https://api.github.com/users/hwhelchel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hwhelchel/subscriptions","organizations_url":"https://api.github.com/users/hwhelchel/orgs","repos_url":"https://api.github.com/users/hwhelchel/repos","events_url":"https://api.github.com/users/hwhelchel/events{/privacy}","received_events_url":"https://api.github.com/users/hwhelchel/received_events","type":"User","site_admin":false},"repo":{"id":18578248,"name":"mcapi2-ruby-examples","full_name":"hwhelchel/mcapi2-ruby-examples","owner":{"login":"hwhelchel","id":4792375,"avatar_url":"https://avatars.githubusercontent.com/u/4792375?v=3","gravatar_id":"","url":"https://api.github.com/users/hwhelchel","html_url":"https://github.com/hwhelchel","followers_url":"https://api.github.com/users/hwhelchel/followers","following_url":"https://api.github.com/users/hwhelchel/following{/other_user}","gists_url":"https://api.github.com/users/hwhelchel/gists{/gist_id}","starred_url":"https://api.github.com/users/hwhelchel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hwhelchel/subscriptions","organizations_url":"https://api.github.com/users/hwhelchel/orgs","repos_url":"https://api.github.com/users/hwhelchel/repos","events_url":"https://api.github.com/users/hwhelchel/events{/privacy}","received_events_url":"https://api.github.com/users/hwhelchel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hwhelchel/mcapi2-ruby-examples","description":"Basic Ruby examples using v2 of the MailChimp API","fork":true,"url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples","forks_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/forks","keys_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/teams","hooks_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/hooks","issue_events_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/issues/events{/number}","events_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/events","assignees_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/assignees{/user}","branches_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/branches{/branch}","tags_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/tags","blobs_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/git/refs{/sha}","trees_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/statuses/{sha}","languages_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/languages","stargazers_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/stargazers","contributors_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/contributors","subscribers_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/subscribers","subscription_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/subscription","commits_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/commits{/sha}","git_commits_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/git/commits{/sha}","comments_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/comments{/number}","issue_comment_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/issues/comments/{number}","contents_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/contents/{+path}","compare_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/merges","archive_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/downloads","issues_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/issues{/number}","pulls_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/pulls{/number}","milestones_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/milestones{/number}","notifications_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/labels{/name}","releases_url":"https://api.github.com/repos/hwhelchel/mcapi2-ruby-examples/releases{/id}","created_at":"2014-04-08T23:15:55Z","updated_at":"2014-04-21T19:59:33Z","pushed_at":"2014-04-21T19:57:21Z","git_url":"git://github.com/hwhelchel/mcapi2-ruby-examples.git","ssh_url":"git@github.com:hwhelchel/mcapi2-ruby-examples.git","clone_url":"https://github.com/hwhelchel/mcapi2-ruby-examples.git","svn_url":"https://github.com/hwhelchel/mcapi2-ruby-examples","homepage":null,"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":"mailchimp:master","ref":"master","sha":"18deb517248edbcec4a6e000dbb776eadbbae570","user":{"login":"mailchimp","id":216758,"avatar_url":"https://avatars.githubusercontent.com/u/216758?v=3","gravatar_id":"","url":"https://api.github.com/users/mailchimp","html_url":"https://github.com/mailchimp","followers_url":"https://api.github.com/users/mailchimp/followers","following_url":"https://api.github.com/users/mailchimp/following{/other_user}","gists_url":"https://api.github.com/users/mailchimp/gists{/gist_id}","starred_url":"https://api.github.com/users/mailchimp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mailchimp/subscriptions","organizations_url":"https://api.github.com/users/mailchimp/orgs","repos_url":"https://api.github.com/users/mailchimp/repos","events_url":"https://api.github.com/users/mailchimp/events{/privacy}","received_events_url":"https://api.github.com/users/mailchimp/received_events","type":"Organization","site_admin":false},"repo":{"id":12246404,"name":"mcapi2-ruby-examples","full_name":"mailchimp/mcapi2-ruby-examples","owner":{"login":"mailchimp","id":216758,"avatar_url":"https://avatars.githubusercontent.com/u/216758?v=3","gravatar_id":"","url":"https://api.github.com/users/mailchimp","html_url":"https://github.com/mailchimp","followers_url":"https://api.github.com/users/mailchimp/followers","following_url":"https://api.github.com/users/mailchimp/following{/other_user}","gists_url":"https://api.github.com/users/mailchimp/gists{/gist_id}","starred_url":"https://api.github.com/users/mailchimp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mailchimp/subscriptions","organizations_url":"https://api.github.com/users/mailchimp/orgs","repos_url":"https://api.github.com/users/mailchimp/repos","events_url":"https://api.github.com/users/mailchimp/events{/privacy}","received_events_url":"https://api.github.com/users/mailchimp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mailchimp/mcapi2-ruby-examples","description":"Basic Ruby examples using v2 of the MailChimp API","fork":false,"url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples","forks_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/forks","keys_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/teams","hooks_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/hooks","issue_events_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/issues/events{/number}","events_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/events","assignees_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/assignees{/user}","branches_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/branches{/branch}","tags_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/tags","blobs_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/git/refs{/sha}","trees_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/statuses/{sha}","languages_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/languages","stargazers_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/stargazers","contributors_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/contributors","subscribers_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/subscribers","subscription_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/subscription","commits_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/commits{/sha}","git_commits_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/git/commits{/sha}","comments_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/comments{/number}","issue_comment_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/issues/comments/{number}","contents_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/contents/{+path}","compare_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/merges","archive_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/downloads","issues_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/issues{/number}","pulls_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/pulls{/number}","milestones_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/milestones{/number}","notifications_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/labels{/name}","releases_url":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/releases{/id}","created_at":"2013-08-20T15:18:24Z","updated_at":"2014-10-18T17:03:15Z","pushed_at":"2013-08-23T09:23:33Z","git_url":"git://github.com/mailchimp/mcapi2-ruby-examples.git","ssh_url":"git@github.com:mailchimp/mcapi2-ruby-examples.git","clone_url":"https://github.com/mailchimp/mcapi2-ruby-examples.git","svn_url":"https://github.com/mailchimp/mcapi2-ruby-examples","homepage":null,"size":104,"stargazers_count":25,"watchers_count":25,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":1,"forks":17,"open_issues":1,"watchers":25,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/pulls/6"},"html":{"href":"https://github.com/mailchimp/mcapi2-ruby-examples/pull/6"},"issue":{"href":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/issues/6"},"comments":{"href":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/mailchimp/mcapi2-ruby-examples/statuses/6f5572d5bc93d19f97bf76b0120d7261fc057de4"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":1,"review_comments":0,"commits":9,"additions":446,"deletions":85,"changed_files":15}}