aemo 0.8.0 → 0.9.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
  SHA256:
3
- metadata.gz: 284b65f74f29337015ac3c4072c3599068565538962eec46d07e2c3a5d37f1f3
4
- data.tar.gz: 8c4142b329c6bc78f7a2407572d5adbf041659a90362ee5eb8c3595f7f9f41ac
3
+ metadata.gz: c53df1a077317498a18842984a36de16333244e1d9688379c6e717bc87cc6504
4
+ data.tar.gz: 2661fd0ecfb778a9b78159784e2b4c66d32afa8c955274a5736ddd8dfdd35c0b
5
5
  SHA512:
6
- metadata.gz: fbf2afed45b613df53d4f01d1785b9e4b504859d8002fdb1180dfd4977b638eedf4e3cb6b294bd83bc6d923e12cff6474e03a571e6d012410e4ef943f9db4a52
7
- data.tar.gz: 4288d1a9c8eeccc67a1020d7d86b8377080f34a89f2c3ebeb28d8b873a6ec84ba502dad650cd798cf4d87ef6d2c9bae2ef28a129b6e18a27f8e9a0fe1b157fe8
6
+ metadata.gz: c2dd1fa1a75fafed484d4847e81e7117299f0ab2b84c7d1c1e69affc7d0e389951c7f3b053bdd518151a522d31ae33200a817a640727c2e966c875eaca2a5a78
7
+ data.tar.gz: 8bc06fc553b998b254d6c82b74af06e5ae02e6317f8cd4411ff0f035ed32146b97ce52c338ebe0b18af6103dfe7dd89adcd1a1b6e0f8929d0df5bfea4be62374
data/lib/aemo/version.rb CHANGED
@@ -23,7 +23,7 @@
23
23
  # @author Joel Courtney <euphemize@gmail.com>
24
24
  module AEMO
25
25
  # aemo version
26
- VERSION = '0.8.0'
26
+ VERSION = '0.9.0'
27
27
 
28
28
  # aemo version split amongst different revisions
29
29
  MAJOR_VERSION, MINOR_VERSION, REVISION = VERSION.split('.').map(&:to_i)
@@ -40,39 +40,39 @@ end
40
40
  # Now to create the DLF and TNI output JSON files for use
41
41
  @files.select { |x| ['aemo-tni.xml', 'aemo-dlf.xml'].include?(x) }
42
42
  .each do |file|
43
- output_file = file.gsub('.xml', '.json')
44
- output_data = {}
45
- open_file = File.open(File.join(@path, file))
46
- xml = Nokogiri::XML(open_file) do |c|
47
- c.options = Nokogiri::XML::ParseOptions::NOBLANKS
48
- end
49
- open_file.close
43
+ output_file = file.gsub('.xml', '.json')
44
+ output_data = {}
45
+ File.open(File.join(@path, file)) do |open_file|
46
+ Nokogiri::XML(open_file) do |c|
47
+ c.options = Nokogiri::XML::ParseOptions::NOBLANKS
48
+ end
49
+ end
50
50
 
