hdo-storting-importer 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/hdo/storting_importer/party.rb +4 -0
- data/lib/hdo/storting_importer/representative.rb +4 -0
- data/lib/hdo/storting_importer/util.rb +16 -0
- data/lib/hdo/storting_importer/version.rb +1 -1
- data/spec/hdo/storting_importer/party_spec.rb +5 -0
- data/spec/hdo/storting_importer/representative_spec.rb +7 -0
- metadata +2 -2
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
1
3
|
module Hdo
|
2
4
|
module StortingImporter
|
3
5
|
module Util
|
@@ -21,6 +23,20 @@ module Hdo
|
|
21
23
|
def remove_invalid_html(str)
|
22
24
|
str.gsub("<\\p>", "")
|
23
25
|
end
|
26
|
+
|
27
|
+
ID_CONVERSIONS = {
|
28
|
+
'_AE' => 'Æ',
|
29
|
+
'_O' => 'Ø',
|
30
|
+
'_A' => 'Å'
|
31
|
+
}
|
32
|
+
|
33
|
+
def unescape_param(query_param)
|
34
|
+
q = query_param.dup
|
35
|
+
ID_CONVERSIONS.each { |k, v| q.gsub!(k, v) }
|
36
|
+
|
37
|
+
q
|
38
|
+
end
|
39
|
+
|
24
40
|
end
|
25
41
|
end
|
26
42
|
end
|
@@ -93,6 +93,13 @@ module Hdo
|
|
93
93
|
Representative.fields.should_not be_empty
|
94
94
|
end
|
95
95
|
|
96
|
+
it 'unescapes non-ASCII characters in the external id' do
|
97
|
+
rep = Representative.example
|
98
|
+
|
99
|
+
rep.instance_variable_set("@external_id", '_AE_O_A')
|
100
|
+
rep.external_id.should == "ÆØÅ"
|
101
|
+
end
|
102
|
+
|
96
103
|
end
|
97
104
|
end
|
98
105
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hdo-storting-importer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: builder
|