GitHub PullRequestReviewCommentEvent at 2014-06-23 16:38:34
Repository: alaveteli
Actor: houndci
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/mysociety/alaveteli/pulls/comments/14084939","id":14084939,"diff_hunk":"@@ -75,311 +91,432 @@\n         new_request.info_request_events[0].event_type.should == 'sent'\n         new_request.info_request_events[0].calculated_state.should == 'waiting_response'\n     end\n-\n-    def _create_request\n-        post :create_request,\n-            :k => public_bodies(:geraldine_public_body).api_key,\n-            :request_json => {\n-                \"title\" => \"Tell me about your chickens\",\n-                \"body\" => \"Dear Sir,\\n\\nI should like to know about your chickens.\\n\\nYours in faith,\\nBob\\n\",\n-\n-                \"external_url\" => \"http://www.example.gov.uk/foi/chickens_23\",\n-                \"external_user_name\" => \"Bob Smith\",\n-            }.to_json\n-        response.content_type.should == \"application/json\"\n-        return ActiveSupport::JSON.decode(response.body)[\"id\"]\n     end\n \n-    it \"should add a response to a request\" do\n-        # First we need an external request\n-        request_id = info_requests(:external_request).id\n-\n-        # Initially it has no incoming messages\n-        IncomingMessage.count(:conditions => [\"info_request_id = ?\", request_id]).should == 0\n-\n-        # Now add one\n-        sent_at = \"2012-05-28T12:35:39+01:00\"\n-        response_body = \"Thank you for your request for information, which we are handling in accordance with the Freedom of Information Act 2000. You will receive a response within 20 working days or before the next full moon, whichever is sooner.\\n\\nYours sincerely,\\nJohn Gandermulch,\\nExample Council FOI Officer\\n\"\n-        post :add_correspondence,\n-            :k => public_bodies(:geraldine_public_body).api_key,\n-            :id => request_id,\n-            :correspondence_json => {\n-                \"direction\" => \"response\",\n-                \"sent_at\" => sent_at,\n-                \"body\" => response_body\n-            }.to_json\n-\n-        # And make sure it worked\n-        response.should be_success\n-        incoming_messages = IncomingMessage.all(:conditions => [\"info_request_id = ?\", request_id])\n-        incoming_messages.count.should == 1\n-        incoming_message = incoming_messages[0]\n-\n-        incoming_message.sent_at.should == Time.iso8601(sent_at)\n-        incoming_message.get_main_body_text_folded.should be_equal_modulo_whitespace_to(response_body)\n-    end\n+    # POST /api/v2/request/:id/add_correspondence.json\n+    describe 'adding a response to a request' do\n+      it \"should add a response to a request\" do\n+          # First we need an external request\n+          request_id = info_requests(:external_request).id","path":"spec/controllers/api_controller_spec.rb","position":76,"original_position":76,"commit_id":"9759016c5fe6cd00fe594b2251d020d06426d673","original_commit_id":"9759016c5fe6cd00fe594b2251d020d06426d673","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?","gravatar_id":"38d9cefd9971a05bf447f07c6cd332cc","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Use 2 (not 4) spaces for indentation.","created_at":"2014-06-23T16:38:34Z","updated_at":"2014-06-23T16:38:34Z","html_url":"https://github.com/mysociety/alaveteli/pull/1631#discussion_r14084939","pull_request_url":"https://api.github.com/repos/mysociety/alaveteli/pulls/1631","_links":{"self":{"href":"https://api.github.com/repos/mysociety/alaveteli/pulls/comments/14084939"},"html":{"href":"https://github.com/mysociety/alaveteli/pull/1631#discussion_r14084939"},"pull_request":{"href":"https://api.github.com/repos/mysociety/alaveteli/pulls/1631"}}},"pull_request":{"url":"https://api.github.com/repos/mysociety/alaveteli/pulls/1631","id":17484753,"html_url":"https://github.com/mysociety/alaveteli/pull/1631","diff_url":"https://github.com/mysociety/alaveteli/pull/1631.diff","patch_url":"https://github.com/mysociety/alaveteli/pull/1631.patch","issue_url":"https://api.github.com/repos/mysociety/alaveteli/issues/1631","number":1631,"state":"open","title":"Add request state updating functionality to API","user":{"login":"lizconlan","id":27760,"avatar_url":"https://avatars.githubusercontent.com/u/27760?","gravatar_id":"f943610b98a484c0e703a1567cad8d4d","url":"https://api.github.com/users/lizconlan","html_url":"https://github.com/lizconlan","followers_url":"https://api.github.com/users/lizconlan/followers","following_url":"https://api.github.com/users/lizconlan/following{/other_user}","gists_url":"https://api.github.com/users/lizconlan/gists{/gist_id}","starred_url":"https://api.github.com/users/lizconlan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lizconlan/subscriptions","organizations_url":"https://api.github.com/users/lizconlan/orgs","repos_url":"https://api.github.com/users/lizconlan/repos","events_url":"https://api.github.com/users/lizconlan/events{/privacy}","received_events_url":"https://api.github.com/users/lizconlan/received_events","type":"User","site_admin":false},"body":"WIP\r\n\r\nAdds a new `update_state` method to the API that uses the existing API key mechanism to send a status update to a request created via an external API request. Intended usage - foi-register end-users confirming whether the information they requested has been disclosed ([the parallel work on foi-register can be found here](https://github.com/mysociety/foi-register/tree/issues/169-ask-user-to-confirm-request-state)). Status description mismatches should be handled on the foi-register side but unexpected status values are rejected with a 500 error by the API.\r\n\r\nAdds an optional parameter to the pre-existing `add_correspondence` API method to allow it to update status (intended use - updates from a public body) if a `state` value is supplied. Again, the foi-register code is responsible for handling state description mismatches but in this case the API deals with erroneous data by ignoring that part of the request.\r\n\r\nApologies for having restructured `api_controller_spec` but I kept losing track of which API methods the various tests were targeting. I will be happy to change it back before finalising the Pull Request if I've caused trouble.","created_at":"2014-06-23T16:37:59Z","updated_at":"2014-06-23T16:38:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e1d0ff00aae29aaa6a1118102bdcd6dc8acd90c9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mysociety/alaveteli/pulls/1631/commits","review_comments_url":"https://api.github.com/repos/mysociety/alaveteli/pulls/1631/comments","review_comment_url":"https://api.github.com/repos/mysociety/alaveteli/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mysociety/alaveteli/issues/1631/comments","statuses_url":"https://api.github.com/repos/mysociety/alaveteli/statuses/9759016c5fe6cd00fe594b2251d020d06426d673","head":{"label":"mysociety:issues/1418-update-described-state-via-api","ref":"issues/1418-update-described-state-via-api","sha":"9759016c5fe6cd00fe594b2251d020d06426d673","user":{"login":"mysociety","id":141338,"avatar_url":"https://avatars.githubusercontent.com/u/141338?","gravatar_id":"cb4e9c9ec6d33ee844baa03bd8f58cd3","url":"https://api.github.com/users/mysociety","html_url":"https://github.com/mysociety","followers_url":"https://api.github.com/users/mysociety/followers","following_url":"https://api.github.com/users/mysociety/following{/other_user}","gists_url":"https://api.github.com/users/mysociety/gists{/gist_id}","starred_url":"https://api.github.com/users/mysociety/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mysociety/subscriptions","organizations_url":"https://api.github.com/users/mysociety/orgs","repos_url":"https://api.github.com/users/mysociety/repos","events_url":"https://api.github.com/users/mysociety/events{/privacy}","received_events_url":"https://api.github.com/users/mysociety/received_events","type":"Organization","site_admin":false},"repo":{"id":1125389,"name":"alaveteli","full_name":"mysociety/alaveteli","owner":{"login":"mysociety","id":141338,"avatar_url":"https://avatars.githubusercontent.com/u/141338?","gravatar_id":"cb4e9c9ec6d33ee844baa03bd8f58cd3","url":"https://api.github.com/users/mysociety","html_url":"https://github.com/mysociety","followers_url":"https://api.github.com/users/mysociety/followers","following_url":"https://api.github.com/users/mysociety/following{/other_user}","gists_url":"https://api.github.com/users/mysociety/gists{/gist_id}","starred_url":"https://api.github.com/users/mysociety/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mysociety/subscriptions","organizations_url":"https://api.github.com/users/mysociety/orgs","repos_url":"https://api.github.com/users/mysociety/repos","events_url":"https://api.github.com/users/mysociety/events{/privacy}","received_events_url":"https://api.github.com/users/mysociety/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mysociety/alaveteli","description":"Provide a Freedom of Information request system for your jurisdiction","fork":false,"url":"https://api.github.com/repos/mysociety/alaveteli","forks_url":"https://api.github.com/repos/mysociety/alaveteli/forks","keys_url":"https://api.github.com/repos/mysociety/alaveteli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mysociety/alaveteli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mysociety/alaveteli/teams","hooks_url":"https://api.github.com/repos/mysociety/alaveteli/hooks","issue_events_url":"https://api.github.com/repos/mysociety/alaveteli/issues/events{/number}","events_url":"https://api.github.com/repos/mysociety/alaveteli/events","assignees_url":"https://api.github.com/repos/mysociety/alaveteli/assignees{/user}","branches_url":"https://api.github.com/repos/mysociety/alaveteli/branches{/branch}","tags_url":"https://api.github.com/repos/mysociety/alaveteli/tags","blobs_url":"https://api.github.com/repos/mysociety/alaveteli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mysociety/alaveteli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mysociety/alaveteli/git/refs{/sha}","trees_url":"https://api.github.com/repos/mysociety/alaveteli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mysociety/alaveteli/statuses/{sha}","languages_url":"https://api.github.com/repos/mysociety/alaveteli/languages","stargazers_url":"https://api.github.com/repos/mysociety/alaveteli/stargazers","contributors_url":"https://api.github.com/repos/mysociety/alaveteli/contributors","subscribers_url":"https://api.github.com/repos/mysociety/alaveteli/subscribers","subscription_url":"https://api.github.com/repos/mysociety/alaveteli/subscription","commits_url":"https://api.github.com/repos/mysociety/alaveteli/commits{/sha}","git_commits_url":"https://api.github.com/repos/mysociety/alaveteli/git/commits{/sha}","comments_url":"https://api.github.com/repos/mysociety/alaveteli/comments{/number}","issue_comment_url":"https://api.github.com/repos/mysociety/alaveteli/issues/comments/{number}","contents_url":"https://api.github.com/repos/mysociety/alaveteli/contents/{+path}","compare_url":"https://api.github.com/repos/mysociety/alaveteli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mysociety/alaveteli/merges","archive_url":"https://api.github.com/repos/mysociety/alaveteli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mysociety/alaveteli/downloads","issues_url":"https://api.github.com/repos/mysociety/alaveteli/issues{/number}","pulls_url":"https://api.github.com/repos/mysociety/alaveteli/pulls{/number}","milestones_url":"https://api.github.com/repos/mysociety/alaveteli/milestones{/number}","notifications_url":"https://api.github.com/repos/mysociety/alaveteli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mysociety/alaveteli/labels{/name}","releases_url":"https://api.github.com/repos/mysociety/alaveteli/releases{/id}","created_at":"2010-11-30T13:11:39Z","updated_at":"2014-06-23T16:37:59Z","pushed_at":"2014-06-23T16:36:01Z","git_url":"git://github.com/mysociety/alaveteli.git","ssh_url":"git@github.com:mysociety/alaveteli.git","clone_url":"https://github.com/mysociety/alaveteli.git","svn_url":"https://github.com/mysociety/alaveteli","homepage":"http://alaveteli.org","size":79215,"stargazers_count":119,"watchers_count":119,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":76,"mirror_url":null,"open_issues_count":406,"forks":76,"open_issues":406,"watchers":119,"default_branch":"rails-3-develop"}},"base":{"label":"mysociety:rails-3-develop","ref":"rails-3-develop","sha":"52dd9cbd5c280695a11bb6de467359f7cbb58d5f","user":{"login":"mysociety","id":141338,"avatar_url":"https://avatars.githubusercontent.com/u/141338?","gravatar_id":"cb4e9c9ec6d33ee844baa03bd8f58cd3","url":"https://api.github.com/users/mysociety","html_url":"https://github.com/mysociety","followers_url":"https://api.github.com/users/mysociety/followers","following_url":"https://api.github.com/users/mysociety/following{/other_user}","gists_url":"https://api.github.com/users/mysociety/gists{/gist_id}","starred_url":"https://api.github.com/users/mysociety/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mysociety/subscriptions","organizations_url":"https://api.github.com/users/mysociety/orgs","repos_url":"https://api.github.com/users/mysociety/repos","events_url":"https://api.github.com/users/mysociety/events{/privacy}","received_events_url":"https://api.github.com/users/mysociety/received_events","type":"Organization","site_admin":false},"repo":{"id":1125389,"name":"alaveteli","full_name":"mysociety/alaveteli","owner":{"login":"mysociety","id":141338,"avatar_url":"https://avatars.githubusercontent.com/u/141338?","gravatar_id":"cb4e9c9ec6d33ee844baa03bd8f58cd3","url":"https://api.github.com/users/mysociety","html_url":"https://github.com/mysociety","followers_url":"https://api.github.com/users/mysociety/followers","following_url":"https://api.github.com/users/mysociety/following{/other_user}","gists_url":"https://api.github.com/users/mysociety/gists{/gist_id}","starred_url":"https://api.github.com/users/mysociety/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mysociety/subscriptions","organizations_url":"https://api.github.com/users/mysociety/orgs","repos_url":"https://api.github.com/users/mysociety/repos","events_url":"https://api.github.com/users/mysociety/events{/privacy}","received_events_url":"https://api.github.com/users/mysociety/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mysociety/alaveteli","description":"Provide a Freedom of Information request system for your jurisdiction","fork":false,"url":"https://api.github.com/repos/mysociety/alaveteli","forks_url":"https://api.github.com/repos/mysociety/alaveteli/forks","keys_url":"https://api.github.com/repos/mysociety/alaveteli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mysociety/alaveteli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mysociety/alaveteli/teams","hooks_url":"https://api.github.com/repos/mysociety/alaveteli/hooks","issue_events_url":"https://api.github.com/repos/mysociety/alaveteli/issues/events{/number}","events_url":"https://api.github.com/repos/mysociety/alaveteli/events","assignees_url":"https://api.github.com/repos/mysociety/alaveteli/assignees{/user}","branches_url":"https://api.github.com/repos/mysociety/alaveteli/branches{/branch}","tags_url":"https://api.github.com/repos/mysociety/alaveteli/tags","blobs_url":"https://api.github.com/repos/mysociety/alaveteli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mysociety/alaveteli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mysociety/alaveteli/git/refs{/sha}","trees_url":"https://api.github.com/repos/mysociety/alaveteli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mysociety/alaveteli/statuses/{sha}","languages_url":"https://api.github.com/repos/mysociety/alaveteli/languages","stargazers_url":"https://api.github.com/repos/mysociety/alaveteli/stargazers","contributors_url":"https://api.github.com/repos/mysociety/alaveteli/contributors","subscribers_url":"https://api.github.com/repos/mysociety/alaveteli/subscribers","subscription_url":"https://api.github.com/repos/mysociety/alaveteli/subscription","commits_url":"https://api.github.com/repos/mysociety/alaveteli/commits{/sha}","git_commits_url":"https://api.github.com/repos/mysociety/alaveteli/git/commits{/sha}","comments_url":"https://api.github.com/repos/mysociety/alaveteli/comments{/number}","issue_comment_url":"https://api.github.com/repos/mysociety/alaveteli/issues/comments/{number}","contents_url":"https://api.github.com/repos/mysociety/alaveteli/contents/{+path}","compare_url":"https://api.github.com/repos/mysociety/alaveteli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mysociety/alaveteli/merges","archive_url":"https://api.github.com/repos/mysociety/alaveteli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mysociety/alaveteli/downloads","issues_url":"https://api.github.com/repos/mysociety/alaveteli/issues{/number}","pulls_url":"https://api.github.com/repos/mysociety/alaveteli/pulls{/number}","milestones_url":"https://api.github.com/repos/mysociety/alaveteli/milestones{/number}","notifications_url":"https://api.github.com/repos/mysociety/alaveteli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mysociety/alaveteli/labels{/name}","releases_url":"https://api.github.com/repos/mysociety/alaveteli/releases{/id}","created_at":"2010-11-30T13:11:39Z","updated_at":"2014-06-23T16:37:59Z","pushed_at":"2014-06-23T16:36:01Z","git_url":"git://github.com/mysociety/alaveteli.git","ssh_url":"git@github.com:mysociety/alaveteli.git","clone_url":"https://github.com/mysociety/alaveteli.git","svn_url":"https://github.com/mysociety/alaveteli","homepage":"http://alaveteli.org","size":79215,"stargazers_count":119,"watchers_count":119,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":76,"mirror_url":null,"open_issues_count":406,"forks":76,"open_issues":406,"watchers":119,"default_branch":"rails-3-develop"}},"_links":{"self":{"href":"https://api.github.com/repos/mysociety/alaveteli/pulls/1631"},"html":{"href":"https://github.com/mysociety/alaveteli/pull/1631"},"issue":{"href":"https://api.github.com/repos/mysociety/alaveteli/issues/1631"},"comments":{"href":"https://api.github.com/repos/mysociety/alaveteli/issues/1631/comments"},"review_comments":{"href":"https://api.github.com/repos/mysociety/alaveteli/pulls/1631/comments"},"review_comment":{"href":"https://api.github.com/repos/mysociety/alaveteli/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mysociety/alaveteli/pulls/1631/commits"},"statuses":{"href":"https://api.github.com/repos/mysociety/alaveteli/statuses/9759016c5fe6cd00fe594b2251d020d06426d673"}}}}