epb_view_models 1.0.19 → 1.0.20

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
  SHA256:
3
- metadata.gz: 4c9e0148c91fdfa17b8230647b7f44630d9197877639f5f8da2948d329afb8e6
4
- data.tar.gz: db0feff6c2a220fef4810e938bb53d6382df34df65355ff3946443b58ada8950
3
+ metadata.gz: aa9d8934087e8309c6b8c03395fbbbb93e9b7353964126b93438d52feb6ad7b6
4
+ data.tar.gz: 27c06482c14b7b0dec995f24e69b4fa0b2d595632b2fa998e2030269ebe96b94
5
5
  SHA512:
6
- metadata.gz: f5e51bceb16b9c4ec62cb2a724ccb58e4daf1d8699b67672a755533278b568c00c7f13ee119f7d78983f913bb13a2cd69b36a1d1372e43a4dc4f62f82b89bb03
7
- data.tar.gz: 9813262b24abc17231f36b6d5b4bf0eac81f58a31d103b80172e518b228e1974b15176af4c97f6ffeee7bea8cd8ac47cd74b08286554ff57883f6ec9fb3085e3
6
+ metadata.gz: d274a8af83d9a7d9b98a0aed40aa07ab22c795196d1110e309ba947cdb0e33b29782aa0f3d76be73e4353e61f1eefa1a982e3831be7631ad9fb423120573920f
7
+ data.tar.gz: 030110e0f77c01c48a4b695d086e6e00d337520eb40fdd3fab2f9074ba4c47d134210b00c187922650da323a0f05f332f435496e4dfd09d1b876491c1c0bf6fa
data/Gemfile CHANGED
@@ -7,7 +7,7 @@ source "https://rubygems.org"
7
7
  group :test do
8
8
  gem "rake", "~> 13.0.6"
9
9
  gem "rspec", "~> 3.0"
10
- gem "rubocop-govuk", "~> 4.0.0", require: false
10
+ gem "rubocop-govuk", "~> 4.7.0", require: false
11
11
  end
12
12
 
13
13
  gem "nokogiri", "~> 1.11"
data/Gemfile.lock CHANGED
@@ -1,29 +1,30 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- activesupport (7.0.2.3)
4
+ activesupport (7.0.3.1)
5
5
  concurrent-ruby (~> 1.0, >= 1.0.2)
6
6
  i18n (>= 1.6, < 2)
7
7
  minitest (>= 5.1)
8
8
  tzinfo (~> 2.0)
9
9
  ast (2.4.2)
10
- concurrent-ruby (1.1.9)
10
+ concurrent-ruby (1.1.10)
11
11
  diff-lcs (1.5.0)
12
- i18n (1.10.0)
12
+ i18n (1.12.0)
13
13
  concurrent-ruby (~> 1.0)
14
+ json (2.6.2)
14
15
  mini_portile2 (2.8.0)
15
- minitest (5.15.0)
16
- nokogiri (1.13.3)
16
+ minitest (5.16.3)
17
+ nokogiri (1.13.8)
17
18
  mini_portile2 (~> 2.8.0)
18
19
  racc (~> 1.4)
19
- parallel (1.21.0)
20
- parser (3.1.1.0)
20
+ parallel (1.22.1)
21
+ parser (3.1.2.1)
21
22
  ast (~> 2.4.1)
22
23
  racc (1.6.0)
23
- rack (2.2.3)
24
+ rack (2.2.4)
24
25
  rainbow (3.1.1)
25
26
  rake (13.0.6)
26
- regexp_parser (2.2.1)
27
+ regexp_parser (2.5.0)
27
28
  rexml (3.2.5)
28
29
  rspec (3.11.0)
29
30
  rspec-core (~> 3.11.0)
@@ -34,40 +35,40 @@ GEM
34
35
  rspec-expectations (3.11.0)
35
36
  diff-lcs (>= 1.2.0, < 2.0)
