{"action":"created","issue":{"url":"https://api.github.com/repos/alphagov/local-links-manager/issues/12","repository_url":"https://api.github.com/repos/alphagov/local-links-manager","labels_url":"https://api.github.com/repos/alphagov/local-links-manager/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/alphagov/local-links-manager/issues/12/comments","events_url":"https://api.github.com/repos/alphagov/local-links-manager/issues/12/events","html_url":"https://github.com/alphagov/local-links-manager/pull/12","id":154292138,"number":12,"title":"[WIP] - Use CSV header converters","user":{"login":"davidbasalla","id":5112255,"avatar_url":"https://avatars.githubusercontent.com/u/5112255?v=3","gravatar_id":"","url":"https://api.github.com/users/davidbasalla","html_url":"https://github.com/davidbasalla","followers_url":"https://api.github.com/users/davidbasalla/followers","following_url":"https://api.github.com/users/davidbasalla/following{/other_user}","gists_url":"https://api.github.com/users/davidbasalla/gists{/gist_id}","starred_url":"https://api.github.com/users/davidbasalla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidbasalla/subscriptions","organizations_url":"https://api.github.com/users/davidbasalla/orgs","repos_url":"https://api.github.com/users/davidbasalla/repos","events_url":"https://api.github.com/users/davidbasalla/events{/privacy}","received_events_url":"https://api.github.com/users/davidbasalla/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-11T16:55:50Z","updated_at":"2016-05-12T10:10:12Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/alphagov/local-links-manager/pulls/12","html_url":"https://github.com/alphagov/local-links-manager/pull/12","diff_url":"https://github.com/alphagov/local-links-manager/pull/12.diff","patch_url":"https://github.com/alphagov/local-links-manager/pull/12.patch"},"body":"In the Importer classes (Service, Interaction, ServiceInteraction), we previously converted some header names to more readable names (such as \"Mapped identifier\" -> :lgil_code). This forced another level of indirection for imported CSV rows, having to call the `parsed_hash` method on a row first before it could get passed to the `create_or_update_method`.\r\n\r\nThis commit makes use of the `CSV` library's support for [converters](http://ruby-doc.org/stdlib-2.0.0/libdoc/csv/rdoc/CSV.html#method-i-header_convert), so we can pass a hash of conversions to the `CsvDownloader` class, and the conversions are applied as the CSV rows are imported. This helps to declutter the Importer classes, makes the `CsvDownloader` (rightfully) responsible for the conversions and makes the tests more readable."},"comment":{"url":"https://api.github.com/repos/alphagov/local-links-manager/issues/comments/218715238","html_url":"https://github.com/alphagov/local-links-manager/pull/12#issuecomment-218715238","issue_url":"https://api.github.com/repos/alphagov/local-links-manager/issues/12","id":218715238,"user":{"login":"h-lame","id":608,"avatar_url":"https://avatars.githubusercontent.com/u/608?v=3","gravatar_id":"","url":"https://api.github.com/users/h-lame","html_url":"https://github.com/h-lame","followers_url":"https://api.github.com/users/h-lame/followers","following_url":"https://api.github.com/users/h-lame/following{/other_user}","gists_url":"https://api.github.com/users/h-lame/gists{/gist_id}","starred_url":"https://api.github.com/users/h-lame/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/h-lame/subscriptions","organizations_url":"https://api.github.com/users/h-lame/orgs","repos_url":"https://api.github.com/users/h-lame/repos","events_url":"https://api.github.com/users/h-lame/events{/privacy}","received_events_url":"https://api.github.com/users/h-lame/received_events","type":"User","site_admin":false},"created_at":"2016-05-12T10:10:12Z","updated_at":"2016-05-12T10:10:12Z","body":"I like this.  Getting rid of the parsed_hash method feels like a big improvement."}}