51
- xml.xpath('//Row').each do |row|
52
- row_children = row.children
53
- code = row_children.find { |x| x.name == 'Code' }.children.first.text
54
- output_data[code] ||= []
55
- output_data_instance = {}
56
- row_children.each do |row_child|
57
- output_data_instance[row_child.name] = row_child.children.first.text
58
- end
59
- if file =~ /tni/
60
- puts "output_data_instance: #{output_data_instance.inspect}"
61
- output_data_instance[:mlf_data] = {}
62
- unless @mlf_data[code].nil?
63
- output_data_instance[:mlf_data] = @mlf_data[code].deep_dup
64
- output_data_instance[:mlf_data][:loss_factors].reject! do |x|
65
- Time.parse(output_data_instance['ToDate']) < x[:start] ||
66
- Time.parse(output_data_instance['FromDate']) >= x[:finish]
67
- end
68
- puts 'output_data_instance[:mlf_data][:loss_factors]: ' \
69
- "#{output_data_instance[:mlf_data][:loss_factors].inspect}"
70
- end
71
- elsif file =~ /dlf/
72
- output_data_instance[:nsp_code] = @dlf_data[code]
73
- end
74
- output_data[code] << output_data_instance
51
+ xml.xpath('//Row').each do |row|
52
+ row_children = row.children
53
+ code = row_children.find { |x| x.name == 'Code' }.children.first.text
54
+ output_data[code] ||= []
55
+ output_data_instance = {}
56
+ row_children.each do |row_child|
57
+ output_data_instance[row_child.name] = row_child.children.first.text
58
+ end
59
+ if file =~ /tni/
60
+ puts "output_data_instance: #{output_data_instance.inspect}"
61
+ output_data_instance[:mlf_data] = {}
62
+ unless @mlf_data[code].nil?
63
+ output_data_instance[:mlf_data] = @mlf_data[code].deep_dup
64
+ output_data_instance[:mlf_data][:loss_factors].reject! do |x|
65
+ Time.parse(output_data_instance['ToDate']) < x[:start] ||
66
+ Time.parse(output_data_instance['FromDate']) >= x[:finish]
75
67
  end
68
+ puts 'output_data_instance[:mlf_data][:loss_factors]: ' \
69
+ "#{output_data_instance[:mlf_data][:loss_factors].inspect}"
70
+ end
71
+ elsif file =~ /dlf/
72
+ output_data_instance[:nsp_code] = @dlf_data[code]
73
+ end
74
+ output_data[code] << output_data_instance
75
+ end
76
76
 
77
- File.write(File.join(@path, output_file), output_data.to_json)
77
+ File.write(File.join(@path, output_file), output_data.to_json)
78
78
  end
@@ -135,9 +135,9 @@ describe AEMO::NEM12 do
135
135
  Dir.entries(File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'NEM12'))
136
136
  .reject { |f| %w[. .. .DS_Store].include?(f) }
137
137
  .each do |file|
138
- described_class.parse_nem12_file(fixture(File.join('NEM12', file))).each do |nem12|
139
- expect(nem12.nmi_identifier).to be_a String
140
- end
138
+ described_class.parse_nem12_file(fixture(File.join('NEM12', file))).each do |nem12|
139
+ expect(nem12.nmi_identifier).to be_a String
140
+ end
141
141
  end
142
142
  end
143
143
  end
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.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Courtney
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 4.2.6
22
22
  - - "<"
23
23
  - !ruby/object:Gem::Version
24
- version: '7.2'
24
+ version: '9.0'
25
25
  type: :runtime
26
26
  prerelease: false
27
27
  version_requirements: !ruby/object:Gem::Requirement
@@ -31,7 +31,7 @@ dependencies:
31
31
  version: 4.2.6
32
32
  - - "<"
33
33
  - !ruby/object:Gem::Version
34
- version: '7.2'
34
+ version: '9.0'
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: httparty
37
37
  requirement: !ruby/object:Gem::Requirement
@@ -101,7 +101,7 @@ dependencies:
101
101
  version: '1.19'
102
102
  - - ">="
103
103
  - !ruby/object:Gem::Version
104
- version: 1.19.0
104
+ version: 1.19.3
105
105
  type: :runtime
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
@@ -111,7 +111,27 @@ dependencies:
111
111
  version: '1.19'
112
112
  - - ">="
113
113
  - !ruby/object:Gem::Version
114
- version: 1.19.0
114
+ version: 1.19.3
115
+ - !ruby/object:Gem::Dependency
116
+ name: ostruct
117
+ requirement: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - "~>"
120
+ - !ruby/object:Gem::Version
121
+ version: '0.5'
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: 0.5.0
125
+ type: :runtime
126
+ prerelease: false
127
+ version_requirements: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '0.5'
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: 0.5.0
115
135
  - !ruby/object:Gem::Dependency
116
136
  name: rexml
117
137
  requirement: !ruby/object:Gem::Requirement