parliament-grom-decorators 0.19.0 → 0.21.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 +4 -4
- data/lib/parliament/grom/decorator/formal_body.rb +21 -0
- data/lib/parliament/grom/decorator/formal_body_type.rb +16 -0
- data/lib/parliament/grom/decorator/group.rb +35 -0
- data/lib/parliament/grom/decorator/person.rb +21 -0
- data/lib/parliament/grom/decorator/version.rb +1 -1
- data/lib/parliament/grom/decorator.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 44c72d9a1e0fc0b7a40b4e1b97c79e3373354ee1
|
|
4
|
+
data.tar.gz: 3b32387abe30262d8d3f9f1a2dbad8c7b3a4b410
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 75044e486238942c833d16358f5338ee9ae8f365c45856d7a9e08e28250585f7aed5499b9954fc055fb00722d4862f364d6030091c4e5aa41881071d39c7b542
|
|
7
|
+
data.tar.gz: 263affcc1f71617e4510aded468623899ee118f775c56326c3aee1cc143ba1b9cd760814818dacc060dacbf619ff0f81270d80188e0d28879bf30af77e93b2ed
|
|
@@ -13,6 +13,13 @@ module Parliament
|
|
|
13
13
|
@name ||= respond_to?(:formalBodyName) ? formalBodyName : ''
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
+
# Checks if Grom::Node has a chair.
|
|
17
|
+
#
|
|
18
|
+
# @return [Boolean] a boolean depending on whether or not the Grom::Node is chair.
|
|
19
|
+
def has_chair?
|
|
20
|
+
respond_to?(:formalBodyHasFormalBodyChair)
|
|
21
|
+
end
|
|
22
|
+
|
|
16
23
|
# Alias formalBodyStartDate with fallback.
|
|
17
24
|
#
|
|
18
25
|
# @return [DateTime, nil] the start date of the Grom::Node or nil.
|
|
@@ -20,6 +27,20 @@ module Parliament
|
|
|
20
27
|
@start_date ||= respond_to?(:formalBodyStartDate) ? DateTime.parse(formalBodyStartDate) : nil
|
|
21
28
|
end
|
|
22
29
|
|
|
30
|
+
# Checks if Grom::Node has a remit.
|
|
31
|
+
#
|
|
32
|
+
# @return [String, String] a string depending on whether or not the Grom::Node has a remit.
|
|
33
|
+
def remit
|
|
34
|
+
@remit ||= respond_to?(:formalBodyRemit) ? formalBodyRemit : ''
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Checks if Grom::Node is joint.
|
|
38
|
+
#
|
|
39
|
+
# @return [Boolean] a boolean depending on whether or not the Grom::Node is joint.
|
|
40
|
+
def joint?
|
|
41
|
+
respond_to?(:formalBodyHasLeadHouse)
|
|
42
|
+
end
|
|
43
|
+
|
|
23
44
|
# Alias formalBodyEndDate with fallback.
|
|
24
45
|
#
|
|
25
46
|
# @return [DateTime, nil] the end date of the Grom::Node or nil.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Parliament
|
|
2
|
+
module Grom
|
|
3
|
+
module Decorator
|
|
4
|
+
# Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/FormalBodyChair.
|
|
5
|
+
# rubocop:disable ModuleLength
|
|
6
|
+
module FormalBodyType
|
|
7
|
+
# Checks if Grom::Node has a formal body type name.
|
|
8
|
+
#
|
|
9
|
+
# @return [String, String] a string depending on whether or not the Grom::Node has a formal body type name.
|
|
10
|
+
def name
|
|
11
|
+
respond_to?(:formalbodyTypeName) ? formalbodyTypeName : ''
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -13,6 +13,41 @@ module Parliament
|
|
|
13
13
|
@start_date ||= respond_to?(:groupStartDate) ? DateTime.parse(groupStartDate) : nil
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
+
# Alias formalBodyName with fallback.
|
|
17
|
+
#
|
|
18
|
+
# @return [String, String] the formal body name of the Grom::Node or an empty string.
|
|
19
|
+
def formal_body_name
|
|
20
|
+
@formal_body_name ||= respond_to?(:formalBodyName) ? formalBodyName : ''
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Alias formalBodyRemit with fallback.
|
|
24
|
+
#
|
|
25
|
+
# @return [String, String] the formal body remit of the Grom::Node or an empty string.
|
|
26
|
+
def formal_body_remit
|
|
27
|
+
@formal_body_remit ||= respond_to?(:formalBodyRemit) ? formalBodyRemit : ''
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Alias member count with fallback.
|
|
31
|
+
#
|
|
32
|
+
# @return [Integer, nil] the count of members of the Grom::Node or nil.
|
|
33
|
+
def member_count
|
|
34
|
+
respond_to?(:count) ? count.to_i : nil
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Alias is_joint with fallback.
|
|
38
|
+
#
|
|
39
|
+
# @return [Boolean] a boolean depending on whether or not the Grom::Node is joint.
|
|
40
|
+
def joint?
|
|
41
|
+
respond_to?(:formalBodyHasLeadHouse)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Alias is_chair with fallback.
|
|
45
|
+
#
|
|
46
|
+
# @return [Boolean] a boolean depending on whether or not the Grom::Node is chair.
|
|
47
|
+
def has_chair?
|
|
48
|
+
respond_to?(:formalBodyHasFormalBodyChair)
|
|
49
|
+
end
|
|
50
|
+
|
|
16
51
|
# Alias groupEndDate with fallback.
|
|
17
52
|
#
|
|
18
53
|
# @return [DateTime, nil] the end date of the Grom::Node or nil.
|
|
@@ -200,6 +200,27 @@ module Parliament
|
|
|
200
200
|
current_member_by_house?('House of Lords')
|
|
201
201
|
end
|
|
202
202
|
|
|
203
|
+
# Check whether member is an ex_officio?.
|
|
204
|
+
#
|
|
205
|
+
# @return [Boolean] a boolean depending on whether or not member is an ex_officio?
|
|
206
|
+
def ex_officio?
|
|
207
|
+
respond_to?(:memberHasExOfficioMembership)
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
# Check whether member is an alternate?.
|
|
211
|
+
#
|
|
212
|
+
# @return [Boolean] a boolean depending on whether or not member is an alternate?
|
|
213
|
+
def alternate?
|
|
214
|
+
respond_to?(:memberHasAlternateMembership)
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
# Check whether person is a lay member?.
|
|
218
|
+
#
|
|
219
|
+
# @return [Boolean] a boolean depending on whether or person is a lay member or not
|
|
220
|
+
def lay_member?
|
|
221
|
+
respond_to?(:formalBodyLayPersonMnisId)
|
|
222
|
+
end
|
|
223
|
+
|
|
203
224
|
# Check whether they are a former member of the House of Lords.
|
|
204
225
|
#
|
|
205
226
|
# @return [Boolean] a boolean depending on whether or not they have a current seat incumbency in the House of Lords.
|
|
@@ -18,6 +18,7 @@ require 'parliament/grom/decorator/parliaments'
|
|
|
18
18
|
require 'parliament/grom/decorator/member_image'
|
|
19
19
|
require 'parliament/grom/decorator/formal_body_membership'
|
|
20
20
|
require 'parliament/grom/decorator/formal_body'
|
|
21
|
+
require 'parliament/grom/decorator/formal_body_type'
|
|
21
22
|
require 'parliament/grom/decorator/government_incumbency'
|
|
22
23
|
require 'parliament/grom/decorator/government_position'
|
|
23
24
|
require 'parliament/grom/decorator/opposition_incumbency'
|
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.
|
|
4
|
+
version: 0.21.0
|
|
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-03-
|
|
11
|
+
date: 2018-03-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -183,6 +183,7 @@ files:
|
|
|
183
183
|
- lib/parliament/grom/decorator/formal_body.rb
|
|
184
184
|
- lib/parliament/grom/decorator/formal_body_chair.rb
|
|
185
185
|
- lib/parliament/grom/decorator/formal_body_membership.rb
|
|
186
|
+
- lib/parliament/grom/decorator/formal_body_type.rb
|
|
186
187
|
- lib/parliament/grom/decorator/gender.rb
|
|
187
188
|
- lib/parliament/grom/decorator/gender_identity.rb
|
|
188
189
|
- lib/parliament/grom/decorator/gov_register_government_organisation.rb
|