hdo-storting-importer 0.5.6 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hdo/storting_importer/representative.rb +12 -4
- data/lib/hdo/storting_importer/schema/representative.json +5 -1
- data/lib/hdo/storting_importer/version.rb +1 -1
- data/spec/hdo/storting_importer/representative_spec.rb +10 -0
- data/spec/hdo/storting_importer/vote_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c84c68937cad8fc60f41a854c96563f4636432e
|
4
|
+
data.tar.gz: 6c018689a03459290880cedc6327e998003b5a92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: beabc7770b26f7010682b7578f0ef8df848d424ac3391d06fea0066c835880ec5ce416db7ec03f6d0c0b9712fb3c31d06422a006af1b4e08262c57fffd7200f9
|
7
|
+
data.tar.gz: f49cfe73e20c27db2114633806d6a71b6a921bfcd12fb9e7f098b8928e9a49a0165dc495aff6ef6c2f23d0adc5b4b39dfa7f9d632ec2548f52f96c30aaa8b841
|
@@ -10,7 +10,7 @@ module Hdo
|
|
10
10
|
attr_reader :external_id, :first_name, :last_name, :email, :date_of_birth, :date_of_death,
|
11
11
|
:district, :parties, :committees, :period, :gender
|
12
12
|
|
13
|
-
attr_accessor :vote_result, :permanent_substitute_for
|
13
|
+
attr_accessor :vote_result, :permanent_substitute_for, :substitute
|
14
14
|
|
15
15
|
schema_path StortingImporter.lib.join("hdo/storting_importer/schema/representative.json").to_s
|
16
16
|
|
@@ -85,9 +85,14 @@ module Hdo
|
|
85
85
|
committees
|
86
86
|
)
|
87
87
|
|
88
|
-
|
88
|
+
sub_for = node.css('fast_vara_for').first
|
89
|
+
if sub_for && sub_for['nil'] != 'true'
|
90
|
+
rep.permanent_substitute_for = sub_for.css("id").first.text
|
91
|
+
end
|
92
|
+
|
93
|
+
sub = node.css('vara').first
|
89
94
|
if sub && sub['nil'] != 'true'
|
90
|
-
rep.
|
95
|
+
rep.substitute = sub.css('id').first.text
|
91
96
|
end
|
92
97
|
|
93
98
|
rep
|
@@ -107,6 +112,7 @@ module Hdo
|
|
107
112
|
|
108
113
|
v.vote_result = hash['vote_result']
|
109
114
|
v.permanent_substitute_for = hash['permanent_substitute_for']
|
115
|
+
v.substitute = hash['substitute']
|
110
116
|
|
111
117
|
v
|
112
118
|
end
|
@@ -123,8 +129,9 @@ module Hdo
|
|
123
129
|
@parties = parties
|
124
130
|
@committees = committees
|
125
131
|
|
126
|
-
@vote_result
|
132
|
+
@vote_result = nil
|
127
133
|
@permanent_substitute_for = nil
|
134
|
+
@substitute = nil
|
128
135
|
end
|
129
136
|
|
130
137
|
def short_inspect
|
@@ -152,6 +159,7 @@ module Hdo
|
|
152
159
|
|
153
160
|
h['vote_result'] = @vote_result if @vote_result
|
154
161
|
h['permanent_substitute_for'] = @permanent_substitute_for if @permanent_substitute_for
|
162
|
+
h['substitute'] = @substitute if @substitute
|
155
163
|
|
156
164
|
h
|
157
165
|
end
|
@@ -61,7 +61,11 @@
|
|
61
61
|
},
|
62
62
|
"permanent_substitute_for": {
|
63
63
|
"type": "string",
|
64
|
-
"description": "
|
64
|
+
"description": "The external id of the representative the current representative is a permanent substitute for."
|
65
|
+
},
|
66
|
+
"substitute": {
|
67
|
+
"type": "string",
|
68
|
+
"description": "The external id of the representative that is the substitute for the current representative"
|
65
69
|
}
|
66
70
|
}
|
67
71
|
}
|
@@ -120,6 +120,16 @@ module Hdo
|
|
120
120
|
Representative.from_hash(data).permanent_substitute_for.should == "JB"
|
121
121
|
end
|
122
122
|
|
123
|
+
it 'serializes the "substitute" field' do
|
124
|
+
obj = Representative.example
|
125
|
+
obj.substitute = "JB"
|
126
|
+
|
127
|
+
data = obj.to_hash
|
128
|
+
data['substitute'].should == "JB"
|
129
|
+
|
130
|
+
Representative.from_hash(data).substitute.should == "JB"
|
131
|
+
end
|
132
|
+
|
123
133
|
end
|
124
134
|
end
|
125
135
|
end
|
@@ -65,7 +65,7 @@ module Hdo
|
|
65
65
|
vote.external_id.should == "2175"
|
66
66
|
vote.external_issue_id.should == "51448"
|
67
67
|
vote.should be_personal
|
68
|
-
vote.enacted.should
|
68
|
+
vote.enacted.should be false
|
69
69
|
vote.subject.should == 'Forslag 24 - 26 på vegne av Per Olaf Lundteigen'
|
70
70
|
vote.method_name.should == 'ikke_spesifisert'
|
71
71
|
vote.result_type.should == 'ikke_spesifisert'
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hdo-storting-importer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jari Bakken
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|