parliament-ruby 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/parliament/decorators/contact_point.rb +4 -0
- data/lib/parliament/decorators/house.rb +4 -0
- data/lib/parliament/decorators/house_incumbency.rb +31 -0
- data/lib/parliament/decorators/incumbency.rb +27 -0
- data/lib/parliament/decorators/party.rb +0 -1
- data/lib/parliament/decorators/person.rb +5 -4
- data/lib/parliament/decorators/seat_incumbency.rb +8 -8
- data/lib/parliament/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2b60187ee147754e45af117d67e186d9f243a03
|
4
|
+
data.tar.gz: 7f067fa0eae375acadb3615bb5a585327708895a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c326bb2d2ec7fd7f2541dce2ec400a3760c1de6779cb0b1fd089daad88f164bc2c696ebc1828dd3e2da562bd5f53328e31d671ae250a8a987a2d366b483eced
|
7
|
+
data.tar.gz: c5200240f342ec061ae7cceb581456a535e1c2d9a09806c6cf9c1cb0a5c1886220fbf12666f6c9a13c64918ed94a93fa20b92ece08074a80da47e663a3c900b4
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Parliament
|
2
|
+
module Decorators
|
3
|
+
module HouseIncumbency
|
4
|
+
def start_date
|
5
|
+
respond_to?(:incumbencyStartDate) ? DateTime.parse(incumbencyStartDate) : nil
|
6
|
+
end
|
7
|
+
|
8
|
+
def end_date
|
9
|
+
respond_to?(:incumbencyEndDate) ? DateTime.parse(incumbencyEndDate) : nil
|
10
|
+
end
|
11
|
+
|
12
|
+
def current?
|
13
|
+
has_end_date = respond_to?(:incumbencyEndDate)
|
14
|
+
|
15
|
+
!has_end_date
|
16
|
+
end
|
17
|
+
|
18
|
+
def house
|
19
|
+
respond_to?(:houseIncumbencyHasHouse) ? houseIncumbencyHasHouse.first : nil
|
20
|
+
end
|
21
|
+
|
22
|
+
def member
|
23
|
+
respond_to?(:incumbencyHasMember) ? incumbencyHasMember.first : nil
|
24
|
+
end
|
25
|
+
|
26
|
+
def contact_points
|
27
|
+
respond_to?(:incumbencyHasContactPoint) ? incumbencyHasContactPoint : []
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Parliament
|
2
|
+
module Decorators
|
3
|
+
module Incumbency
|
4
|
+
def start_date
|
5
|
+
respond_to?(:incumbencyStartDate) ? DateTime.parse(incumbencyStartDate) : nil
|
6
|
+
end
|
7
|
+
|
8
|
+
def end_date
|
9
|
+
respond_to?(:incumbencyEndDate) ? DateTime.parse(incumbencyEndDate) : nil
|
10
|
+
end
|
11
|
+
|
12
|
+
def current?
|
13
|
+
has_end_date = respond_to?(:incumbencyEndDate)
|
14
|
+
|
15
|
+
!has_end_date
|
16
|
+
end
|
17
|
+
|
18
|
+
def member
|
19
|
+
respond_to?(:incumbencyHasMember) ? incumbencyHasMember.first : nil
|
20
|
+
end
|
21
|
+
|
22
|
+
def contact_points
|
23
|
+
respond_to?(:incumbencyHasContactPoint) ? incumbencyHasContactPoint : []
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -24,16 +24,16 @@ module Parliament
|
|
24
24
|
full_name.rstrip
|
25
25
|
end
|
26
26
|
|
27
|
-
def
|
28
|
-
respond_to?(:
|
27
|
+
def incumbencies
|
28
|
+
respond_to?(:memberHasIncumbency) ? memberHasIncumbency : []
|
29
29
|
end
|
30
30
|
|
31
31
|
def seats
|
32
32
|
return @seats unless @seats.nil?
|
33
33
|
|
34
34
|
seats = []
|
35
|
-
|
36
|
-
seats <<
|
35
|
+
incumbencies.each do |incumbency|
|
36
|
+
seats << incumbency.seat if incumbency.respond_to?(:seat)
|
37
37
|
end
|
38
38
|
|
39
39
|
@seats = seats.flatten.uniq
|
@@ -87,6 +87,7 @@ module Parliament
|
|
87
87
|
def gender
|
88
88
|
gender_identities.empty? ? nil : gender_identities.first.gender
|
89
89
|
end
|
90
|
+
|
90
91
|
end
|
91
92
|
end
|
92
93
|
end
|
@@ -2,23 +2,19 @@ module Parliament
|
|
2
2
|
module Decorators
|
3
3
|
module SeatIncumbency
|
4
4
|
def start_date
|
5
|
-
respond_to?(:
|
5
|
+
respond_to?(:incumbencyStartDate) ? DateTime.parse(incumbencyStartDate) : nil
|
6
6
|
end
|
7
7
|
|
8
8
|
def end_date
|
9
|
-
respond_to?(:
|
9
|
+
respond_to?(:incumbencyEndDate) ? DateTime.parse(incumbencyEndDate) : nil
|
10
10
|
end
|
11
11
|
|
12
12
|
def seat
|
13
13
|
respond_to?(:seatIncumbencyHasHouseSeat) ? seatIncumbencyHasHouseSeat.first : nil
|
14
14
|
end
|
15
15
|
|
16
|
-
def member
|
17
|
-
respond_to?(:seatIncumbencyHasMember) ? seatIncumbencyHasMember.first : nil
|
18
|
-
end
|
19
|
-
|
20
16
|
def current?
|
21
|
-
has_end_date = respond_to?(:
|
17
|
+
has_end_date = respond_to?(:incumbencyEndDate)
|
22
18
|
|
23
19
|
!has_end_date
|
24
20
|
end
|
@@ -32,7 +28,11 @@ module Parliament
|
|
32
28
|
end
|
33
29
|
|
34
30
|
def contact_points
|
35
|
-
respond_to?(:
|
31
|
+
respond_to?(:incumbencyHasContactPoint) ? incumbencyHasContactPoint : []
|
32
|
+
end
|
33
|
+
|
34
|
+
def member
|
35
|
+
respond_to?(:incumbencyHasMember) ? incumbencyHasMember.first : nil
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
data/lib/parliament/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parliament-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Rayner
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02
|
11
|
+
date: 2017-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grom
|
@@ -149,7 +149,9 @@ files:
|
|
149
149
|
- lib/parliament/decorators/gender.rb
|
150
150
|
- lib/parliament/decorators/gender_identity.rb
|
151
151
|
- lib/parliament/decorators/house.rb
|
152
|
+
- lib/parliament/decorators/house_incumbency.rb
|
152
153
|
- lib/parliament/decorators/house_seat.rb
|
154
|
+
- lib/parliament/decorators/incumbency.rb
|
153
155
|
- lib/parliament/decorators/party.rb
|
154
156
|
- lib/parliament/decorators/party_membership.rb
|
155
157
|
- lib/parliament/decorators/person.rb
|