parliament-ruby 0.5.6 → 0.5.7
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5be3624320b2e71f2c866d40afafe52136efeff5
|
4
|
+
data.tar.gz: 42f22e3125fad051a6136ab25c94cccd50826aea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7ef3458bf75e223766b6a0d0e6e8e1c8b9604bd49afd74883aab3b40cc2b252ad8ea41e372e32b833418a5ae679ab5ddb3a2853c07c4c26bb9e0e425830a9f2
|
7
|
+
data.tar.gz: 245c285b50a42044f4791439e3081365ecd8e2933a9a80e4e1afd153569348fa5ad6ee255fb7b0f92ced6c22d71b182f92f8f802c6bf2132badc84ba745908ca
|
@@ -22,6 +22,14 @@ module Parliament
|
|
22
22
|
def contact_points
|
23
23
|
respond_to?(:incumbencyHasContactPoint) ? incumbencyHasContactPoint : []
|
24
24
|
end
|
25
|
+
|
26
|
+
def seat
|
27
|
+
respond_to?(:seatIncumbencyHasHouseSeat) ? seatIncumbencyHasHouseSeat.first : nil
|
28
|
+
end
|
29
|
+
|
30
|
+
def house
|
31
|
+
respond_to?(:houseIncumbencyHasHouse) ? houseIncumbencyHasHouse.first : nil
|
32
|
+
end
|
25
33
|
end
|
26
34
|
end
|
27
35
|
end
|
@@ -25,11 +25,27 @@ module Parliament
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def incumbencies
|
28
|
-
respond_to?(:memberHasIncumbency)
|
28
|
+
if respond_to?(:memberHasIncumbency)
|
29
|
+
memberHasIncumbency.select { |inc| inc.type == 'http://id.ukpds.org/schema/Incumbency' }
|
30
|
+
else
|
31
|
+
[]
|
32
|
+
end
|
29
33
|
end
|
30
34
|
|
31
35
|
def seat_incumbencies
|
32
|
-
respond_to?(:memberHasIncumbency)
|
36
|
+
if respond_to?(:memberHasIncumbency)
|
37
|
+
memberHasIncumbency.select { |inc| inc.type == 'http://id.ukpds.org/schema/SeatIncumbency' }
|
38
|
+
else
|
39
|
+
[]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def house_incumbencies
|
44
|
+
if respond_to?(:memberHasIncumbency)
|
45
|
+
memberHasIncumbency.select { |inc| inc.type == 'http://id.ukpds.org/schema/HouseIncumbency' }
|
46
|
+
else
|
47
|
+
[]
|
48
|
+
end
|
33
49
|
end
|
34
50
|
|
35
51
|
def seats
|
@@ -51,6 +67,10 @@ module Parliament
|
|
51
67
|
houses << seat.house
|
52
68
|
end
|
53
69
|
|
70
|
+
house_incumbencies.each do |inc|
|
71
|
+
houses << inc.house
|
72
|
+
end
|
73
|
+
|
54
74
|
@houses = houses.flatten.uniq
|
55
75
|
end
|
56
76
|
|
@@ -91,6 +111,18 @@ module Parliament
|
|
91
111
|
def gender
|
92
112
|
gender_identities.empty? ? nil : gender_identities.first.gender
|
93
113
|
end
|
114
|
+
|
115
|
+
def statuses
|
116
|
+
return @statuses unless @statuses.nil?
|
117
|
+
|
118
|
+
statuses = []
|
119
|
+
statuses << 'Current MP' unless seat_incumbencies.select(&:current?).empty?
|
120
|
+
statuses << 'Lord' unless house_incumbencies.select(&:current?).empty?
|
121
|
+
statuses << 'Former Lord' if !house_incumbencies.empty? && house_incumbencies.select(&:current?).empty?
|
122
|
+
statuses << 'Former MP' if !seat_incumbencies.empty? && seat_incumbencies.select(&:current?).empty?
|
123
|
+
|
124
|
+
@statuses = statuses
|
125
|
+
end
|
94
126
|
end
|
95
127
|
end
|
96
128
|
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.5.
|
4
|
+
version: 0.5.7
|
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-03-
|
11
|
+
date: 2017-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grom
|