{"action":"created","comment":{"url":"https://api.github.com/repos/alphagov/smart-answers/pulls/comments/86324402","pull_request_review_id":6987126,"id":86324402,"diff_hunk":"@@ -13,20 +13,21 @@ def self.reset_cache\n \n   def self.all\n     cache_fetch(\"all\") do\n-      world_locations = Services.worldwide_api.world_locations.with_subsequent_pages.map do |l|\n-        new(l) if l.format == \"World location\" && l.details && l.details.slug.present?\n+      world_locations = Services.worldwide_api.world_locations.with_subsequent_pages.map do |response|\n+        location = Location.new(response.to_hash)\n+        if location.format == \"World location\" && location.details &&\n+            location.slug.present?\n+          self.new(location)\n+        end\n       end\n       world_locations.compact\n     end\n   end\n \n   def self.find(location_slug)\n     cache_fetch(\"find_#{location_slug}\") do","path":"app/models/world_location.rb","position":26,"original_position":18,"commit_id":"de79a8293047265cd818aa10ef1e39a7f1a37130","original_commit_id":"2000fa62239be1dec0d5b68c06b502f3bb616b97","user":{"login":"pmanrubia","id":227328,"avatar_url":"https://avatars.githubusercontent.com/u/227328?v=3","gravatar_id":"","url":"https://api.github.com/users/pmanrubia","html_url":"https://github.com/pmanrubia","followers_url":"https://api.github.com/users/pmanrubia/followers","following_url":"https://api.github.com/users/pmanrubia/following{/other_user}","gists_url":"https://api.github.com/users/pmanrubia/gists{/gist_id}","starred_url":"https://api.github.com/users/pmanrubia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmanrubia/subscriptions","organizations_url":"https://api.github.com/users/pmanrubia/orgs","repos_url":"https://api.github.com/users/pmanrubia/repos","events_url":"https://api.github.com/users/pmanrubia/events{/privacy}","received_events_url":"https://api.github.com/users/pmanrubia/received_events","type":"User","site_admin":false},"body":"@ikennaokpala did you have a look at this cache?\r\n","created_at":"2016-11-03T11:32:21Z","updated_at":"2016-11-03T11:32:21Z","html_url":"https://github.com/alphagov/smart-answers/pull/2797#discussion_r86324402","pull_request_url":"https://api.github.com/repos/alphagov/smart-answers/pulls/2797","_links":{"self":{"href":"https://api.github.com/repos/alphagov/smart-answers/pulls/comments/86324402"},"html":{"href":"https://github.com/alphagov/smart-answers/pull/2797#discussion_r86324402"},"pull_request":{"href":"https://api.github.com/repos/alphagov/smart-answers/pulls/2797"}}},"pull_request":{"url":"https://api.github.com/repos/alphagov/smart-answers/pulls/2797","id":90788474,"html_url":"https://github.com/alphagov/smart-answers/pull/2797","diff_url":"https://github.com/alphagov/smart-answers/pull/2797.diff","patch_url":"https://github.com/alphagov/smart-answers/pull/2797.patch","issue_url":"https://api.github.com/repos/alphagov/smart-answers/issues/2797","number":2797,"state":"open","locked":false,"title":"Refactor consumption of API response via gds-api-adapter gem","user":{"login":"ikennaokpala","id":84896,"avatar_url":"https://avatars.githubusercontent.com/u/84896?v=3","gravatar_id":"","url":"https://api.github.com/users/ikennaokpala","html_url":"https://github.com/ikennaokpala","followers_url":"https://api.github.com/users/ikennaokpala/followers","following_url":"https://api.github.com/users/ikennaokpala/following{/other_user}","gists_url":"https://api.github.com/users/ikennaokpala/gists{/gist_id}","starred_url":"https://api.github.com/users/ikennaokpala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ikennaokpala/subscriptions","organizations_url":"https://api.github.com/users/ikennaokpala/orgs","repos_url":"https://api.github.com/users/ikennaokpala/repos","events_url":"https://api.github.com/users/ikennaokpala/events{/privacy}","received_events_url":"https://api.github.com/users/ikennaokpala/received_events","type":"User","site_admin":false},"body":"Related to #2761\r\n\r\n[Trello card](https://trello.com/c/Gduv7tZL/355-upgrade-gds-adapters-to-latest-version-in-smart-answers)\r\n\r\n\r\n## Why? \r\n\r\nThe reason for these changes is to reduce the occurrence of error-prone nil response from OpenStruct objects that were previously returned by the gds-api-adapters. OpenStruct returns nil even when an attribute doesn’t exist by default, which is confusing and error-prone (and makes the code more complicated to debug).\r\n\r\n## Description\r\n\r\nThis PR makes changes to the following api calls: \r\n- worldwide_api\r\n- imminence_api\r\n\r\nChanges made within affect:\r\n- mainly how the response is consumed. \r\n- a few cosmetic changes (mostly renaming for clarity)\r\n- fix of lint errors \r\n- regression artefacts\r\n\r\n**NB:**\r\nPreviously a response object was actually returned (pre gds-api-adapter changes 37.x.x ). Following the recent changes, response are returned as hashes (with the help of the new to_hash message).\r\n","created_at":"2016-10-25T11:28:08Z","updated_at":"2016-11-03T11:32:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1421e9d25e278aad4c27712a7d0f86f4719f61d3","assignee":{"login":"pmanrubia","id":227328,"avatar_url":"https://avatars.githubusercontent.com/u/227328?v=3","gravatar_id":"","url":"https://api.github.com/users/pmanrubia","html_url":"https://github.com/pmanrubia","followers_url":"https://api.github.com/users/pmanrubia/followers","following_url":"https://api.github.com/users/pmanrubia/following{/other_user}","gists_url":"https://api.github.com/users/pmanrubia/gists{/gist_id}","starred_url":"https://api.github.com/users/pmanrubia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmanrubia/subscriptions","organizations_url":"https://api.github.com/users/pmanrubia/orgs","repos_url":"https://api.github.com/users/pmanrubia/repos","events_url":"https://api.github.com/users/pmanrubia/events{/privacy}","received_events_url":"https://api.github.com/users/pmanrubia/received_events","type":"User","site_admin":false},"assignees":[{"login":"pmanrubia","id":227328,"avatar_url":"https://avatars.githubusercontent.com/u/227328?v=3","gravatar_id":"","url":"https://api.github.com/users/pmanrubia","html_url":"https://github.com/pmanrubia","followers_url":"https://api.github.com/users/pmanrubia/followers","following_url":"https://api.github.com/users/pmanrubia/following{/other_user}","gists_url":"https://api.github.com/users/pmanrubia/gists{/gist_id}","starred_url":"https://api.github.com/users/pmanrubia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmanrubia/subscriptions","organizations_url":"https://api.github.com/users/pmanrubia/orgs","repos_url":"https://api.github.com/users/pmanrubia/repos","events_url":"https://api.github.com/users/pmanrubia/events{/privacy}","received_events_url":"https://api.github.com/users/pmanrubia/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/alphagov/smart-answers/pulls/2797/commits","review_comments_url":"https://api.github.com/repos/alphagov/smart-answers/pulls/2797/comments","review_comment_url":"https://api.github.com/repos/alphagov/smart-answers/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alphagov/smart-answers/issues/2797/comments","statuses_url":"https://api.github.com/repos/alphagov/smart-answers/statuses/de79a8293047265cd818aa10ef1e39a7f1a37130","head":{"label":"alphagov:upgrade-gds-adaptors-version","ref":"upgrade-gds-adaptors-version","sha":"de79a8293047265cd818aa10ef1e39a7f1a37130","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":2651887,"name":"smart-answers","full_name":"alphagov/smart-answers","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/smart-answers","description":"smart-answers","fork":false,"url":"https://api.github.com/repos/alphagov/smart-answers","forks_url":"https://api.github.com/repos/alphagov/smart-answers/forks","keys_url":"https://api.github.com/repos/alphagov/smart-answers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/smart-answers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/smart-answers/teams","hooks_url":"https://api.github.com/repos/alphagov/smart-answers/hooks","issue_events_url":"https://api.github.com/repos/alphagov/smart-answers/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/smart-answers/events","assignees_url":"https://api.github.com/repos/alphagov/smart-answers/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/smart-answers/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/smart-answers/tags","blobs_url":"https://api.github.com/repos/alphagov/smart-answers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/smart-answers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/smart-answers/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/smart-answers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/smart-answers/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/smart-answers/languages","stargazers_url":"https://api.github.com/repos/alphagov/smart-answers/stargazers","contributors_url":"https://api.github.com/repos/alphagov/smart-answers/contributors","subscribers_url":"https://api.github.com/repos/alphagov/smart-answers/subscribers","subscription_url":"https://api.github.com/repos/alphagov/smart-answers/subscription","commits_url":"https://api.github.com/repos/alphagov/smart-answers/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/smart-answers/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/smart-answers/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/smart-answers/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/smart-answers/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/smart-answers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/smart-answers/merges","archive_url":"https://api.github.com/repos/alphagov/smart-answers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/smart-answers/downloads","issues_url":"https://api.github.com/repos/alphagov/smart-answers/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/smart-answers/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/smart-answers/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/smart-answers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/smart-answers/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/smart-answers/releases{/id}","deployments_url":"https://api.github.com/repos/alphagov/smart-answers/deployments","created_at":"2011-10-26T15:39:01Z","updated_at":"2016-11-02T15:23:05Z","pushed_at":"2016-11-03T11:29:50Z","git_url":"git://github.com/alphagov/smart-answers.git","ssh_url":"git@github.com:alphagov/smart-answers.git","clone_url":"https://github.com/alphagov/smart-answers.git","svn_url":"https://github.com/alphagov/smart-answers","homepage":"","size":52963,"stargazers_count":84,"watchers_count":84,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":64,"mirror_url":null,"open_issues_count":24,"forks":64,"open_issues":24,"watchers":84,"default_branch":"master"}},"base":{"label":"alphagov:master","ref":"master","sha":"c152e5540109df5e522cb43524f48a66672369d2","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":2651887,"name":"smart-answers","full_name":"alphagov/smart-answers","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/smart-answers","description":"smart-answers","fork":false,"url":"https://api.github.com/repos/alphagov/smart-answers","forks_url":"https://api.github.com/repos/alphagov/smart-answers/forks","keys_url":"https://api.github.com/repos/alphagov/smart-answers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/smart-answers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/smart-answers/teams","hooks_url":"https://api.github.com/repos/alphagov/smart-answers/hooks","issue_events_url":"https://api.github.com/repos/alphagov/smart-answers/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/smart-answers/events","assignees_url":"https://api.github.com/repos/alphagov/smart-answers/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/smart-answers/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/smart-answers/tags","blobs_url":"https://api.github.com/repos/alphagov/smart-answers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/smart-answers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/smart-answers/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/smart-answers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/smart-answers/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/smart-answers/languages","stargazers_url":"https://api.github.com/repos/alphagov/smart-answers/stargazers","contributors_url":"https://api.github.com/repos/alphagov/smart-answers/contributors","subscribers_url":"https://api.github.com/repos/alphagov/smart-answers/subscribers","subscription_url":"https://api.github.com/repos/alphagov/smart-answers/subscription","commits_url":"https://api.github.com/repos/alphagov/smart-answers/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/smart-answers/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/smart-answers/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/smart-answers/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/smart-answers/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/smart-answers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/smart-answers/merges","archive_url":"https://api.github.com/repos/alphagov/smart-answers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/smart-answers/downloads","issues_url":"https://api.github.com/repos/alphagov/smart-answers/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/smart-answers/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/smart-answers/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/smart-answers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/smart-answers/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/smart-answers/releases{/id}","deployments_url":"https://api.github.com/repos/alphagov/smart-answers/deployments","created_at":"2011-10-26T15:39:01Z","updated_at":"2016-11-02T15:23:05Z","pushed_at":"2016-11-03T11:29:50Z","git_url":"git://github.com/alphagov/smart-answers.git","ssh_url":"git@github.com:alphagov/smart-answers.git","clone_url":"https://github.com/alphagov/smart-answers.git","svn_url":"https://github.com/alphagov/smart-answers","homepage":"","size":52963,"stargazers_count":84,"watchers_count":84,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":64,"mirror_url":null,"open_issues_count":24,"forks":64,"open_issues":24,"watchers":84,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alphagov/smart-answers/pulls/2797"},"html":{"href":"https://github.com/alphagov/smart-answers/pull/2797"},"issue":{"href":"https://api.github.com/repos/alphagov/smart-answers/issues/2797"},"comments":{"href":"https://api.github.com/repos/alphagov/smart-answers/issues/2797/comments"},"review_comments":{"href":"https://api.github.com/repos/alphagov/smart-answers/pulls/2797/comments"},"review_comment":{"href":"https://api.github.com/repos/alphagov/smart-answers/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alphagov/smart-answers/pulls/2797/commits"},"statuses":{"href":"https://api.github.com/repos/alphagov/smart-answers/statuses/de79a8293047265cd818aa10ef1e39a7f1a37130"}}}}
{"actor":{"display_login":"pmanrubia"}}