aemo 0.1.29 → 0.1.30

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6297d3115749bc5050a726f333f7aa3ccd2cf488
4
- data.tar.gz: 19d244d2d6da4813f5fe22870f8551324665ebf2
3
+ metadata.gz: 0e5f6b117f4035ad3a7be1f8d8525d073c599d12
4
+ data.tar.gz: 12c27b4672c2efb084bec8e7d088053f44ceefd8
5
5
  SHA512:
6
- metadata.gz: 1781680bf8e73d3cdb0abfbfe7fd5566b7c8c70fcad8a92a34bdeca43062bff591b5c21228c5c3b1977510f31bc5db1e64d98f3b1b382a4e62072d6d284241a5
7
- data.tar.gz: 1d7ceae339055b5c4d1f43209dbf615a0a7db77e6586a9785a908146882f1437810e17939604cbdb9836c01f30af1fa2ed86304a6365d5eda6d5451cdd737a77
6
+ metadata.gz: 1e93926c4e57dd83c339791166561f6ececd4da2caedf08f9a51dfeb4b8d36b18c32aa824c2c6aeefb99550f48bdb58974eef58e59b601a5e02cec4c0d159d65
7
+ data.tar.gz: cfb96c5c4da1ea97960df208df7cf4dfceded46ff5176005e5833f843ebf0da29793fbc9ef555cc6f86f6b6954a0c730f5780a9e387db0b424ee1b62d29c56ff
@@ -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
@@ -22,7 +22,7 @@
22
22
  # @author Joel Courtney <euphemize@gmail.com>
23
23
  module AEMO
24
24
  # aemo version
25
- VERSION = '0.1.29'.freeze
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)
@@ -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.29
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-02-16 00:00:00.000000000 Z
12
+ date: 2016-06-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json