parliament-ruby 0.4.1 → 0.5.0

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: 35b478eb95f94d239b43577926d991cd8d7e185d
4
- data.tar.gz: 80e3214e334fb5568e2474b76c6ccf4f510b469b
3
+ metadata.gz: d2b60187ee147754e45af117d67e186d9f243a03
4
+ data.tar.gz: 7f067fa0eae375acadb3615bb5a585327708895a
5
5
  SHA512:
6
- metadata.gz: caa6aae8ea8c2a3c27fbecd534225010e7c4068651d972502bca85391d02623899a3f5f617671be79c1923f5a81259fd7d1e01043ad66c6fabe97b78811b807c
7
- data.tar.gz: 9705db9a2c52ae0ae87e9fbe23693da6b1a1323b1766618f26f7e23dbfc7e39257ae3b32f73f4c9836f93bcad7ff33dff221956457ba4274dc9ce8cb8200b42c
6
+ metadata.gz: 4c326bb2d2ec7fd7f2541dce2ec400a3760c1de6779cb0b1fd089daad88f164bc2c696ebc1828dd3e2da562bd5f53328e31d671ae250a8a987a2d366b483eced
7
+ data.tar.gz: c5200240f342ec061ae7cceb581456a535e1c2d9a09806c6cf9c1cb0a5c1886220fbf12666f6c9a13c64918ed94a93fa20b92ece08074a80da47e663a3c900b4
@@ -20,6 +20,10 @@ module Parliament
20
20
  def person
21
21
  respond_to?(:contactPointHasPerson) ? contactPointHasPerson : []
22
22
  end
23
+
24
+ def incumbency
25
+ respond_to?(:contactPointHasIncumbency) ? contactPointHasIncumbency.first : nil
26
+ end
23
27
  end
24
28
  end
25
29
  end
@@ -19,6 +19,10 @@ module Parliament
19
19
  def seats
20
20
  respond_to?(:houseHasHouseSeat) ? houseHasHouseSeat : []
21
21
  end
22
+
23
+ def house_incumbencies
24
+ respond_to?(:houseHasHouseIncumbency) ? houseHasHouseIncumbency : []
25
+ end
22
26
  end
23
27
  end
24
28
  end
@@ -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
@@ -1,4 +1,3 @@
1
-
2
1
  module Parliament
3
2
  module Decorators
4
3
  module Party
@@ -24,16 +24,16 @@ module Parliament
24
24
  full_name.rstrip
25
25
  end
26
26
 
27
- def seat_incumbencies
28
- respond_to?(:memberHasSeatIncumbency) ? memberHasSeatIncumbency : []
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
- seat_incumbencies.each do |seat_incumbency|
36
- seats << seat_incumbency.seat
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?(:seatIncumbencyStartDate) ? DateTime.parse(seatIncumbencyStartDate) : nil
5
+ respond_to?(:incumbencyStartDate) ? DateTime.parse(incumbencyStartDate) : nil
6
6
  end
7
7
 
8
8
  def end_date
9
- respond_to?(:seatIncumbencyEndDate) ? DateTime.parse(seatIncumbencyEndDate) : nil
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?(:seatIncumbencyEndDate)
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?(:seatIncumbencyHasContactPoint) ? seatIncumbencyHasContactPoint : []
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
@@ -1,3 +1,3 @@
1
1
  module Parliament
2
- VERSION = '0.4.1'.freeze
2
+ VERSION = '0.5.0'.freeze
3
3
  end
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.1
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-28 00:00:00.000000000 Z
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