parliament-grom-decorators 0.13.0 → 0.14.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a365cf79a9716d137b5b33a9dd9d05e93cfac7a
|
4
|
+
data.tar.gz: 0daf64e5b13b9a9919b5e1f548256b69d555dfbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d56e3881f27d46dc69a034fcfd5a857f8a4d9b801b048765d5754c05ef0c27352f3e10f74d93ceb31dd2f23efa85d672765371da560daa832d1fe552750a90cb
|
7
|
+
data.tar.gz: 62bce71fb2d49892aa74a77d35ab495520b9eebc2361aca70b9240222e0628efdb31d92871eed04acb46acb814ace440bf23eecf26658daf8f21d70d685c4299
|
@@ -21,6 +21,8 @@ require 'parliament/grom/decorator/formal_body_membership'
|
|
21
21
|
require 'parliament/grom/decorator/formal_body'
|
22
22
|
require 'parliament/grom/decorator/government_incumbency'
|
23
23
|
require 'parliament/grom/decorator/government_position'
|
24
|
+
require 'parliament/grom/decorator/opposition_incumbency'
|
25
|
+
require 'parliament/grom/decorator/opposition_position'
|
24
26
|
|
25
27
|
# Namespace for classes and modules that handle connections to, and processing of data from the parliamentary API.
|
26
28
|
# @since 0.1.0
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Parliament
|
2
|
+
module Grom
|
3
|
+
module Decorator
|
4
|
+
# Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/oppositionIncumbency.
|
5
|
+
module OppositionIncumbency
|
6
|
+
include Helpers::DateHelper
|
7
|
+
|
8
|
+
# Alias incumbencyStartDate with fallback.
|
9
|
+
#
|
10
|
+
# @return [DateTime, nil] the start date of the Grom::Node or nil.
|
11
|
+
def start_date
|
12
|
+
@start_date ||= respond_to?(:incumbencyStartDate) ? DateTime.parse(incumbencyStartDate) : nil
|
13
|
+
end
|
14
|
+
|
15
|
+
# Alias incumbencyEndDate with fallback.
|
16
|
+
#
|
17
|
+
# @return [DateTime, nil] the end date of the Grom::Node or nil.
|
18
|
+
def end_date
|
19
|
+
@end_date ||= respond_to?(:incumbencyEndDate) ? DateTime.parse(incumbencyEndDate) : nil
|
20
|
+
end
|
21
|
+
|
22
|
+
# Checks if Grom::Node has an end date.
|
23
|
+
#
|
24
|
+
# @return [Boolean] a boolean depending on whether or not the Grom::Node has an end date.
|
25
|
+
def current?
|
26
|
+
end_date.nil?
|
27
|
+
end
|
28
|
+
|
29
|
+
# Alias oppositionIncumbencyHasGovernmentPosition with fallback.
|
30
|
+
#
|
31
|
+
# @return [Grom::Node, nil] the start date of the Grom::Node or nil.
|
32
|
+
def opposition_position
|
33
|
+
respond_to?(:oppositionIncumbencyHasOppositionPosition) ? oppositionIncumbencyHasOppositionPosition&.first : nil
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Parliament
|
2
|
+
module Grom
|
3
|
+
module Decorator
|
4
|
+
# Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/oppositionPosition.
|
5
|
+
module OppositionPosition
|
6
|
+
# Checks if Grom::Node has a name.
|
7
|
+
#
|
8
|
+
# @return [String, String] a string depending on whether or not the Grom::Node has a name.
|
9
|
+
def name
|
10
|
+
@name ||= respond_to?(:positionName) ? positionName : ''
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
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.
|
4
|
+
version: 0.14.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-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -188,6 +188,8 @@ files:
|
|
188
188
|
- lib/parliament/grom/decorator/house_incumbency.rb
|
189
189
|
- lib/parliament/grom/decorator/house_seat.rb
|
190
190
|
- lib/parliament/grom/decorator/member_image.rb
|
191
|
+
- lib/parliament/grom/decorator/opposition_incumbency.rb
|
192
|
+
- lib/parliament/grom/decorator/opposition_position.rb
|
191
193
|
- lib/parliament/grom/decorator/parliamentary_incumbency.rb
|
192
194
|
- lib/parliament/grom/decorator/parliaments.rb
|
193
195
|
- lib/parliament/grom/decorator/party.rb
|