Sha256: d9a34cd230b31b2094069b3ce4daa7b0972186bd26cf4e062f404fc926842e76

Contents?: true

Size: 709 Bytes

Versions: 3

Compression:

Stored size: 709 Bytes

Contents

#! /usr/bin/env ruby

require 'csv'
require 'open-uri'
require './lib/gman'

url = 'http://www.mik.nrw.de/nc/themen-aufgaben/kommunales/kommunale-adressen.html?tx_szkommunaldb_pi1%5Bexport%5D=csv'

csv = open(url).read.force_encoding('iso-8859-1').encode('UTF-8')

# For some reason, the header row is actually the last row
# Pop the last line off the file and prepend it at the begining
# So that when we pass it to CSV it detects the headers properly
lines = csv.split("\n")
lines.unshift lines.pop
csv = lines.join("\n")

# Load municipal domains
data = CSV.parse(csv, headers: true, col_sep: ';')
domains = data.map { |row| row['Internet'] }

Gman::Importer.new('German Municipalities' => domains).import

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gman-7.0.2 script/vendor-municipal-de
gman-7.0.1 script/vendor-municipal-de
gman-7.0.0 script/vendor-municipal-de