parliament-grom-decorators 0.16.4 → 0.17.0

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: 363de74fa7cb54f63fe176460f32aa492a155ecd
4
- data.tar.gz: 601835c1a208ae662d0d2f943160e319c78b5c01
3
+ metadata.gz: c5a3384204f9c1c73a66be5d233ce66db88b9712
4
+ data.tar.gz: '0018ada8f8a452e0833d3192cb4e10942e7586c7'
5
5
  SHA512:
6
- metadata.gz: da826ff0ed281561fadaf4f9311ed87de106743a4d1cfc24da6cb0e3a73472d9b3f8dd16904fd46c9fc139c7515091641f8f4c74da1300217999d9dbc4a60683
7
- data.tar.gz: 3720bfdffc89b98ed8997d132a4d1e21db3e08f0e362771ec1038d3f0ceb1ca6bcbb5aeada9daf036ab647605be765ad77e4db3011b8d2da4b7daef4e498be27
6
+ metadata.gz: eda2aeee9b09e461eb4dd218bf35b18b6ec055838eaa59481f554393b77ba97c4ea7f948c5e4b08f673ab7cec7c63538e106c21ae3cc885d948f89bf002c17ef
7
+ data.tar.gz: d0dfdad5d9e670d4123de29a0060711e438dc53cd313b074a516977336158bc4beea25836a0091d514e89a1157e1c8520bbbabdf06d44156c3ae24d43c01461f
@@ -27,6 +27,11 @@ require 'parliament/grom/decorator/audience'
27
27
  require 'parliament/grom/decorator/article_type'
28
28
  require 'parliament/grom/decorator/collection'
29
29
  require 'parliament/grom/decorator/concept'
30
+ require 'parliament/grom/decorator/incumbency'
31
+ require 'parliament/grom/decorator/group'
32
+ require 'parliament/grom/decorator/gov_register_government_organisation'
33
+ require 'parliament/grom/decorator/position'
34
+ require 'parliament/grom/decorator/formal_body_chair'
30
35
 
31
36
  # Namespace for classes and modules that handle connections to, and processing of data from the parliamentary API.
32
37
  # @since 0.1.0
@@ -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 FormalBodyChair
7
+ # Alias positionHasIncumbency with fallback.
8
+ #
9
+ # @return [Array, Array] all the incumbencies of the Grom::Node or an empty array.
10
+ def incumbencies
11
+ respond_to?(:positionHasIncumbency) ? positionHasIncumbency : []
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,32 @@
1
+ module Parliament
2
+ module Grom
3
+ module Decorator
4
+ # Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/GovRegisterGovernmentOrganisation.
5
+ # rubocop:disable ModuleLength
6
+ module GovRegisterGovernmentOrganisation
7
+ include Helpers::DateHelper
8
+
9
+ # Alias groupStartDate 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?(:groupStartDate) ? DateTime.parse(groupStartDate) : nil
14
+ end
15
+
16
+ # Alias groupEndDate with fallback.
17
+ #
18
+ # @return [DateTime, nil] the start date of the Grom::Node or nil.
19
+ def end_date
20
+ @end_date ||= respond_to?(:groupEndDate) ? DateTime.parse(groupEndDate) : nil
21
+ end
22
+
23
+ # Alias groupName with fallback.
24
+ #
25
+ # @return [String, String] the name of the Grom::Node or an empty string.
26
+ def name
27
+ respond_to?(:groupName) ? groupName : ''
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ module Parliament
2
+ module Grom
3
+ module Decorator
4
+ # Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/Group.
5
+ # rubocop:disable ModuleLength
6
+ module Group
7
+ include Helpers::DateHelper
8
+
9
+ # Alias groupStartDate 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?(:groupStartDate) ? DateTime.parse(groupStartDate) : nil
14
+ end
15
+
16
+ # Alias groupEndDate 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?(:groupEndDate) ? DateTime.parse(groupEndDate) : nil
21
+ end
22
+
23
+ # Alias groupName with fallback.
24
+ #
25
+ # @return [String, String] the name of the Grom::Node or an empty string.
26
+ def name
27
+ respond_to?(:groupName) ? groupName : ''
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,39 @@
1
+ module Parliament
2
+ module Grom
3
+ module Decorator
4
+ # Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/Incumbency.
5
+ # rubocop:disable ModuleLength
6
+ module Incumbency
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 incumbencyHasPerson with fallback.
31
+ #
32
+ # @return [Array, Array] the people related to the Grom::Node or an empty array.
33
+ def people
34
+ respond_to?(:incumbencyHasPerson) ? incumbencyHasPerson : []
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -65,11 +65,11 @@ module Parliament
65
65
  respond_to?(:personPimsId) ? personPimsId : nil
