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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ae11f5c090b09b4e296269c1fb3d559e9790da8
4
- data.tar.gz: e057dd2abfcfae7ad4be43904ec522a08ca0784e
3
+ metadata.gz: b4650ff7f48180552a6176fec2265d8e8334b474
4
+ data.tar.gz: 42677c0f88c39172b12ab8e6322cfe5e3a2c3cfe
5
5
  SHA512:
6
- metadata.gz: 776b3c9e01428b6ffcf08294e76d4f7e86e222cbe2da5baedf4a519ceac1fa22b8e0a44a5efc03e4b535b155df602cdc8f96e393d355a2f413c0f56008d6a788
7
- data.tar.gz: 650e878d04618ec71ab2a5f371cee4e761fb8e35682ce938f607f6be59b06909bc6a64e3e1596bf6aa8f1e28657f58ad0c8d6fc7610cf8ec9241c93a8c26d7d4
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.
@@ -1,7 +1,7 @@
1
1
  module Parliament
2
2
  module Grom
3
3
  module Decorator
4
- VERSION = '0.8.0'.freeze
4
+ VERSION = '0.9.0'.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.8.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-09-28 00:00:00.000000000 Z
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