parliament-grom-decorators 0.18.0 → 0.19.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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 742d93ef812fedee07314bb1ada949b19f74f792
|
|
4
|
+
data.tar.gz: 70597d5d914cbb9a69616b01212bc0d0fa19196c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a7d9fad3a90a6a24f4a8f9dd0992362c7d0da67590c1841d0c78cc0f6092932e40330e697ad21c56328c0a77f371c72bb3d13ca89d8675f0e83c0575cea03b16
|
|
7
|
+
data.tar.gz: 531e1e5af2dd78b77bee189157393601f70c54755251a518737f1075fe069b2c5e91c4d9067a52c9e8e8d48f7710fb6d75c474d364102bef6b571c204cbd193b
|
|
@@ -3,32 +3,36 @@ module Parliament
|
|
|
3
3
|
module Decorator
|
|
4
4
|
# Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/ContactPoint
|
|
5
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
|
|
6
10
|
# Alias contactPointHasPostalAddress with fallback.
|
|
7
11
|
#
|
|
8
12
|
# @return [Array, Array] an array of the postal addresses for the Grom::Node or an empty array.
|
|
9
13
|
def postal_addresses
|
|
10
|
-
respond_to?(:contactPointHasPostalAddress) ? contactPointHasPostalAddress : []
|
|
14
|
+
@postal_addresses ||= respond_to?(:contactPointHasPostalAddress) ? contactPointHasPostalAddress.reject { |address| address.full_address.length <= ATTRIBUTE_LENGTH_LIMIT_HACK } : []
|
|
11
15
|
end
|
|
12
16
|
|
|
13
17
|
# Alias email with fallback.
|
|
14
18
|
#
|
|
15
19
|
# @return [String, String] the email of the Grom::Node or an empty string.
|
|
16
20
|
def email
|
|
17
|
-
instance_variable_get('@email'.to_sym)
|
|
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 : ''
|
|
18
22
|
end
|
|
19
23
|
|
|
20
24
|
# Alias phoneNumber with fallback.
|
|
21
25
|
#
|
|
22
26
|
# @return [String, String] the phone number of the Grom::Node or an empty string.
|
|
23
27
|
def phone_number
|
|
24
|
-
respond_to?(:phoneNumber) ? phoneNumber : ''
|
|
28
|
+
@phone_number ||= respond_to?(:phoneNumber) && phoneNumber.length > ATTRIBUTE_LENGTH_LIMIT_HACK ? phoneNumber : ''
|
|
25
29
|
end
|
|
26
30
|
|
|
27
31
|
# Alias faxNumber with fallback.
|
|
28
32
|
#
|
|
29
33
|
# @return [String, String] the fax number of the Grom::Node or an empty string.
|
|
30
34
|
def fax_number
|
|
31
|
-
respond_to?(:faxNumber) ? faxNumber : ''
|
|
35
|
+
@fax_number ||= respond_to?(:faxNumber) && faxNumber.length > ATTRIBUTE_LENGTH_LIMIT_HACK ? faxNumber : ''
|
|
32
36
|
end
|
|
33
37
|
|
|
34
38
|
# Alias contactPointHasPerson with fallback.
|
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.19.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-03-
|
|
11
|
+
date: 2018-03-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|