{"action":"created","issue":{"url":"https://api.github.com/repos/openSNP/snpr/issues/251","repository_url":"https://api.github.com/repos/openSNP/snpr","labels_url":"https://api.github.com/repos/openSNP/snpr/issues/251/labels{/name}","comments_url":"https://api.github.com/repos/openSNP/snpr/issues/251/comments","events_url":"https://api.github.com/repos/openSNP/snpr/issues/251/events","html_url":"https://github.com/openSNP/snpr/pull/251","id":132598094,"number":251,"title":"Fixes undefined method [] for nil:NilClass error in ALM details","user":{"login":"philippbayer","id":413885,"avatar_url":"https://avatars.githubusercontent.com/u/413885?v=3","gravatar_id":"","url":"https://api.github.com/users/philippbayer","html_url":"https://github.com/philippbayer","followers_url":"https://api.github.com/users/philippbayer/followers","following_url":"https://api.github.com/users/philippbayer/following{/other_user}","gists_url":"https://api.github.com/users/philippbayer/gists{/gist_id}","starred_url":"https://api.github.com/users/philippbayer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philippbayer/subscriptions","organizations_url":"https://api.github.com/users/philippbayer/orgs","repos_url":"https://api.github.com/users/philippbayer/repos","events_url":"https://api.github.com/users/philippbayer/events{/privacy}","received_events_url":"https://api.github.com/users/philippbayer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-02-10T03:26:36Z","updated_at":"2016-02-10T09:09:02Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/openSNP/snpr/pulls/251","html_url":"https://github.com/openSNP/snpr/pull/251","diff_url":"https://github.com/openSNP/snpr/pull/251.diff","patch_url":"https://github.com/openSNP/snpr/pull/251.patch"},"body":"It seems that the output of the ALM API changed a little bit, causing heaps of `NoMethodError: undefined method [] for nil:NilClass`\r\n\r\nfrom this line:\r\n\r\n`readers_total = detail_result[0][\"views\"]`\r\n\r\nbecause it's not a list anymore, so [0] gives you nil, so you can't run [\"views\"] on that\r\n\r\nThis commit puts in an example reply in the comments (try it for yourself: http://alm.plos.org/api/v3/articles/10.1371/journal.pone.0080003?api_key=OUR_API_KEY ) and fixes this bug, and adds a little check to see whether the HTTP response from the API is correct so that we don't parse garbage or empty text.\r\n\r\nEdit: This commit also fixes that annoying failing UserAchievement test\r\n\r\nEdit 2: Apparently the above link works without the API-key, too. huh"},"comment":{"url":"https://api.github.com/repos/openSNP/snpr/issues/comments/182266291","html_url":"https://github.com/openSNP/snpr/pull/251#issuecomment-182266291","issue_url":"https://api.github.com/repos/openSNP/snpr/issues/251","id":182266291,"user":{"login":"gedankenstuecke","id":674899,"avatar_url":"https://avatars.githubusercontent.com/u/674899?v=3","gravatar_id":"","url":"https://api.github.com/users/gedankenstuecke","html_url":"https://github.com/gedankenstuecke","followers_url":"https://api.github.com/users/gedankenstuecke/followers","following_url":"https://api.github.com/users/gedankenstuecke/following{/other_user}","gists_url":"https://api.github.com/users/gedankenstuecke/gists{/gist_id}","starred_url":"https://api.github.com/users/gedankenstuecke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gedankenstuecke/subscriptions","organizations_url":"https://api.github.com/users/gedankenstuecke/orgs","repos_url":"https://api.github.com/users/gedankenstuecke/repos","events_url":"https://api.github.com/users/gedankenstuecke/events{/privacy}","received_events_url":"https://api.github.com/users/gedankenstuecke/received_events","type":"User","site_admin":false},"created_at":"2016-02-10T09:09:02Z","updated_at":"2016-02-10T09:09:02Z","body":":+1: "}}