hdo-storting-importer 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/lib/hdo/storting_importer/representative.rb +15 -3
- data/lib/hdo/storting_importer/schema/representative.json +4 -0
- data/lib/hdo/storting_importer/version.rb +1 -1
- data/spec/hdo/storting_importer/representative_spec.rb +4 -0
- data/spec/hdo/storting_importer/vote_spec.rb +2 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fe9354e9fe6a588dc970a1a26d73196b8465bdd
|
4
|
+
data.tar.gz: de96b96e3f915c6dd1069fdf9e9445a854942b55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 846ac7b690036b90d35934e399bacc3d8d8315a9729fae33c401dc47af099d3c3592a5f0f0511ad9e0d6c7403f2caa133e172fb8c83e02e0700e46c364774839
|
7
|
+
data.tar.gz: 0ea68bf107bf2ba3dc129dbac8a149d727fb9cef485f0e5e5bb3006823bcf4d02eca8bff417f326727717f86f7a1115bf98691a0b462d87237a5217faf482632
|
data/LICENSE
CHANGED
@@ -7,7 +7,7 @@ module Hdo
|
|
7
7
|
include IvarEquality
|
8
8
|
include Inspectable
|
9
9
|
|
10
|
-
attr_reader :external_id, :first_name, :last_name, :date_of_birth, :date_of_death,
|
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
13
|
attr_accessor :vote_result, :permanent_substitute_for
|
@@ -19,6 +19,7 @@ module Hdo
|
|
19
19
|
'ADA',
|
20
20
|
'André Oktay',
|
21
21
|
'Dahl',
|
22
|
+
'aod@stortinget.no',
|
22
23
|
'M',
|
23
24
|
'1975-07-07T00:00:00',
|
24
25
|
'0001-01-01T00:00:00',
|
@@ -59,6 +60,13 @@ module Hdo
|
|
59
60
|
parties = []
|
60
61
|
end
|
61
62
|
|
63
|
+
email_node = node.css('epost').first
|
64
|
+
if email_node
|
65
|
+
email = email_node.text
|
66
|
+
else
|
67
|
+
email = nil
|
68
|
+
end
|
69
|
+
|
62
70
|
committee_ids = node.css("komite").map { |c| c.css("id").text.strip }
|
63
71
|
committees = committee_ids.map do |id|
|
64
72
|
CommitteeMembership.new(id, start_date, end_date)
|
@@ -68,6 +76,7 @@ module Hdo
|
|
68
76
|
node.css("id").first.text,
|
69
77
|
node.css("fornavn").first.text,
|
70
78
|
node.css("etternavn").first.text,
|
79
|
+
email,
|
71
80
|
node.css("kjoenn").first.text == "mann" ? 'M' : 'F',
|
72
81
|
node.css("foedselsdato").first.text,
|
73
82
|
node.css("doedsdato").first.text,
|
@@ -88,6 +97,7 @@ module Hdo
|
|
88
97
|
v = new hash['external_id'],
|
89
98
|
hash['first_name'],
|
90
99
|
hash['last_name'],
|
100
|
+
hash['email'],
|
91
101
|
hash['gender'],
|
92
102
|
hash['date_of_birth'],
|
93
103
|
hash['date_of_death'],
|
@@ -101,10 +111,11 @@ module Hdo
|
|
101
111
|
v
|
102
112
|
end
|
103
113
|
|
104
|
-
def initialize(external_id, first_name, last_name, gender, date_of_birth, date_of_death, district, parties, committees)
|
114
|
+
def initialize(external_id, first_name, last_name, email, gender, date_of_birth, date_of_death, district, parties, committees)
|
105
115
|
@external_id = external_id
|
106
116
|
@first_name = first_name
|
107
117
|
@last_name = last_name
|
118
|
+
@email = email
|
108
119
|
@gender = gender
|
109
120
|
@date_of_birth = date_of_birth
|
110
121
|
@date_of_death = date_of_death
|
@@ -117,7 +128,7 @@ module Hdo
|
|
117
128
|
end
|
118
129
|
|
119
130
|
def short_inspect
|
120
|
-
short_inspect_string :include => [:external_id, :first_name, :last_name, :parties, :vote_result]
|
131
|
+
short_inspect_string :include => [:external_id, :first_name, :last_name, :email, :parties, :vote_result]
|
121
132
|
end
|
122
133
|
|
123
134
|
def external_id
|
@@ -130,6 +141,7 @@ module Hdo
|
|
130
141
|
'external_id' => @external_id,
|
131
142
|
'first_name' => @first_name,
|
132
143
|
'last_name' => @last_name,
|
144
|
+
'email' => @email,
|
133
145
|
'gender' => @gender,
|
134
146
|
'date_of_birth' => @date_of_birth,
|
135
147
|
'date_of_death' => @date_of_death,
|
@@ -24,6 +24,10 @@
|
|
24
24
|
"description": "The first name of the representative",
|
25
25
|
"required": true
|
26
26
|
},
|
27
|
+
"email": {
|
28
|
+
"type": "string",
|
29
|
+
"description": "The representative email, if available."
|
30
|
+
},
|
27
31
|
"district": {
|
28
32
|
"type": "string",
|
29
33
|
"description": "The electoral district the representative belongs to. Must match the 'name' field of the district type.",
|
@@ -20,6 +20,7 @@ module Hdo
|
|
20
20
|
<etternavn>Dahl</etternavn>
|
21
21
|
<foedselsdato>1975-07-07T00:00:00</foedselsdato>
|
22
22
|
<fornavn>André Oktay</fornavn>
|
23
|
+
<epost>aod@stortinget.no</epost>
|
23
24
|
<id>ADA</id>
|
24
25
|
<kjoenn>mann</kjoenn>
|
25
26
|
<fylke>
|
@@ -44,6 +45,7 @@ module Hdo
|
|
44
45
|
rep = representatives.first
|
45
46
|
rep.first_name.should == 'André Oktay'
|
46
47
|
rep.last_name.should == 'Dahl'
|
48
|
+
rep.email.should == 'aod@stortinget.no'
|
47
49
|
rep.gender.should == 'M'
|
48
50
|
rep.district.should == 'Akershus'
|
49
51
|
rep.parties.should == [PartyMembership.from_hash('external_id' => 'H', 'start_date' => Date.today.strftime("%Y-%m-%d"), 'end_date' => nil)]
|
@@ -60,6 +62,7 @@ module Hdo
|
|
60
62
|
"external_id": "ADA",
|
61
63
|
"first_name": "André Oktay",
|
62
64
|
"last_name": "Dahl",
|
65
|
+
"email": "aod@stortinget.no",
|
63
66
|
"gender": "M",
|
64
67
|
"date_of_birth": "1975-07-07T00:00:00",
|
65
68
|
"date_of_death": "0001-01-01T00:00:00",
|
@@ -77,6 +80,7 @@ module Hdo
|
|
77
80
|
"external_id": "ADA",
|
78
81
|
"first_name": "André Oktay",
|
79
82
|
"last_name": "Dahl",
|
83
|
+
"email": "aod@stortinget.no",
|
80
84
|
"gender": "M",
|
81
85
|
"date_of_birth": "1975-07-07T00:00:00",
|
82
86
|
"date_of_death": "0001-01-01T00:00:00",
|
@@ -98,6 +98,7 @@ module Hdo
|
|
98
98
|
"external_id": "ADA",
|
99
99
|
"first_name": "André Oktay",
|
100
100
|
"last_name": "Dahl",
|
101
|
+
"email": "aod@stortinget.no",
|
101
102
|
"gender": "M",
|
102
103
|
"date_of_birth": "1975-07-07T00:00:00",
|
103
104
|
"date_of_death": "0001-01-01T00:00:00",
|
@@ -119,6 +120,7 @@ module Hdo
|
|
119
120
|
"external_id": "ADA",
|
120
121
|
"first_name": "André Oktay",
|
121
122
|
"last_name": "Dahl",
|
123
|
+
"email": "aod@stortinget.no",
|
122
124
|
"gender": "M",
|
123
125
|
"date_of_birth": "1975-07-07T00:00:00",
|
124
126
|
"date_of_death": "0001-01-01T00:00:00",
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jari Bakken
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
@@ -344,7 +344,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
344
344
|
version: '0'
|
345
345
|
requirements: []
|
346
346
|
rubyforge_project:
|
347
|
-
rubygems_version: 2.1.
|
347
|
+
rubygems_version: 2.1.9
|
348
348
|
signing_key:
|
349
349
|
specification_version: 4
|
350
350
|
summary: Gem to process data from data.stortinget.no
|