parliament-grom-decorators 0.23.0 → 0.24.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 +7 -1
- data/lib/parliament/grom/decorator/answer.rb +30 -0
- data/lib/parliament/grom/decorator/answering_body_allocation.rb +15 -0
- data/lib/parliament/grom/decorator/person.rb +2 -2
- data/lib/parliament/grom/decorator/question.rb +51 -0
- data/lib/parliament/grom/decorator/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 237cd75404e1e9b7414813fe6703c7eb29bd6b59
|
|
4
|
+
data.tar.gz: a77c9965d2f48d55481127151059e9342745978e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ec47ca9e7f5b3efe00ffffcbf73ec0a309b5d469865d459b618a77049a286e227089ff3df11a19cecc0dcb2462f5b2a1778f31e014b170cc63691e32d157d7cb
|
|
7
|
+
data.tar.gz: bfccc5e33a802105b3e7d49736896baf5822dcb525877b3cfabb3f2dcc134c9060cc00d9d660aba9c5eefa659a67d2c408f49a4a39e0d45a4f51290723f94faf
|
|
@@ -33,6 +33,9 @@ require 'parliament/grom/decorator/group'
|
|
|
33
33
|
require 'parliament/grom/decorator/gov_register_government_organisation'
|
|
34
34
|
require 'parliament/grom/decorator/position'
|
|
35
35
|
require 'parliament/grom/decorator/formal_body_chair'
|
|
36
|
+
require 'parliament/grom/decorator/question'
|
|
37
|
+
require 'parliament/grom/decorator/answer'
|
|
38
|
+
require 'parliament/grom/decorator/answering_body_allocation'
|
|
36
39
|
|
|
37
40
|
# Namespace for classes and modules that handle connections to, and processing of data from the parliamentary API.
|
|
38
41
|
# @since 0.1.0
|
|
@@ -75,7 +78,10 @@ module Parliament
|
|
|
75
78
|
'Group' => Group,
|
|
76
79
|
'GovRegisterGovernmentOrganisation' => GovRegisterGovernmentOrganisation,
|
|
77
80
|
'Position' => Position,
|
|
78
|
-
'FormalBodyChair' => FormalBodyChair
|
|
81
|
+
'FormalBodyChair' => FormalBodyChair,
|
|
82
|
+
'Question' => Question,
|
|
83
|
+
'Answer' => Answer,
|
|
84
|
+
'AnsweringBodyAllocation' => AnsweringBodyAllocation
|
|
79
85
|
}.freeze
|
|
80
86
|
|
|
81
87
|
class << self
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
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/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
|
|
@@ -269,9 +269,9 @@ module Parliament
|
|
|
269
269
|
|
|
270
270
|
# Alias governmentIncumbency with fallback.
|
|
271
271
|
#
|
|
272
|
-
# @return [Array, Array] all the
|
|
272
|
+
# @return [Array, Array] all the government incumbencies of the Grom::Node or an empty array.
|
|
273
273
|
def government_incumbencies
|
|
274
|
-
respond_to?(:
|
|
274
|
+
respond_to?(:governmentPersonHasGovernmentIncumbency) ? governmentPersonHasGovernmentIncumbency : []
|
|
275
275
|
end
|
|
276
276
|
|
|
277
277
|
# Alias personHasPersonalWebLink with fallback.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
module Parliament
|
|
2
|
+
module Grom
|
|
3
|
+
module Decorator
|
|
4
|
+
# Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/Question.
|
|
5
|
+
module Question
|
|
6
|
+
include Helpers::DateHelper
|
|
7
|
+
# Alias questionText with fallback.
|
|
8
|
+
#
|
|
9
|
+
# @return [String, String] the text of the Grom::Node or an empty string.
|
|
10
|
+
def text
|
|
11
|
+
respond_to?(:questionText) ? questionText : ''
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Alias eqmUin with fallback.
|
|
15
|
+
#
|
|
16
|
+
# @return [String, String] the uin of the Grom::Node or an empty string.
|
|
17
|
+
def uin
|
|
18
|
+
respond_to?(:eqmUin) ? eqmUin : ''
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Alias questionAskedAt with fallback.
|
|
22
|
+
#
|
|
23
|
+
# @return [DateTime, nil] the asked_at_date of the Grom::Node or nil.
|
|
24
|
+
def asked_at_date
|
|
25
|
+
@asked_at_date ||= respond_to?(:questionAskedAt) ? DateTime.parse(questionAskedAt) : nil
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Alias questionHasAskingPerson with fallback.
|
|
29
|
+
#
|
|
30
|
+
# @return [Grom::Node, nil] the asking_person of the Grom::Node or nil.
|
|
31
|
+
def asking_person
|
|
32
|
+
respond_to?(:questionHasAskingPerson) ? questionHasAskingPerson.first : nil
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Alias questionHasAnswer with fallback.
|
|
36
|
+
#
|
|
37
|
+
# @return [Array, Array] the answers related to the Grom::Node or an empty array.
|
|
38
|
+
def answers
|
|
39
|
+
respond_to?(:questionHasAnswer) ? questionHasAnswer : []
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Alias questionHasAnsweringBodyAllocation with fallback.
|
|
43
|
+
#
|
|
44
|
+
# @return [Grom::Node, nil] the answering_body_allocation of the Grom::Node or nil.
|
|
45
|
+
def answering_body_allocation
|
|
46
|
+
respond_to?(:questionHasAnsweringBodyAllocation) ? questionHasAnsweringBodyAllocation.first : nil
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
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.24.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-04-
|
|
11
|
+
date: 2018-04-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -173,6 +173,8 @@ files:
|
|
|
173
173
|
- config/locales/en.yml
|
|
174
174
|
- gocd/web1live.yaml
|
|
175
175
|
- lib/parliament/grom/decorator.rb
|
|
176
|
+
- lib/parliament/grom/decorator/answer.rb
|
|
177
|
+
- lib/parliament/grom/decorator/answering_body_allocation.rb
|
|
176
178
|
- lib/parliament/grom/decorator/article_type.rb
|
|
177
179
|
- lib/parliament/grom/decorator/audience.rb
|
|
178
180
|
- lib/parliament/grom/decorator/collection.rb
|
|
@@ -206,6 +208,7 @@ files:
|
|
|
206
208
|
- lib/parliament/grom/decorator/person.rb
|
|
207
209
|
- lib/parliament/grom/decorator/position.rb
|
|
208
210
|
- lib/parliament/grom/decorator/postal_address.rb
|
|
211
|
+
- lib/parliament/grom/decorator/question.rb
|
|
209
212
|
- lib/parliament/grom/decorator/seat_incumbency.rb
|
|
210
213
|
- lib/parliament/grom/decorator/version.rb
|
|
211
214
|
- lib/parliament/grom/decorator/web_article.rb
|