epb_view_models 1.0.10 → 1.0.11
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/epb_view_models.rb +1 -1
- data/lib/view_model_domain/xsd_arguments.rb +1 -1
- data/lib/view_model_gateway/xsd_files_gateway.rb +18 -12
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f71a412d77bf50228e2736594bce2312c64b088dc80a7e0708b3606fcb9f3e2c
|
|
4
|
+
data.tar.gz: 4d2e94eafa908f2a26ea7aa09e2940fa2461ded527a620f0ebf6a29d9a34281e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 82cb7dcc22da7a1d5033a65a3cd57ec67827a7dcbf31bcc45cc328de2746a376457feb120143cdc22a6f6367acb2bf5a722bb55044308d4f4cfe1bd1734914e1
|
|
7
|
+
data.tar.gz: 54c8b796430bb11ff37474b65b80db256fbddccdb88d516404baab6b720ff86c8ecbd2ad703bece026a0b61d0f3f75dfd0c3342100c4ee56c0bdce9d1027462a
|
data/lib/epb_view_models.rb
CHANGED
|
@@ -2,7 +2,7 @@ module ViewModelDomain
|
|
|
2
2
|
class XsdArguments
|
|
3
3
|
attr_reader :simple_type, :assessment_type, :xsd_dir_path, :gem_path
|
|
4
4
|
|
|
5
|
-
def initialize(simple_type:, assessment_type:, xsd_dir_path: "
|
|
5
|
+
def initialize(simple_type:, assessment_type:, xsd_dir_path: "", gem_path: "")
|
|
6
6
|
@simple_type = simple_type
|
|
7
7
|
@assessment_type = assessment_type
|
|
8
8
|
@xsd_dir_path = xsd_dir_path
|
|
@@ -2,6 +2,9 @@ module ViewModelGateway
|
|
|
2
2
|
class XsdFilesGateway
|
|
3
3
|
attr_reader :simple_type, :assessment_type, :xsd_dir_path, :glob_path
|
|
4
4
|
|
|
5
|
+
API_PATH = "api/schemas/xml/".freeze
|
|
6
|
+
XSD_DEFAULT_PATH = "/api/schemas/xml/**/".freeze
|
|
7
|
+
|
|
5
8
|
def initialize(domain_arguments)
|
|
6
9
|
@simple_type = domain_arguments.simple_type
|
|
7
10
|
@assessment_type = domain_arguments.assessment_type
|
|
@@ -10,20 +13,23 @@ module ViewModelGateway
|
|
|
10
13
|
end
|
|
11
14
|
|
|
12
15
|
def schema_version(file)
|
|
13
|
-
|
|
14
|
-
api_path_start = file.index(api_path) + api_path.length
|
|
16
|
+
api_path_start = file.index(API_PATH) + API_PATH.length
|
|
15
17
|
schema_version = file[api_path_start..].split("/").first
|
|
16
18
|
sap_defnied_in_rdsap_dir?(file) ? "#{schema_version}/SAP" : schema_version
|
|
17
19
|
end
|
|
18
20
|
|
|
19
21
|
def xsd_files
|
|
20
|
-
files =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
files = if @xsd_dir_path.nil? || @xsd_dir_path.empty?
|
|
23
|
+
case @assessment_type.downcase
|
|
24
|
+
when "sap"
|
|
25
|
+
sap_xsd_files
|
|
26
|
+
when "rdsap"
|
|
27
|
+
rdsap_xsd_files
|
|
28
|
+
when "cepc"
|
|
29
|
+
cepc_xsd_files
|
|
30
|
+
end
|
|
31
|
+
else
|
|
32
|
+
Dir.glob("#{@dir_path}#{@xsd_dir_path}")
|
|
27
33
|
end
|
|
28
34
|
|
|
29
35
|
raise ViewModelBoundary::XsdFilesNotFound, "No xsd files were found in #{@glob_path} directory" if files.nil? || files.empty?
|
|
@@ -38,17 +44,17 @@ module ViewModelGateway
|
|
|
38
44
|
end
|
|
39
45
|
|
|
40
46
|
def sap_xsd_files
|
|
41
|
-
@glob_path = "#{@dir_path +
|
|
47
|
+
@glob_path = "#{@dir_path + XSD_DEFAULT_PATH}*-Domains.xsd"
|
|
42
48
|
Dir.glob(@glob_path)
|
|
43
49
|
end
|
|
44
50
|
|
|
45
51
|
def rdsap_xsd_files
|
|
46
|
-
@glob_path = "#{@dir_path +
|
|
52
|
+
@glob_path = "#{@dir_path + XSD_DEFAULT_PATH}*-Domains.xsd"
|
|
47
53
|
Dir.glob(@glob_path)
|
|
48
54
|
end
|
|
49
55
|
|
|
50
56
|
def cepc_xsd_files
|
|
51
|
-
@glob_path = "#{@dir_path +
|
|
57
|
+
@glob_path = "#{@dir_path + XSD_DEFAULT_PATH}Reported-Data.xsd"
|
|
52
58
|
Dir.glob(@glob_path)
|
|
53
59
|
end
|
|
54
60
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: epb_view_models
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- MHCLG Energy Performance of Buildings
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-10-
|
|
11
|
+
date: 2021-10-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: nokogiri
|