36
37
  rspec-support (~> 3.11.0)
37
- rspec-mocks (3.11.0)
38
+ rspec-mocks (3.11.1)
38
39
  diff-lcs (>= 1.2.0, < 2.0)
39
40
  rspec-support (~> 3.11.0)
40
41
  rspec-support (3.11.0)
41
- rubocop (1.15.0)
42
+ rubocop (1.35.0)
43
+ json (~> 2.3)
42
44
  parallel (~> 1.10)
43
- parser (>= 3.0.0.0)
45
+ parser (>= 3.1.2.1)
44
46
  rainbow (>= 2.2.2, < 4.0)
45
47
  regexp_parser (>= 1.8, < 3.0)
46
- rexml
47
- rubocop-ast (>= 1.5.0, < 2.0)
48
+ rexml (>= 3.2.5, < 4.0)
49
+ rubocop-ast (>= 1.20.1, < 2.0)
48
50
  ruby-progressbar (~> 1.7)
49
51
  unicode-display_width (>= 1.4.0, < 3.0)
50
- rubocop-ast (1.6.0)
51
- parser (>= 3.0.1.1)
52
- rubocop-govuk (4.0.0)
53
- rubocop (~> 1.15.0)
54
- rubocop-ast (~> 1.6.0)
55
- rubocop-rails (~> 2.10.0)
56
- rubocop-rake (= 0.5.1)
57
- rubocop-rspec (~> 2.3.0)
58
- rubocop-rails (2.10.1)
52
+ rubocop-ast (1.21.0)
53
+ parser (>= 3.1.1.0)
54
+ rubocop-govuk (4.7.0)
55
+ rubocop (= 1.35.0)
56
+ rubocop-ast (= 1.21.0)
57
+ rubocop-rails (= 2.15.2)
58
+ rubocop-rake (= 0.6.0)
59
+ rubocop-rspec (= 2.12.1)
60
+ rubocop-rails (2.15.2)
59
61
  activesupport (>= 4.2.0)
60
62
  rack (>= 1.1)
61
63
  rubocop (>= 1.7.0, < 2.0)
62
- rubocop-rake (0.5.1)
63
- rubocop
64
- rubocop-rspec (2.3.0)
64
+ rubocop-rake (0.6.0)
65
65
  rubocop (~> 1.0)
66
- rubocop-ast (>= 1.1.0)
66
+ rubocop-rspec (2.12.1)
67
+ rubocop (~> 1.31)
67
68
  ruby-progressbar (1.11.0)
68
- tzinfo (2.0.4)
69
+ tzinfo (2.0.5)
69
70
  concurrent-ruby (~> 1.0)
70
- unicode-display_width (2.1.0)
71
+ unicode-display_width (2.2.0)
71
72
  zeitwerk (2.4.2)
72
73
 
73
74
  PLATFORMS
@@ -78,7 +79,7 @@ DEPENDENCIES
78
79
  rake (~> 13.0.6)
79
80
  rexml (~> 3.2, >= 3.2.5)
80
81
  rspec (~> 3.0)
81
- rubocop-govuk (~> 4.0.0)
82
+ rubocop-govuk (~> 4.7.0)
82
83
  zeitwerk (~> 2.4.2)
83
84
 
84
85
  RUBY VERSION
data/Makefile CHANGED
@@ -14,4 +14,4 @@ test: ## Run all tests
14
14
  @bundle exec rake spec
15
15
 
16
16
  format: ## Runs Rubocop with the GOV.UK rules
17
- @bundle exec rake rubocop:auto_correct
17
+ @bundle exec rake rubocop:autocorrect
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.summary = "Library used to parse Energy Performance Certificates (EPC)"
11
11
  spec.homepage = "https://github.com/communitiesuk/epb-view-models"
12
12
  spec.license = "MIT"
13
- spec.required_ruby_version = ">= 2.7.0"
13
+ spec.required_ruby_version = ">= 3.1"
14
14
 
