parliament-grom-decorators 0.25.0 → 0.25.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '0054219819c9cf5ba0fef958aca46148cba22a49'
4
- data.tar.gz: 7d5e3321395c970117c3c1bafcb31568cee2feed
3
+ metadata.gz: 06de8a0e1256fab3b1a807da878c1620d1ec8b12
4
+ data.tar.gz: b85c5b82b9a3e28fbc170b74a0d5e4be1da88746
5
5
  SHA512:
6
- metadata.gz: 9b458832d8f93df5eb2a0a1c7488c20ebc5f1bdf4928b9fce540b30dd68a05eaebe74d30f6999d04fd9f8962d526914da8c5ffc4cdfc0d6e3780afb335cd59f1
7
- data.tar.gz: 494be78cd713accfe9eb06e3f353620457f248f925edaa4ebc2df1ab3c2c8c243b5c02cf59e1fad01ce2a48899c4f84f675b2a6cba76fc25c8938e1663de0b43
6
+ metadata.gz: b3d9e64d32e0286557265476675edf8555b4708c19f4cce629b5cc82822c61df5284b68e38d1a4519e5924d339c1ea9a1ae8bd0e208b0b01ce3cfa70ef30bcdb
7
+ data.tar.gz: 50b3a65514e3c96d45824f3b79e69d0d6c6492db0852023270a6b7ba8c70e2667ee1ec013f7a019ae4f4270cb36db3916c8813a19c6110091125e6df63cafda1
@@ -22,7 +22,7 @@ module Parliament
22
22
  #
23
23
  # @return [Integer, nil] the count of members of the Grom::Node or nil.
24
24
  def member_count
25
- respond_to?(:count) ? count.to_i : nil
25
+ respond_to?(:memberCount) ? memberCount.to_i : nil
26
26
  end
27
27
 
28
28
  # Alias groupEndDate with fallback.
@@ -31,6 +31,11 @@ module Parliament
31
31
  def end_date
32
32
  @end_date ||= respond_to?(:groupEndDate) ? DateTime.parse(groupEndDate) : nil
33
33
  end
34
+
35
+ # @return [Boolean] whether the group is also a formal body.
36
+ def formal_body?
37
+ type.include?('https://id.parliament.uk/schema/FormalBody')
38
+ end
34
39
  end
35
40
  end
36
41
  end
@@ -82,7 +82,7 @@ module Parliament
82
82
  #
83
83
  # @return [Array, Array] the seat incumbencies of the Grom::Node or an empty array.
84
84
  def seat_incumbencies
85
- @seat_incumbencies ||= incumbencies.select { |inc| inc.type == 'https://id.parliament.uk/schema/SeatIncumbency' }
85
+ @seat_incumbencies ||= incumbencies.select { |inc| inc.type.include?('https://id.parliament.uk/schema/SeatIncumbency') }
86
86
  end
87
87
 
88
88
  # @return [Grom::Node] the seat incumbency as a Grom::Node or nil
@@ -303,11 +303,11 @@ module Parliament
303
303
  private
304
304
 
305
305
  def current_member_by_house?(house_name)
306
- incumbencies.select { |incumbency| incumbency.house.name == house_name && incumbency.end_date.nil? }.any?
306
+ seat_incumbencies.select { |incumbency| incumbency.house.name == house_name && incumbency.end_date.nil? }.any?
307
307
  end
308
308
 
309
309
  def former_member_by_house?(house_name)
310
- incumbencies.select { |incumbency| incumbency.house.name == house_name && incumbency.end_date }.any?
310
+ seat_incumbencies.select { |incumbency| incumbency.house.name == house_name && incumbency.end_date }.any?
311
311
  end
312
312
 
313
313
  def house_membership_status
@@ -1,7 +1,7 @@
1
1
  module Parliament
2
2
  module Grom
3
3
  module Decorator
4
- VERSION = '0.25.0'.freeze
4
+ VERSION = '0.25.1'.freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parliament-grom-decorators
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.0
4
+ version: 0.25.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rebecca Appleyard
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-25 00:00:00.000000000 Z
11
+ date: 2018-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler