parliament-grom-decorators 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/parliament/grom/decorator/business_item.rb +38 -0
- data/lib/parliament/grom/decorator/helpers/date_helper.rb +1 -0
- data/lib/parliament/grom/decorator/procedure_step.rb +9 -0
- data/lib/parliament/grom/decorator/version.rb +1 -1
- data/lib/parliament/grom/decorator/work_package.rb +7 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6cab38f51c510f82684a1203bb56b79656bb2c9d
|
4
|
+
data.tar.gz: c3493e4183b61e7021a1884110821701f9c0054c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f62d0e94f1df3059a302b2d47d84fedbba315f6c66f00ecb48ff7acde61514100237e004dc23c3268ca5933e9cc2845c0cae379686c36f122febaf75b0b53deb
|
7
|
+
data.tar.gz: bc38460c8cbdfa86444e79a8733c8204ac37dade4c3c13e8bd3e3216d8970643ee9400194be9fdff3b923606a6b98aa8f23b07081b4efb5279b629fe3dcad239
|
@@ -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/BusinessItem
|
5
|
+
module BusinessItem
|
6
|
+
include Helpers::DateHelper
|
7
|
+
# Alias businessItemeHasProcedureStep with fallback.
|
8
|
+
# NB: Currently, business items only have one procedure step
|
9
|
+
#
|
10
|
+
# @return [Grom::Node, nil] a Procedure Step Grom::Node or nil.
|
11
|
+
def procedure_step
|
12
|
+
return @procedure_step if @procedure_step
|
13
|
+
return nil unless respond_to?(:businessItemHasProcedureStep)
|
14
|
+
|
15
|
+
@procedure_step = Helpers::Utils.type_safe_first(businessItemHasProcedureStep, Parliament::Grom::Decorator::ProcedureStep)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Alias businessItemDate with fallback.
|
19
|
+
#
|
20
|
+
# @return [Date, nil] the date of the Grom::Node or nil.
|
21
|
+
def date
|
22
|
+
respond_to?(:businessItemDate) ? DateTime.parse(businessItemDate) : nil
|
23
|
+
end
|
24
|
+
|
25
|
+
# Alias businessItemHasWorkPackage with fallback.
|
26
|
+
#
|
27
|
+
# @return [Grom::Node, nil] the WorkPackage of the Grom::Node or nil.
|
28
|
+
def work_package
|
29
|
+
return @work_package if @work_package
|
30
|
+
|
31
|
+
return nil unless respond_to?(:businessItemHasWorkPackage)
|
32
|
+
|
33
|
+
@work_package = Helpers::Utils.type_safe_first(businessItemHasWorkPackage, Parliament::Grom::Decorator::WorkPackage)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -14,6 +14,7 @@ module Parliament
|
|
14
14
|
# @return [String] formatted date range
|
15
15
|
def date_range(date_format: '%-d %-B %Y')
|
16
16
|
return I18n.t('date_unavailable') if start_date.nil?
|
17
|
+
|
17
18
|
if end_date
|
18
19
|
"#{I18n.l(start_date, format: date_format)} #{I18n.t('to')} #{I18n.l(end_date, format: date_format)}"
|
19
20
|
else
|
@@ -13,6 +13,13 @@ module Parliament
|
|
13
13
|
|
14
14
|
@procedure = Helpers::Utils.type_safe_first(workPackageHasProcedure, Parliament::Grom::Decorator::Procedure)
|
15
15
|
end
|
16
|
+
|
17
|
+
def business_item
|
18
|
+
return @business_item if @business_item
|
19
|
+
return nil unless respond_to?(:workPackageHasBusinessItem)
|
20
|
+
|
21
|
+
@business_item = Helpers::Utils.type_safe_first(workPackageHasBusinessItem, Parliament::Grom::Decorator::BusinessItem)
|
22
|
+
end
|
16
23
|
end
|
17
24
|
end
|
18
25
|
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: 1.0.
|
4
|
+
version: 1.0.3
|
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-10-
|
11
|
+
date: 2018-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -187,6 +187,7 @@ files:
|
|
187
187
|
- config/locales/en.yml
|
188
188
|
- gocd/web1live.yaml
|
189
189
|
- lib/parliament/grom/decorator.rb
|
190
|
+
- lib/parliament/grom/decorator/business_item.rb
|
190
191
|
- lib/parliament/grom/decorator/group.rb
|
191
192
|
- lib/parliament/grom/decorator/helpers.rb
|
192
193
|
- lib/parliament/grom/decorator/helpers/date_helper.rb
|
@@ -196,6 +197,7 @@ files:
|
|
196
197
|
- lib/parliament/grom/decorator/laying_body.rb
|
197
198
|
- lib/parliament/grom/decorator/person.rb
|
198
199
|
- lib/parliament/grom/decorator/procedure.rb
|
200
|
+
- lib/parliament/grom/decorator/procedure_step.rb
|
199
201
|
- lib/parliament/grom/decorator/proposed_negative_statutory_instrument_paper.rb
|
200
202
|
- lib/parliament/grom/decorator/statutory_instrument_paper.rb
|
201
203
|
- lib/parliament/grom/decorator/version.rb
|