aemo 0.1.29 → 0.1.30
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/aemo/nmi.rb +9 -2
- data/lib/aemo/version.rb +1 -1
- data/spec/lib/aemo/nmi_spec.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e5f6b117f4035ad3a7be1f8d8525d073c599d12
|
4
|
+
data.tar.gz: 12c27b4672c2efb084bec8e7d088053f44ceefd8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e93926c4e57dd83c339791166561f6ececd4da2caedf08f9a51dfeb4b8d36b18c32aa824c2c6aeefb99550f48bdb58974eef58e59b601a5e02cec4c0d159d65
|
7
|
+
data.tar.gz: cfb96c5c4da1ea97960df208df7cf4dfceded46ff5176005e5833f843ebf0da29793fbc9ef555cc6f86f6b6954a0c730f5780a9e387db0b424ee1b62d29c56ff
|
data/lib/aemo/nmi.rb
CHANGED
@@ -604,13 +604,20 @@ module AEMO
|
|
604
604
|
@data_streams.select { |x| x.status == status.to_s }
|
605
605
|
end
|
606
606
|
|
607
|
-
# The current daily load
|
607
|
+
# The current daily load in kWh
|
608
608
|
#
|
609
|
-
# @return [Integer] the current daily load for the meter
|
609
|
+
# @return [Integer] the current daily load for the meter in kWh
|
610
610
|
def current_daily_load
|
611
611
|
data_streams_by_status.map { |x| x.averaged_daily_load.to_i }.inject(0, :+)
|
612
612
|
end
|
613
613
|
|
614
|
+
# The current annual load in MWh
|
615
|
+
#
|
616
|
+
# @return [Integer] the current annual load for the meter in MWh
|
617
|
+
def current_annual_load
|
618
|
+
(current_daily_load * 365.2425 / 1000).to_i
|
619
|
+
end
|
620
|
+
|
614
621
|
# A function to validate the NMI provided
|
615
622
|
#
|
616
623
|
# @param nmi [String] the nmi to be checked
|
data/lib/aemo/version.rb
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
# @author Joel Courtney <euphemize@gmail.com>
|
23
23
|
module AEMO
|
24
24
|
# aemo version
|
25
|
-
VERSION = '0.1.
|
25
|
+
VERSION = '0.1.30'.freeze
|
26
26
|
|
27
27
|
# aemo version split amongst different revisions
|
28
28
|
MAJOR_VERSION, MINOR_VERSION, REVISION = VERSION.split('.').map(&:to_i)
|
data/spec/lib/aemo/nmi_spec.rb
CHANGED
@@ -160,6 +160,13 @@ describe AEMO::NMI do
|
|
160
160
|
end
|
161
161
|
end
|
162
162
|
|
163
|
+
describe '#current_annual_load' do
|
164
|
+
it 'should return zero for no data' do
|
165
|
+
@nmi = AEMO::NMI.new('4001234567')
|
166
|
+
expect(@nmi.current_daily_load).to eq(0)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
163
170
|
describe '#meters_by_status' do
|
164
171
|
before(:each) do
|
165
172
|
@nmi = AEMO::NMI.new('4001234567')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aemo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Courtney
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-06-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|