15
15
  # Specify which files should be added to the gem when it is released.
16
16
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -5,7 +5,7 @@ loader = Zeitwerk::Loader.for_gem
5
5
  loader.setup
6
6
 
7
7
  module EpbViewModels
8
- VERSION = "1.0.19"
8
+ VERSION = "1.0.20"
9
9
  end
10
10
 
11
11
  # Monkey patching to avoid using ActiveRecord::Type::Boolean.new.cast
@@ -1,6 +1,6 @@
1
1
  module Presenter
2
2
  module RdSap
3
- class Hera
3
+ class DomesticDigest
4
4
  TYPE_OF_ASSESSMENT = "RdSAP".freeze
5
5
  private_constant :TYPE_OF_ASSESSMENT
6
6
 
@@ -9,7 +9,7 @@ module Presenter
9
9
  @schema_type = schema_type
10
10
  end
11
11
 
12
- def to_hera_hash
12
+ def to_domestic_digest
13
13
  {
14
14
  type_of_assessment: TYPE_OF_ASSESSMENT,
15
15
  assessment_id: @view_model.assessment_id,
@@ -54,7 +54,7 @@ module Presenter
54
54
  ),
55
55
  current_energy_efficiency_rating: @view_model.current_energy_rating,
56
56
  dwelling_type: @view_model.dwelling_type,
57
- estimated_energy_cost: estimated_energy_cost,
57
+ estimated_energy_cost:,
58
58
  main_fuel_type: @view_model.main_fuel_type,