66
66
  end
67
67
 
68
- # Alias personMnisId with fallback.
68
+ # Alias memberMnisId with fallback.
69
69
  #
70
70
  # @return [Array, Array] the mnis_id of the Grom::Node or nil.
71
71
  def mnis_id
72
- respond_to?(:personMnisId) ? personMnisId : nil
72
+ respond_to?(:memberMnisId) ? memberMnisId : nil
73
73
  end
74
74
 
75
75
  # Alias memberHasParliamentaryIncumbency with fallback.
@@ -208,7 +208,8 @@ module Parliament
208
208
  end
209
209
 
210
210
  # Check whether they are a Member or a Lord from their latest seat incumbency.
211
- # Current incumbencies are higher priority when determining a person_type, therefore check first for former, then current
211
+ # Current incumbencies are higher priority when determining a person_type
212
+ # Therefore check first for former, then current
212
213
  # @return [String] 'member' if they are a member, 'lord' if they are a lord.
213
214
  def person_type
214
215
  person_type = 'member' if former_mp?
@@ -0,0 +1,23 @@
1
+ module Parliament
2
+ module Grom
3
+ module Decorator
4
+ # Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/Position.
5
+ # rubocop:disable ModuleLength
6
+ module Position
7
+ # Alias positionName with fallback.
8
+ #
9
+ # @return [String, String] the name of the Grom::Node or an empty string.
10
+ def name
11
+ respond_to?(:positionName) ? positionName : 'Chair'
12
+ end
13
+
14
+ # Alias positionHasIncumbency with fallback.
15
+ #
16
+ # @return [Array, Array] all the incumbencies of the Grom::Node or an empty array.
17
+ def incumbencies
18
+ respond_to?(:positionHasIncumbency) ? positionHasIncumbency : []
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,7 +1,7 @@
1
1
  module Parliament
2
2
  module Grom
3
3
  module Decorator
4
- VERSION = '0.16.4'.freeze
4
+ VERSION = '0.17.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.16.4
4
+ version: 0.17.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-02-12 00:00:00.000000000 Z
11
+ date: 2018-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -181,15 +181,19 @@ files:
181
181
  - lib/parliament/grom/decorator/contact_point.rb
182
182
  - lib/parliament/grom/decorator/european_region.rb
183
183
  - lib/parliament/grom/decorator/formal_body.rb
184
+ - lib/parliament/grom/decorator/formal_body_chair.rb
184
185
  - lib/parliament/grom/decorator/formal_body_membership.rb
185
186
  - lib/parliament/grom/decorator/gender.rb
186
187
  - lib/parliament/grom/decorator/gender_identity.rb
188
+ - lib/parliament/grom/decorator/gov_register_government_organisation.rb
187
189
  - lib/parliament/grom/decorator/government_incumbency.rb
188
190
  - lib/parliament/grom/decorator/government_position.rb
191
+ - lib/parliament/grom/decorator/group.rb
189
192
  - lib/parliament/grom/decorator/helpers.rb
190
193
  - lib/parliament/grom/decorator/helpers/date_helper.rb
191
194
  - lib/parliament/grom/decorator/house.rb
192
195
  - lib/parliament/grom/decorator/house_seat.rb
196
+ - lib/parliament/grom/decorator/incumbency.rb
193
197
  - lib/parliament/grom/decorator/member_image.rb
194
198
  - lib/parliament/grom/decorator/opposition_incumbency.rb
195
199
  - lib/parliament/grom/decorator/opposition_position.rb
@@ -198,6 +202,7 @@ files:
198
202
  - lib/parliament/grom/decorator/party.rb
199
203
  - lib/parliament/grom/decorator/party_membership.rb
200
204
  - lib/parliament/grom/decorator/person.rb
205
+ - lib/parliament/grom/decorator/position.rb
201
206
  - lib/parliament/grom/decorator/postal_address.rb
202
207
  - lib/parliament/grom/decorator/seat_incumbency.rb
203
208
  - lib/parliament/grom/decorator/version.rb