parliament-grom-decorators 0.8.0 → 0.9.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.rb +2 -0
- data/lib/parliament/grom/decorator/government_incumbency.rb +39 -0
- data/lib/parliament/grom/decorator/government_position.rb +16 -0
- data/lib/parliament/grom/decorator/person.rb +7 -0
- data/lib/parliament/grom/decorator/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: b4650ff7f48180552a6176fec2265d8e8334b474
|
|
4
|
+
data.tar.gz: 42677c0f88c39172b12ab8e6322cfe5e3a2c3cfe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: beb89d373e812607aa1fdf7c0dab6c6ee7b6e5f7c8d9abfa0b95f68a6ce50abca89d4c214e386c67d49c4091a90d714fdbca947d2fe9ccbdb32454d9e16b4bd3
|
|
7
|
+
data.tar.gz: ea9a8b33425b8e1278a9437c5df013e34741cb96f6aa04058a3f2c225ccb0c15d89b4b7d82c69d5e84a0762bc3be46acab989520a64c97750fa71d82b4fa6502
|
|
@@ -19,6 +19,8 @@ require 'parliament/grom/decorator/parliaments'
|
|
|
19
19
|
require 'parliament/grom/decorator/member_image'
|
|
20
20
|
require 'parliament/grom/decorator/formal_body_membership'
|
|
21
21
|
require 'parliament/grom/decorator/formal_body'
|
|
22
|
+
require 'parliament/grom/decorator/government_incumbency'
|
|
23
|
+
require 'parliament/grom/decorator/government_position'
|
|
22
24
|
|
|
23
25
|
# Namespace for classes and modules that handle connections to, and processing of data from the parliamentary API.
|
|
24
26
|
# @since 0.1.0
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module Parliament
|
|
2
|
+
module Grom
|
|
3
|
+
module Decorator
|
|
4
|
+
# Decorator namespace for Grom::Node instances with type: http://id.ukpds.org/schema/governmentIncumbency.
|
|
5
|
+
# rubocop:disable ModuleLength
|
|
6
|
+
module GovernmentIncumbency
|
|
7
|
+
include Helpers::DateHelper
|
|
8
|
+
|
|
9
|
+
# Alias incumbencyStartDate with fallback.
|
|
10
|
+
#
|
|
11
|
+
# @return [DateTime, nil] the start date of the Grom::Node or nil.
|
|
12
|
+
def start_date
|
|
13
|
+
@start_date ||= respond_to?(:incumbencyStartDate) ? DateTime.parse(incumbencyStartDate) : nil
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Alias incumbencyEndDate with fallback.
|
|
17
|
+
#
|
|
18
|
+
# @return [DateTime, nil] the end date of the Grom::Node or nil.
|
|
19
|
+
def end_date
|
|
20
|
+
@end_date ||= respond_to?(:incumbencyEndDate) ? DateTime.parse(incumbencyEndDate) : nil
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Checks if Grom::Node has an end date.
|
|
24
|
+
#
|
|
25
|
+
# @return [Boolean] a boolean depending on whether or not the Grom::Node has an end date.
|
|
26
|
+
def current?
|
|
27
|
+
end_date.nil?
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Alias governmentIncumbencyHasGovernmentPosition with fallback.
|
|
31
|
+
#
|
|
32
|
+
# @return [Grom::Node, nil] the start date of the Grom::Node or nil.
|
|
33
|
+
def government_position
|
|
34
|
+
respond_to?(:governmentIncumbencyHasGovernmentPosition) ? governmentIncumbencyHasGovernmentPosition&.first : nil
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Parliament
|
|
2
|
+
module Grom
|
|
3
|
+
module Decorator
|
|
4
|
+
# Decorator namespace for Grom::Node instances with type: http://id.ukpds.org/schema/governmentPosition.
|
|
5
|
+
# rubocop:disable ModuleLength
|
|
6
|
+
module GovernmentPosition
|
|
7
|
+
# Checks if Grom::Node has a name.
|
|
8
|
+
#
|
|
9
|
+
# @return [String, String] a string depending on whether or not the Grom::Node has a name.
|
|
10
|
+
def name
|
|
11
|
+
@name ||= respond_to?(:positionName) ? positionName : ''
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -190,6 +190,13 @@ module Parliament
|
|
|
190
190
|
respond_to?(:memberHasFormalBodyMembership) ? memberHasFormalBodyMembership : []
|
|
191
191
|
end
|
|
192
192
|
|
|
193
|
+
# Alias governmentIncumbency with fallback.
|
|
194
|
+
#
|
|
195
|
+
# @return [Array, Array] all the formal body memberships of the Grom::Node or an empty array.
|
|
196
|
+
def government_incumbencies
|
|
197
|
+
respond_to?(:governmentIncumbency) ? governmentIncumbency : []
|
|
198
|
+
end
|
|
199
|
+
|
|
193
200
|
# Alias personHasPersonWebLink with fallback.
|
|
194
201
|
#
|
|
195
202
|
# @return [Array|String, nil] all the weblinks of the Grom::Node or an nil.
|
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.9.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: 2017-
|
|
11
|
+
date: 2017-10-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -180,6 +180,8 @@ files:
|
|
|
180
180
|
- lib/parliament/grom/decorator/formal_body_membership.rb
|
|
181
181
|
- lib/parliament/grom/decorator/gender.rb
|
|
182
182
|
- lib/parliament/grom/decorator/gender_identity.rb
|
|
183
|
+
- lib/parliament/grom/decorator/government_incumbency.rb
|
|
184
|
+
- lib/parliament/grom/decorator/government_position.rb
|
|
183
185
|
- lib/parliament/grom/decorator/helpers.rb
|
|
184
186
|
- lib/parliament/grom/decorator/helpers/date_helper.rb
|
|
185
187
|
- lib/parliament/grom/decorator/house.rb
|