parliament-grom-decorators 0.32.1 → 1.0.0.pre.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/.travis.yml +1 -2
- data/config/locales/en.yml +0 -15
- data/lib/parliament/grom/decorator/group.rb +0 -18
- data/lib/parliament/grom/decorator/helpers/date_helper.rb +4 -0
- data/lib/parliament/grom/decorator/helpers/utils.rb +37 -0
- data/lib/parliament/grom/decorator/helpers.rb +2 -0
- data/lib/parliament/grom/decorator/laid_thing.rb +4 -1
- data/lib/parliament/grom/decorator/laying.rb +8 -2
- data/lib/parliament/grom/decorator/person.rb +0 -336
- data/lib/parliament/grom/decorator/procedure.rb +0 -13
- data/lib/parliament/grom/decorator/proposed_negative_statutory_instrument_paper.rb +0 -7
- data/lib/parliament/grom/decorator/statutory_instrument_paper.rb +0 -35
- data/lib/parliament/grom/decorator/version.rb +1 -1
- data/lib/parliament/grom/decorator/work_package.rb +3 -33
- data/lib/parliament/grom/decorator/work_packaged_thing.rb +4 -8
- data/parliament-grom-decorators.gemspec +1 -1
- metadata +8 -48
- data/lib/parliament/grom/decorator/answer.rb +0 -37
- data/lib/parliament/grom/decorator/answering_body.rb +0 -22
- data/lib/parliament/grom/decorator/answering_body_allocation.rb +0 -15
- data/lib/parliament/grom/decorator/article_type.rb +0 -17
- data/lib/parliament/grom/decorator/audience.rb +0 -17
- data/lib/parliament/grom/decorator/business_item.rb +0 -44
- data/lib/parliament/grom/decorator/collection.rb +0 -62
- data/lib/parliament/grom/decorator/concept.rb +0 -50
- data/lib/parliament/grom/decorator/constituency_area.rb +0 -29
- data/lib/parliament/grom/decorator/constituency_group.rb +0 -133
- data/lib/parliament/grom/decorator/contact_point.rb +0 -54
- data/lib/parliament/grom/decorator/european_region.rb +0 -29
- data/lib/parliament/grom/decorator/formal_body.rb +0 -100
- data/lib/parliament/grom/decorator/formal_body_chair.rb +0 -15
- data/lib/parliament/grom/decorator/formal_body_membership.rb +0 -45
- data/lib/parliament/grom/decorator/formal_body_type.rb +0 -15
- data/lib/parliament/grom/decorator/gender.rb +0 -15
- data/lib/parliament/grom/decorator/gender_identity.rb +0 -15
- data/lib/parliament/grom/decorator/gov_register_government_organisation.rb +0 -31
- data/lib/parliament/grom/decorator/government_incumbency.rb +0 -38
- data/lib/parliament/grom/decorator/government_position.rb +0 -15
- data/lib/parliament/grom/decorator/house.rb +0 -57
- data/lib/parliament/grom/decorator/house_seat.rb +0 -29
- data/lib/parliament/grom/decorator/incumbency.rb +0 -38
- data/lib/parliament/grom/decorator/laying_body.rb +0 -15
- data/lib/parliament/grom/decorator/member_image.rb +0 -15
- data/lib/parliament/grom/decorator/opposition_incumbency.rb +0 -38
- data/lib/parliament/grom/decorator/opposition_position.rb +0 -15
- data/lib/parliament/grom/decorator/parliamentary_incumbency.rb +0 -59
- data/lib/parliament/grom/decorator/parliaments.rb +0 -52
- data/lib/parliament/grom/decorator/party.rb +0 -52
- data/lib/parliament/grom/decorator/party_membership.rb +0 -38
- data/lib/parliament/grom/decorator/position.rb +0 -22
- data/lib/parliament/grom/decorator/postal_address.rb +0 -26
- data/lib/parliament/grom/decorator/procedure_route.rb +0 -15
- data/lib/parliament/grom/decorator/procedure_step.rb +0 -36
- data/lib/parliament/grom/decorator/question.rb +0 -72
- data/lib/parliament/grom/decorator/seat_incumbency.rb +0 -82
- data/lib/parliament/grom/decorator/treaty.rb +0 -9
- data/lib/parliament/grom/decorator/web_article.rb +0 -71
- data/lib/parliament/grom/decorator/work_packageable_thing.rb +0 -43
@@ -3,18 +3,14 @@ module Parliament
|
|
3
3
|
module Decorator
|
4
4
|
# Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/WorkdPackagedThing
|
5
5
|
module WorkPackagedThing
|
6
|
-
# Alias workPackagedThingHasWorkPackagedThingWebLink with fallback.
|
7
|
-
#
|
8
|
-
# @return [String, String] a web link to view the statutory instrument Grom::Node or an empty string.
|
9
|
-
def web_link
|
10
|
-
respond_to?(:workPackagedThingHasWorkPackagedThingWebLink) ? workPackagedThingHasWorkPackagedThingWebLink : ''
|
11
|
-
end
|
12
|
-
|
13
6
|
# Alias workPackagedThingHasWorkPackage with fallback.
|
14
7
|
#
|
15
8
|
# @return [Grom::Node, nil] a work package Grom::Node or nil.
|
16
9
|
def work_package
|
17
|
-
|
10
|
+
return @work_package if @work_package
|
11
|
+
return nil unless respond_to?(:workPackagedThingHasWorkPackage)
|
12
|
+
|
13
|
+
@work_package = Helpers::Utils.type_safe_first(workPackagedThingHasWorkPackage, Parliament::Grom::Decorator::WorkPackage)
|
18
14
|
end
|
19
15
|
end
|
20
16
|
end
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
|
-
spec.add_development_dependency 'bundler', '~>
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.14'
|
24
24
|
spec.add_development_dependency 'rake', '~> 10.0'
|
25
25
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
26
26
|
spec.add_development_dependency 'rubocop', '~> 0.51'
|
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: 1.0.0.pre.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rebecca Appleyard
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '1.14'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '1.14'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -187,58 +187,18 @@ files:
|
|
187
187
|
- config/locales/en.yml
|
188
188
|
- gocd/web1live.yaml
|
189
189
|
- lib/parliament/grom/decorator.rb
|
190
|
-
- lib/parliament/grom/decorator/answer.rb
|
191
|
-
- lib/parliament/grom/decorator/answering_body.rb
|
192
|
-
- lib/parliament/grom/decorator/answering_body_allocation.rb
|
193
|
-
- lib/parliament/grom/decorator/article_type.rb
|
194
|
-
- lib/parliament/grom/decorator/audience.rb
|
195
|
-
- lib/parliament/grom/decorator/business_item.rb
|
196
|
-
- lib/parliament/grom/decorator/collection.rb
|
197
|
-
- lib/parliament/grom/decorator/concept.rb
|
198
|
-
- lib/parliament/grom/decorator/constituency_area.rb
|
199
|
-
- lib/parliament/grom/decorator/constituency_group.rb
|
200
|
-
- lib/parliament/grom/decorator/contact_point.rb
|
201
|
-
- lib/parliament/grom/decorator/european_region.rb
|
202
|
-
- lib/parliament/grom/decorator/formal_body.rb
|
203
|
-
- lib/parliament/grom/decorator/formal_body_chair.rb
|
204
|
-
- lib/parliament/grom/decorator/formal_body_membership.rb
|
205
|
-
- lib/parliament/grom/decorator/formal_body_type.rb
|
206
|
-
- lib/parliament/grom/decorator/gender.rb
|
207
|
-
- lib/parliament/grom/decorator/gender_identity.rb
|
208
|
-
- lib/parliament/grom/decorator/gov_register_government_organisation.rb
|
209
|
-
- lib/parliament/grom/decorator/government_incumbency.rb
|
210
|
-
- lib/parliament/grom/decorator/government_position.rb
|
211
190
|
- lib/parliament/grom/decorator/group.rb
|
212
191
|
- lib/parliament/grom/decorator/helpers.rb
|
213
192
|
- lib/parliament/grom/decorator/helpers/date_helper.rb
|
214
|
-
- lib/parliament/grom/decorator/
|
215
|
-
- lib/parliament/grom/decorator/house_seat.rb
|
216
|
-
- lib/parliament/grom/decorator/incumbency.rb
|
193
|
+
- lib/parliament/grom/decorator/helpers/utils.rb
|
217
194
|
- lib/parliament/grom/decorator/laid_thing.rb
|
218
195
|
- lib/parliament/grom/decorator/laying.rb
|
219
|
-
- lib/parliament/grom/decorator/laying_body.rb
|
220
|
-
- lib/parliament/grom/decorator/member_image.rb
|
221
|
-
- lib/parliament/grom/decorator/opposition_incumbency.rb
|
222
|
-
- lib/parliament/grom/decorator/opposition_position.rb
|
223
|
-
- lib/parliament/grom/decorator/parliamentary_incumbency.rb
|
224
|
-
- lib/parliament/grom/decorator/parliaments.rb
|
225
|
-
- lib/parliament/grom/decorator/party.rb
|
226
|
-
- lib/parliament/grom/decorator/party_membership.rb
|
227
196
|
- lib/parliament/grom/decorator/person.rb
|
228
|
-
- lib/parliament/grom/decorator/position.rb
|
229
|
-
- lib/parliament/grom/decorator/postal_address.rb
|
230
197
|
- lib/parliament/grom/decorator/procedure.rb
|
231
|
-
- lib/parliament/grom/decorator/procedure_route.rb
|
232
|
-
- lib/parliament/grom/decorator/procedure_step.rb
|
233
198
|
- lib/parliament/grom/decorator/proposed_negative_statutory_instrument_paper.rb
|
234
|
-
- lib/parliament/grom/decorator/question.rb
|
235
|
-
- lib/parliament/grom/decorator/seat_incumbency.rb
|
236
199
|
- lib/parliament/grom/decorator/statutory_instrument_paper.rb
|
237
|
-
- lib/parliament/grom/decorator/treaty.rb
|
238
200
|
- lib/parliament/grom/decorator/version.rb
|
239
|
-
- lib/parliament/grom/decorator/web_article.rb
|
240
201
|
- lib/parliament/grom/decorator/work_package.rb
|
241
|
-
- lib/parliament/grom/decorator/work_packageable_thing.rb
|
242
202
|
- lib/parliament/grom/decorator/work_packaged_thing.rb
|
243
203
|
- makefile
|
244
204
|
- parliament-grom-decorators.gemspec
|
@@ -256,12 +216,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
256
216
|
version: '0'
|
257
217
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
258
218
|
requirements:
|
259
|
-
- - "
|
219
|
+
- - ">"
|
260
220
|
- !ruby/object:Gem::Version
|
261
|
-
version:
|
221
|
+
version: 1.3.1
|
262
222
|
requirements: []
|
263
223
|
rubyforge_project:
|
264
|
-
rubygems_version: 2.
|
224
|
+
rubygems_version: 2.6.8
|
265
225
|
signing_key:
|
266
226
|
specification_version: 4
|
267
227
|
summary: Parliamentary Grom decorator
|
@@ -1,37 +0,0 @@
|
|
1
|
-
module Parliament
|
2
|
-
module Grom
|
3
|
-
module Decorator
|
4
|
-
# Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/Answer.
|
5
|
-
module Answer
|
6
|
-
include Helpers::DateHelper
|
7
|
-
# Alias answerText with fallback.
|
8
|
-
#
|
9
|
-
# @return [String, String] the text of the Grom::Node or an empty string.
|
10
|
-
def text
|
11
|
-
respond_to?(:answerText) ? answerText : ''
|
12
|
-
end
|
13
|
-
|
14
|
-
# Alias answerGivenDate with fallback.
|
15
|
-
#
|
16
|
-
# @return [DateTime, nil] the answer date of the Grom::Node or nil.
|
17
|
-
def answer_given_date
|
18
|
-
@answer_given_date ||= respond_to?(:answerGivenDate) ? DateTime.parse(answerGivenDate) : nil
|
19
|
-
end
|
20
|
-
|
21
|
-
# Alias answerHasAnsweringPerson with fallback.
|
22
|
-
#
|
23
|
-
# @return [Grom::Node, nil] the answering_person of the Grom::Node or nil.
|
24
|
-
def answering_person
|
25
|
-
respond_to?(:answerHasAnsweringPerson) ? answerHasAnsweringPerson.first : nil
|
26
|
-
end
|
27
|
-
|
28
|
-
# Alias answerHasQuestion with fallback.
|
29
|
-
#
|
30
|
-
# @return [Grom::Node, nil] the question of the Grom::Node or nil.
|
31
|
-
def question
|
32
|
-
respond_to?(:answerHasQuestion) ? answerHasQuestion.first : nil
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module Parliament
|
2
|
-
module Grom
|
3
|
-
module Decorator
|
4
|
-
# Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/AnsweringBody.
|
5
|
-
module AnsweringBody
|
6
|
-
# Alias groupName with fallback.
|
7
|
-
#
|
8
|
-
# @return [String, String] the name of the Grom::Node or an empty string.
|
9
|
-
def name
|
10
|
-
respond_to?(:groupName) ? groupName : ''
|
11
|
-
end
|
12
|
-
|
13
|
-
# Alias answeringBodyHasAnswer with fallback.
|
14
|
-
#
|
15
|
-
# @return [Grom::Node, []] the answer of the Grom::Node or nil.
|
16
|
-
def answers
|
17
|
-
respond_to?(:answeringBodyHasAnswer) ? answeringBodyHasAnswer : []
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Parliament
|
2
|
-
module Grom
|
3
|
-
module Decorator
|
4
|
-
# Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/AnsweringBodyAllocation.
|
5
|
-
module AnsweringBodyAllocation
|
6
|
-
# Alias answeringBodyAllocationHasAnsweringBody with fallback.
|
7
|
-
#
|
8
|
-
# @return [Grom::Node, nil] the answering_body of the Grom::Node or nil.
|
9
|
-
def answering_body
|
10
|
-
respond_to?(:answeringBodyAllocationHasAnsweringBody) ? answeringBodyAllocationHasAnsweringBody.first : nil
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module Parliament
|
2
|
-
module Grom
|
3
|
-
module Decorator
|
4
|
-
# Decorator namespace for Grom::Node instances with type: http://example.com/content/ArticleType
|
5
|
-
# ArticleType Grom::Node is a Contentful object associated with a web article (a WebArticle has an Audience node)
|
6
|
-
# ArticleType Grom::Node is not modelled in the data service, hence type 'http://example..' and not 'https://id.parliament.uk/schema'
|
7
|
-
module ArticleType
|
8
|
-
# Alias name with fallback.
|
9
|
-
#
|
10
|
-
# @return [String, String] the title of the Grom::Node or an empty string.
|
11
|
-
def article_type_name
|
12
|
-
respond_to?(:name) ? name : ''
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module Parliament
|
2
|
-
module Grom
|
3
|
-
module Decorator
|
4
|
-
# Decorator namespace for Grom::Node instances with type: http://example.com/content/Audience
|
5
|
-
# Audience Grom::Node is a Contentful object associated with a web article (a WebArticle has an Audience node)
|
6
|
-
# Audience Grom::Node is not modelled in the data service, hence type 'http://example..' and not 'https://id.parliament.uk/schema'
|
7
|
-
module Audience
|
8
|
-
# Alias name with fallback.
|
9
|
-
#
|
10
|
-
# @return [String, String] the title of the Grom::Node or an empty string.
|
11
|
-
def audience_name
|
12
|
-
respond_to?(:name) ? name : ''
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
module Parliament
|
2
|
-
module Grom
|
3
|
-
module Decorator
|
4
|
-
# Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/BusinessItem
|
5
|
-
module BusinessItem
|
6
|
-
include Helpers::DateHelper
|
7
|
-
# Alias businessItemHasProcedureStep with fallback.
|
8
|
-
#
|
9
|
-
# @return [Array, Array] an array of ProcedureStep Grom::Nodes of the Grom::Node or an empty array.
|
10
|
-
def procedure_steps
|
11
|
-
respond_to?(:businessItemHasProcedureStep) ? businessItemHasProcedureStep : []
|
12
|
-
end
|
13
|
-
|
14
|
-
# Each procedure step has a distance from origin
|
15
|
-
#
|
16
|
-
# @return [Array] an array of ProcedureStep Grom::Nodes sorted by distance from origin.
|
17
|
-
def sorted_procedure_steps_by_distance
|
18
|
-
procedure_steps.sort_by(&:distance_from_origin)
|
19
|
-
end
|
20
|
-
|
21
|
-
# Finds, for each of the procedure steps belonging to a business item, the shortest distance from origin
|
22
|
-
#
|
23
|
-
# @return [Integer, nil] shortest distance of procedure steps from origin or nil.
|
24
|
-
def shortest_distance_of_procedure_steps
|
25
|
-
sorted_procedure_steps_by_distance.first&.distance_from_origin
|
26
|
-
end
|
27
|
-
|
28
|
-
# Alias businessItemDate with fallback.
|
29
|
-
#
|
30
|
-
# @return [Date, nil] a laying date or nil.
|
31
|
-
def date
|
32
|
-
respond_to?(:businessItemDate) ? DateTime.parse(businessItemDate) : nil
|
33
|
-
end
|
34
|
-
|
35
|
-
# Alias businessItemHasBusinessItemWebLink with fallback.
|
36
|
-
#
|
37
|
-
# @return [String, String] a web link to view business item Grom::Node or an empty string.
|
38
|
-
def weblink
|
39
|
-
respond_to?(:businessItemHasBusinessItemWebLink) ? businessItemHasBusinessItemWebLink : ''
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
module Parliament
|
2
|
-
module Grom
|
3
|
-
module Decorator
|
4
|
-
# Decorator namespace for Grom::Node instances with type: http://example.com/content/Collection
|
5
|
-
# Collection Grom::Node is a Contentful object associated with a web article (a WebArticle has an Audience node)
|
6
|
-
# Collection Grom::Node is not modelled in the data service, hence type 'http://example..' and not 'https://id.parliament.uk/schema'
|
7
|
-
module Collection
|
8
|
-
# Alias collectionName with fallback.
|
9
|
-
#
|
10
|
-
# @return [String, String] the name of the Grom::Node or an empty string.
|
11
|
-
def name
|
12
|
-
respond_to?(:collectionName) ? collectionName : ''
|
13
|
-
end
|
14
|
-
|
15
|
-
# Alias collectionDescription with fallback.
|
16
|
-
#
|
17
|
-
# @return [String, String] the description of the Grom::Node or an empty string.
|
18
|
-
def description
|
19
|
-
respond_to?(:collectionDescription) ? collectionDescription : ''
|
20
|
-
end
|
21
|
-
|
22
|
-
# Alias collectionExtendedDescription with fallback.
|
23
|
-
#
|
24
|
-
# @return [String, String] the extended description of the Grom::Node or an empty string.
|
25
|
-
def extended_description
|
26
|
-
respond_to?(:collectionExtendedDescription) ? collectionExtendedDescription : ''
|
27
|
-
end
|
28
|
-
|
29
|
-
# Alias collectionHasArticle with fallback.
|
30
|
-
#
|
31
|
-
# @return [Array, Array] an array of Articles related to the Grom::Node or an empty Array.
|
32
|
-
def articles
|
33
|
-
respond_to?(:collectionHasArticle) ? collectionHasArticle : []
|
34
|
-
end
|
35
|
-
|
36
|
-
# Alias collectionHasSubcollection with fallback.
|
37
|
-
#
|
38
|
-
# @return [Array, Array] an array of Subcollections related to the Grom::Node or an empty Array.
|
39
|
-
def subcollections
|
40
|
-
respond_to?(:collectionHasSubcollection) ? collectionHasSubcollection : []
|
41
|
-
end
|
42
|
-
|
43
|
-
# Alias collectionHasParent with fallback.
|
44
|
-
#
|
45
|
-
# @return [Array, Array] an array of parent collections related to the Grom::Node or an empty Array.
|
46
|
-
def parents
|
47
|
-
respond_to?(:collectionHasParent) ? collectionHasParent : []
|
48
|
-
end
|
49
|
-
|
50
|
-
# Travel up the ancestry trees finding orphaned collections
|
51
|
-
#
|
52
|
-
# @return [Array, Array] an array of orphaned ancestral collections related to the Grom::Node or an empty Array.
|
53
|
-
def orphaned_ancestors(nodes = parents)
|
54
|
-
orphans = nodes.select { |node| node.parents.none? }
|
55
|
-
parent_nodes = (nodes - orphans).map(&:parents).flatten
|
56
|
-
orphans += orphaned_ancestors(parent_nodes) if parent_nodes.any?
|
57
|
-
orphans
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
module Parliament
|
2
|
-
module Grom
|
3
|
-
module Decorator
|
4
|
-
# Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/Concept
|
5
|
-
module Concept
|
6
|
-
# Alias conceptLabel with fallback.
|
7
|
-
#
|
8
|
-
# @return [String, String] the IDMS title of the Grom::Node or an empty string.
|
9
|
-
def name
|
10
|
-
respond_to?(:conceptLabel) ? conceptLabel : ''
|
11
|
-
end
|
12
|
-
|
13
|
-
# Alias conceptScopeNote with fallback.
|
14
|
-
#
|
15
|
-
# @return [String, String] the IDMS description of the Grom::Node or an empty string.
|
16
|
-
def description
|
17
|
-
respond_to?(:conceptScopeNote) ? conceptScopeNote : ''
|
18
|
-
end
|
19
|
-
|
20
|
-
# Alias conceptDefinition with fallback.
|
21
|
-
#
|
22
|
-
# @return [String, String] the IDMS description of the Grom::Node or an empty string.
|
23
|
-
def definition
|
24
|
-
respond_to?(:conceptDefinition) ? conceptDefinition : ''
|
25
|
-
end
|
26
|
-
|
27
|
-
# Alias conceptHasSubjectTaggedThing with fallback.
|
28
|
-
#
|
29
|
-
# @return [Array, Array] array of WebArticle Grom::Nodes tagged with that concept or an empty array.
|
30
|
-
def tagged_articles
|
31
|
-
respond_to?(:conceptHasSubjectTaggedThing) ? conceptHasSubjectTaggedThing : []
|
32
|
-
end
|
33
|
-
|
34
|
-
# Alias conceptHasBroaderConcept with fallback.
|
35
|
-
#
|
36
|
-
# @return [Array, Array] array of parent Concept Grom::Nodes or an empty array.
|
37
|
-
def broader_concepts
|
38
|
-
respond_to?(:conceptHasBroaderConcept) ? conceptHasBroaderConcept : []
|
39
|
-
end
|
40
|
-
|
41
|
-
# Alias conceptHasNarrowerConcept with fallback.
|
42
|
-
#
|
43
|
-
# @return [Array, Array] array of child Concept Grom::Nodes or an empty array.
|
44
|
-
def narrower_concepts
|
45
|
-
respond_to?(:conceptHasNarrowerConcept) ? conceptHasNarrowerConcept : []
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module Parliament
|
2
|
-
module Grom
|
3
|
-
module Decorator
|
4
|
-
# Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/ConstituencyArea
|
5
|
-
module ConstituencyArea
|
6
|
-
# Alias constituencyAreaLatitude with fallback.
|
7
|
-
#
|
8
|
-
# @return [String, String] the latitude of the Grom::Node or an empty string.
|
9
|
-
def latitude
|
10
|
-
respond_to?(:constituencyAreaLatitude) ? constituencyAreaLatitude : ''
|
11
|
-
end
|
12
|
-
|
13
|
-
# Alias constituencyAreaLongitude with fallback.
|
14
|
-
#
|
15
|
-
# @return [String, String] the longitude of the Grom::Node or an empty string.
|
16
|
-
def longitude
|
17
|
-
respond_to?(:constituencyAreaLongitude) ? constituencyAreaLongitude : ''
|
18
|
-
end
|
19
|
-
|
20
|
-
# Alias constituencyAreaExtent with fallback.
|
21
|
-
#
|
22
|
-
# @return [String, String] the polygon of the Grom::Node or an empty string.
|
23
|
-
def polygon
|
24
|
-
respond_to?(:constituencyAreaExtent) ? constituencyAreaExtent : []
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,133 +0,0 @@
|
|
1
|
-
module Parliament
|
2
|
-
module Grom
|
3
|
-
module Decorator
|
4
|
-
# Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/ConstituencyGroup
|
5
|
-
#
|
6
|
-
# attr [Boolean] correct verifies that the Grom::Node is the expected constituency. This is used in conjunction with postcode lookup to verify if the Grom::Node is the expected constituency.
|
7
|
-
module ConstituencyGroup
|
8
|
-
include Helpers::DateHelper
|
9
|
-
|
10
|
-
attr_accessor :correct
|
11
|
-
# Alias constituencyGroupName with fallback.
|
12
|
-
#
|
13
|
-
# @return [String, String] the name of the Grom::Node or an empty string.
|
14
|
-
def name
|
15
|
-
respond_to?(:constituencyGroupName) ? constituencyGroupName : ''
|
16
|
-
end
|
17
|
-
|
18
|
-
# Alias constituencyGroupStartDate with fallback.
|
19
|
-
#
|
20
|
-
# @return [DateTime, nil] the start date of the Grom::Node or nil.
|
21
|
-
def start_date
|
22
|
-
@start_date ||= respond_to?(:constituencyGroupStartDate) ? DateTime.parse(constituencyGroupStartDate) : nil
|
23
|
-
end
|
24
|
-
|
25
|
-
# Alias constituencyGroupEndDate with fallback.
|
26
|
-
#
|
27
|
-
# @return [DateTime, nil] the end date of the Grom::Node or nil.
|
28
|
-
def end_date
|
29
|
-
@end_date ||= respond_to?(:constituencyGroupEndDate) ? DateTime.parse(constituencyGroupEndDate) : nil
|
30
|
-
end
|
31
|
-
|
32
|
-
# Alias constituencyGroupHasHouseSeat with fallback.
|
33
|
-
#
|
34
|
-
# @return [Array, Array] the house seats of the Grom::Node or an empty array.
|
35
|
-
def seats
|
36
|
-
respond_to?(:constituencyGroupHasHouseSeat) ? constituencyGroupHasHouseSeat : []
|
37
|
-
end
|
38
|
-
|
39
|
-
# Alias houseSeatHasSeatIncumbency with fallback.
|
40
|
-
#
|
41
|
-
# @return [Array, Array] the seat incumbencies of the Grom::Node or an empty array.
|
42
|
-
def seat_incumbencies
|
43
|
-
return @seat_incumbencies unless @seat_incumbencies.nil?
|
44
|
-
|
45
|
-
seat_incumbencies = []
|
46
|
-
seats.each do |seat|
|
47
|
-
seat_incumbencies << seat.seat_incumbencies
|
48
|
-
end
|
49
|
-
|
50
|
-
@seat_incumbencies = seat_incumbencies.flatten.uniq
|
51
|
-
end
|
52
|
-
|
53
|
-
# Alias parliamentaryIncumbencyHasMember with fallback.
|
54
|
-
#
|
55
|
-
# @return [Array, Array] the members of the Grom::Node or an empty array.
|
56
|
-
def members
|
57
|
-
return @members unless @members.nil?
|
58
|
-
|
59
|
-
members = []
|
60
|
-
seat_incumbencies.each do |seat_incumbency|
|
61
|
-
members << seat_incumbency.member
|
62
|
-
end
|
63
|
-
|
64
|
-
@members = members.flatten.uniq
|
65
|
-
end
|
66
|
-
|
67
|
-
# Alias constituencyGroupHasConstituencyArea with fallback.
|
68
|
-
#
|
69
|
-
# @return [Grom::Node, nil] a Grom::Node with type https://id.parliament.uk/schema/ConstituencyArea or nil.
|
70
|
-
def area
|
71
|
-
respond_to?(:constituencyGroupHasConstituencyArea) ? constituencyGroupHasConstituencyArea.first : nil
|
72
|
-
end
|
73
|
-
|
74
|
-
# Alias parliamentaryIncumbencyHasContactPoint with fallback.
|
75
|
-
#
|
76
|
-
# @return [Array, Array] the contact points of the Grom::Node or an empty array.
|
77
|
-
def contact_points
|
78
|
-
return @contact_points unless @contact_points.nil?
|
79
|
-
|
80
|
-
contact_points = []
|
81
|
-
seat_incumbencies.each do |seat_incumbency|
|
82
|
-
contact_points << seat_incumbency.contact_points
|
83
|
-
end
|
84
|
-
|
85
|
-
@contact_points = contact_points.flatten.uniq
|
86
|
-
end
|
87
|
-
|
88
|
-
# Checks if Grom::Node has an end date.
|
89
|
-
#
|
90
|
-
# @return [Boolean] a boolean depending on whether or not the Grom::Node has an end date.
|
91
|
-
def current?
|
92
|
-
has_end_date = respond_to?(:constituencyGroupEndDate)
|
93
|
-
|
94
|
-
!has_end_date
|
95
|
-
end
|
96
|
-
|
97
|
-
# Checks if Grom::Node is the correct constituency.
|
98
|
-
#
|
99
|
-
# @return [Boolean] a boolean depending on whether or not the Grom::Node is the expected constituency.
|
100
|
-
def correct?
|
101
|
-
@correct || false
|
102
|
-
end
|
103
|
-
|
104
|
-
# Alias parliamentaryIncumbencyHasMember with fallback.
|
105
|
-
#
|
106
|
-
# @return [Array, Array] the current member of the Grom::Node has a display name.
|
107
|
-
def current_member_display_name
|
108
|
-
return @current_member_display_name unless @current_member_display_name.nil?
|
109
|
-
current_incumbency = seat_incumbencies.select(&:current?).first
|
110
|
-
@current_member_display_name = current_incumbency.nil? ? nil : current_incumbency.member.display_name
|
111
|
-
end
|
112
|
-
|
113
|
-
# Alias party_name with fallback.
|
114
|
-
#
|
115
|
-
# @return [String, String] the name of the Grom::Node or an empty string.
|
116
|
-
def current_member_party_name
|
117
|
-
return @party_name unless @party_name.nil?
|
118
|
-
current_incumbency = seat_incumbencies.select(&:current?).first
|
119
|
-
|
120
|
-
return @party_name = nil unless current_incumbency
|
121
|
-
|
122
|
-
current_membership = current_incumbency.member.party_memberships.select(&:current?).first
|
123
|
-
@party_name = current_membership.nil? ? nil : current_membership.party.name
|
124
|
-
end
|
125
|
-
|
126
|
-
# @return [Array, Array] the regions of the Grom::Node or an empty array.
|
127
|
-
def regions
|
128
|
-
respond_to?(:inEuropeanRegion) ? inEuropeanRegion : []
|
129
|
-
end
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
module Parliament
|
2
|
-
module Grom
|
3
|
-
module Decorator
|
4
|
-
# Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/ContactPoint
|
5
|
-
module ContactPoint
|
6
|
-
# A hack has been added to postal_addresses, email, phone_number and fax_number
|
7
|
-
# to remove any details that are less than ATTRIBUTE_LENGTH_LIMIT_HACK in length
|
8
|
-
# including "." and "-" addresses when these have been mistakenly entered into Mnis
|
9
|
-
ATTRIBUTE_LENGTH_LIMIT_HACK = 1
|
10
|
-
# Alias contactPointHasPostalAddress with fallback.
|
11
|
-
#
|
12
|
-
# @return [Array, Array] an array of the postal addresses for the Grom::Node or an empty array.
|
13
|
-
def postal_addresses
|
14
|
-
@postal_addresses ||= respond_to?(:contactPointHasPostalAddress) ? contactPointHasPostalAddress.reject { |address| address.full_address.length <= ATTRIBUTE_LENGTH_LIMIT_HACK } : []
|
15
|
-
end
|
16
|
-
|
17
|
-
# Alias email with fallback.
|
18
|
-
#
|
19
|
-
# @return [String, String] the email of the Grom::Node or an empty string.
|
20
|
-
def email
|
21
|
-
@email_decorator ||= instance_variable_get('@email'.to_sym) && instance_variable_get('@email'.to_sym).length > ATTRIBUTE_LENGTH_LIMIT_HACK ? instance_variable_get('@email'.to_sym).strip : ''
|
22
|
-
end
|
23
|
-
|
24
|
-
# Alias phoneNumber with fallback.
|
25
|
-
#
|
26
|
-
# @return [String, String] the phone number of the Grom::Node or an empty string.
|
27
|
-
def phone_number
|
28
|
-
@phone_number ||= respond_to?(:phoneNumber) && phoneNumber.length > ATTRIBUTE_LENGTH_LIMIT_HACK ? phoneNumber : ''
|
29
|
-
end
|
30
|
-
|
31
|
-
# Alias faxNumber with fallback.
|
32
|
-
#
|
33
|
-
# @return [String, String] the fax number of the Grom::Node or an empty string.
|
34
|
-
def fax_number
|
35
|
-
@fax_number ||= respond_to?(:faxNumber) && faxNumber.length > ATTRIBUTE_LENGTH_LIMIT_HACK ? faxNumber : ''
|
36
|
-
end
|
37
|
-
|
38
|
-
# Alias contactPointHasPerson with fallback.
|
39
|
-
#
|
40
|
-
# @return [Array, Array] the person connected to the Grom::Node or an empty array.
|
41
|
-
def person
|
42
|
-
respond_to?(:contactPointHasPerson) ? contactPointHasPerson : []
|
43
|
-
end
|
44
|
-
|
45
|
-
# Alias contactPointHasParliamentaryIncumbency with fallback.
|
46
|
-
#
|
47
|
-
# @return [Grom::Node, nil] the parliamentary incumbency of the Grom::Node or nil.
|
48
|
-
def parliamentary_incumbency
|
49
|
-
respond_to?(:contactPointHasParliamentaryIncumbency) ? contactPointHasParliamentaryIncumbency.first : nil
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module Parliament
|
2
|
-
module Grom
|
3
|
-
module Decorator
|
4
|
-
# Decorator namespace for Grom::Node instances with type: http://data.ordnancesurvey.co.uk/ontology/admingeo/EuropeanRegion.
|
5
|
-
module EuropeanRegion
|
6
|
-
# Alias prefLabel with fallback.
|
7
|
-
#
|
8
|
-
# @return [String, String] the given name of the Grom::Node or an empty string.
|
9
|
-
def name
|
10
|
-
respond_to?(:prefLabel) ? prefLabel : ''
|
11
|
-
end
|
12
|
-
|
13
|
-
# Alias gssCode with fallback.
|
14
|
-
#
|
15
|
-
# @return [String, String] the given name of the Grom::Node or nil.
|
16
|
-
def gss_code
|
17
|
-
respond_to?(:gssCode) ? gssCode : nil
|
18
|
-
end
|
19
|
-
|
20
|
-
# Alias count with fallback.
|
21
|
-
#
|
22
|
-
# @return [String, String] the count of the Grom::Node or nil.
|
23
|
-
def constituency_count
|
24
|
-
respond_to?(:count) ? count : nil
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|