59
59
  heat_demand: {
60
60
  current_space_heating_demand:
@@ -1,12 +1,12 @@
1
1
  module Presenter
2
2
  module Sap
3
- class Hera
3
+ class DomesticDigest
4
4
  def initialize(view_model, schema_type)
5
5
  @view_model = view_model
6
6
  @schema_type = schema_type
7
7
  end
8
8
 
9
- def to_hera_hash
9
+ def to_domestic_digest
10
10
  {
11
11
  type_of_assessment: @view_model.type_of_assessment,
12
12
  assessment_id: @view_model.assessment_id,
@@ -51,7 +51,7 @@ module Presenter
51
51
  ),
52
52
  current_energy_efficiency_rating: @view_model.current_energy_rating,
53
53
  dwelling_type: @view_model.dwelling_type,
54
- estimated_energy_cost: estimated_energy_cost,
54
+ estimated_energy_cost:,
55
55
  main_fuel_type: @view_model.main_fuel_type,
56
56
  heat_demand: {
57
57
  current_space_heating_demand:
@@ -8,7 +8,7 @@ module ViewModel
8
8
  @summary = Presenter::RdSap::Summary.new(view_model)
9
9
  @report = Presenter::RdSap::Report.new(view_model, schema_type, additional_data)
10
10
  @recommendation_report = Presenter::RdSap::RecommendationReport.new(view_model)
11
- @hera = Presenter::RdSap::Hera.new(view_model, schema_type)
11
+ @domestic_digest = Presenter::RdSap::DomesticDigest.new(view_model, schema_type)
12
12
  end
13
13
 
14
14
  def type
@@ -31,10 +31,17 @@ module ViewModel
31
31
  @recommendation_report.to_hash
32
32
  end
33
33
 
34
+ def to_domestic_digest
35
+ @domestic_digest.to_domestic_digest
36
+ end
37
+
34
38
  def to_hera_hash
35
- @hera.to_hera_hash
39
+ to_domestic_digest
36
40
  end
37
41
 
42
+ extend Gem::Deprecate
43
+ deprecate :to_hera_hash, :to_domestic_digest, 2022, 9
44
+
38
45
  def get_view_model
39
46
  view_model
40
47
  end
@@ -1,6 +1,8 @@
1
1
  module ViewModel
2
2
  module SapSchema1900
3
3
  class CommonSchema < ViewModel::DomesticEpcViewModel
4
+ THRESHOLD_LOW_ENERGY_LIGHTING_EFFICACY = 65
5
+
4
6
  def assessment_id
5
7
  xpath(%w[Report-Header RRN])
6
8
  end
@@ -387,7 +389,7 @@ module ViewModel
387
389
  low_energy_outlet_count = []
388
390
 
389
391
  format_fixed_light_array.each do |outlet|
390
- if outlet[:lighting_efficacy].to_i > 65
392
+ if outlet[:lighting_efficacy].to_i > THRESHOLD_LOW_ENERGY_LIGHTING_EFFICACY
391
393
  low_energy_outlet_count << outlet[:lighting_outlets].to_i
392
394
  end
393
395
  total_energy_outlet_count << outlet[:lighting_outlets].to_f
@@ -400,7 +402,7 @@ module ViewModel
400
402
  low_energy_outlet_count = []
401
403
 
402
404
  format_fixed_light_array.each do |outlet|
403
- if outlet[:lighting_efficacy].to_i > 65
405
+ if outlet[:lighting_efficacy].to_i > THRESHOLD_LOW_ENERGY_LIGHTING_EFFICACY
404
406
  low_energy_outlet_count << outlet[:lighting_outlets].to_i
405
407
  end
406
408
  end
@@ -8,7 +8,7 @@ module ViewModel
8
8
  @summary = Presenter::Sap::Summary.new(view_model)
9
9
  @report = Presenter::Sap::Report.new(view_model, schema_type, additional_data)
10
10
  @recommendation_report = Presenter::Sap::RecommendationReport.new(view_model)
11
- @hera = Presenter::Sap::Hera.new(view_model, schema_type)
11
+ @domestic_digest = Presenter::Sap::DomesticDigest.new(view_model, schema_type)
12
12
  end
13
13
 
14
14
  def type
@@ -31,10 +31,17 @@ module ViewModel
31
31
  @recommendation_report.to_hash
32
32
  end
33
33
 
34
+ def to_domestic_digest
35
+ @domestic_digest.to_domestic_digest
36
+ end
37
+
34
38
  def to_hera_hash
35
- @hera.to_hera_hash
39
+ to_domestic_digest
36
40
  end
37
41
 
42
+ extend Gem::Deprecate
43
+ deprecate :to_hera_hash, :to_domestic_digest, 2022, 9
44
+
38
45
  def get_view_model
39
46
  view_model
40
47
  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.19
4
+ version: 1.0.20
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: 2022-07-06 00:00:00.000000000 Z
11
+ date: 2022-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -1674,13 +1674,13 @@ files:
1674
1674
  - lib/presenter/export/commercial.rb
1675
1675
  - lib/presenter/export/domestic.rb
1676
1676
  - lib/presenter/export/statistics.rb
1677
+ - lib/presenter/rd_sap/domestic_digest.rb
1677
1678
  - lib/presenter/rd_sap/export_configuration.rb
1678
- - lib/presenter/rd_sap/hera.rb
1679
1679
  - lib/presenter/rd_sap/recommendation_report.rb
1680
1680
  - lib/presenter/rd_sap/report.rb
1681
1681
  - lib/presenter/rd_sap/summary.rb
1682
+ - lib/presenter/sap/domestic_digest.rb
1682
1683
  - lib/presenter/sap/export_configuration.rb
1683
- - lib/presenter/sap/hera.rb
1684
1684
  - lib/presenter/sap/recommendation_report.rb
1685
1685
  - lib/presenter/sap/report.rb
1686
1686
  - lib/presenter/sap/summary.rb
@@ -1863,7 +1863,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
1863
1863
  requirements:
1864
1864
  - - ">="
1865
1865
  - !ruby/object:Gem::Version
1866
- version: 2.7.0
1866
+ version: '3.1'
1867
1867
  required_rubygems_version: !ruby/object:Gem::Requirement
1868
1868
  requirements:
1869
1869
  - - ">="