parliament-grom-decorators 0.26.0 → 0.27.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: 9b1b605fd0f8fa3c1e10b5fe8607df32cd754250
4
- data.tar.gz: a9818427927740dc7e0fa601c68ab578741a3c49
3
+ metadata.gz: 9420b51cfdc70c699ffbda37e7e4875c11ddc0d8
4
+ data.tar.gz: 83d3202ecace607648a92282e1d7228c8645061f
5
5
  SHA512:
6
- metadata.gz: 7ba853d48f0d6ca0de9d46e094ae8f2961dac91ca7fbda6d52907cae223cf85cb15bcd47d5471a2854ab46a544f07b7d6724da9d089763f341434871262eb3e5
7
- data.tar.gz: 0167363fc3d36f0e6217b5c85b9b42ed323487f32fe6db187e8988c096c7d8d2bf752fa3da695e297a179d4732c2853af1300492bbc15aee305f105c88e99cfe
6
+ metadata.gz: a61e8879c6ae40bf635066cb0e0f937cbbc94cb4f88d67d08195853c3f9f8fc73a6f883c5d4815e13d9c2209c2511621add79f3dd693c54686e300a78a5c2ea4
7
+ data.tar.gz: e38fe70757aad8f58e196443dcb148e4ae0fcb235744807069d5dabcb2d48f143657868433905945bc03683f29f7201358c8d6521d09d4ed1efbd1cb936f8ff1
@@ -4,6 +4,27 @@ module Parliament
4
4
  # Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/Question.
5
5
  module Question
6
6
  include Helpers::DateHelper
7
+ # Alias questionHeading with fallback.
8
+ #
9
+ # @return [String, String] the question_title of the Grom::Node or an empty string.
10
+ def question_title
11
+ respond_to?(:questionHeading) ? questionHeading : ''
12
+ end
13
+
14
+ # Builds a fallback question heading using indexingAndSearchUri.
15
+ #
16
+ # @return [String, String] the fallback_heading of the Grom::Node.
17
+ def fallback_heading
18
+ "Question #{indexing_search_uri.split('/').last}"
19
+ end
20
+
21
+ # Returns heading or fallback_heading.
22
+ #
23
+ # @return [String, String] the heading of the Grom::Node or fallback_heading.
24
+ def heading
25
+ question_title.empty? || question_title.include?('Tabled Parliamentary Question') ? fallback_heading : question_title
26
+ end
27
+
7
28
  # Alias questionText with fallback.
8
29
  #
9
30
  # @return [String, String] the text of the Grom::Node or an empty string.
@@ -11,11 +32,11 @@ module Parliament
11
32
  respond_to?(:questionText) ? questionText : ''
12
33
  end
13
34
 
14
- # Alias eqmUin with fallback.
35
+ # Alias indexingAndSearchUri with fallback.
15
36
  #
16
- # @return [String, String] the uin of the Grom::Node or an empty string.
17
- def uin
18
- respond_to?(:eqmUin) ? eqmUin : ''
37
+ # @return [String, String] the indexing_search_uri of the Grom::Node or an empty string.
38
+ def indexing_search_uri
39
+ respond_to?(:indexingAndSearchUri) ? indexingAndSearchUri : ''
19
40
  end
20
41
 
21
42
  # Alias questionAskedAt with fallback.
@@ -1,7 +1,7 @@
1
1
  module Parliament
2
2
  module Grom
3
3
  module Decorator
4
- VERSION = '0.26.0'.freeze
4
+ VERSION = '0.27.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.26.0
4
+ version: 0.27.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-05-14 00:00:00.000000000 Z
11
+ date: 2018-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler