hdo-storting-importer 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,7 +39,7 @@ module Hdo
|
|
39
39
|
|
40
40
|
def read_type(plural, klass)
|
41
41
|
objs = @files.map do |e|
|
42
|
-
doc = Nokogiri::XML.parse(
|
42
|
+
doc = Nokogiri::XML.parse(open(e).read)
|
43
43
|
doc.remove_namespaces!
|
44
44
|
|
45
45
|
klass.from_storting_doc(doc)
|
@@ -104,7 +104,12 @@ module Hdo
|
|
104
104
|
csvs = @files.any? ? @files : Dir[File.join(StortingImporter.root, 'data/promises-*.csv')].sort_by { |e| File.basename(e) }
|
105
105
|
content = ''
|
106
106
|
csvs.each do |csv|
|
107
|
-
|
107
|
+
if csv =~ /^http/
|
108
|
+
content << open(csv).read
|
109
|
+
else
|
110
|
+
# local csv files are ISO-8859-1 for some reason.
|
111
|
+
content << File.read(File.expand_path(csv), encoding: "ISO-8859-1").encode("UTF-8")
|
112
|
+
end
|
108
113
|
end
|
109
114
|
|
110
115
|
Util.builder do |xml|
|