wits 0.2.0 → 0.3.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 +4 -4
- data/CHANGELOG.md +13 -0
- data/LICENSE.txt +21 -0
- data/README.md +199 -0
- data/lib/wits/final_interim_prices/convenience_methods.rb +21 -22
- data/lib/wits/final_interim_prices.rb +7 -2
- data/lib/wits/five_minute_prices/convenience_methods.rb +27 -22
- data/lib/wits/five_minute_prices.rb +8 -3
- data/lib/wits/helpers.rb +22 -6
- data/lib/wits/nodes.rb +10 -13
- data/lib/wits/version.rb +1 -1
- data/wits.gemspec +40 -0
- metadata +20 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3664d73942923431552b9c6d8aa451590ffecfa7
|
4
|
+
data.tar.gz: a2d63096f181f9919b9829418808030df37a68a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e3151dde9f5638672f86f4eeac6980a84007e05cb9c5c01164016cf0853eda924672eca5ef60aa06c0b95f632033ab387ee741abe4f6ba43378fb982bfad788
|
7
|
+
data.tar.gz: 1f7effc8f248e35f38e9329cafd3030ee64264544ee8045d1ead1ab339266506798edfc5ffac933ca8ffe0d75811a8556d782b66e3dd8168df67dd23b3e58dc4
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
0.3.0 / 2015-04-09
|
2
|
+
------
|
3
|
+
* Changed the default date to be NZ's current date for five minute prices and averaged five minute prices.
|
4
|
+
* Updated the data format to handle NZ daylight savings.
|
5
|
+
* Updated the default dates to be agnostic of local/server time zones.
|
6
|
+
|
7
|
+
0.2.0 / 2015-04-03
|
8
|
+
------
|
9
|
+
No changes
|
10
|
+
|
11
|
+
0.1.0 / 2015-04-03
|
12
|
+
------
|
13
|
+
First release
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Gordon Chan, YouDo Limited
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,199 @@
|
|
1
|
+
# wits
|
2
|
+
[](http://badge.fury.io/rb/wits) [](https://gemnasium.com/gchan/wits) 
|
3
|
+
|
4
|
+
[](https://travis-ci.org/gchan/wits) [](https://coveralls.io/r/gchan/wits?branch=master) [](https://codeclimate.com/github/gchan/wits)
|
5
|
+
|
6
|
+
Retrieve electricity data from [WITS Free to air](http://electricityinfo.co.nz/) via a friendly Ruby interface.
|
7
|
+
|
8
|
+
WITS (Wholesale and information trading system) currently does not provide a public API but data can be retrieved through web forms and file downloads.
|
9
|
+
|
10
|
+
This client library interfaces with WITS to make data retrieval and formatting a breeze.
|
11
|
+
|
12
|
+
#### Quick Example
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
Wits.benmore
|
16
|
+
|
17
|
+
=> {:node_code=>"BEN2201",
|
18
|
+
:node_short_code=>"BEN",
|
19
|
+
:node_name=>"Benmore",
|
20
|
+
:price_type=>"Final",
|
21
|
+
:date=>#<Date: 2015-04-01 ((2457114j,0s,0n),+0s,2299161j)>,
|
22
|
+
:prices=>
|
23
|
+
[{:time=>2015-04-01 00:00:00 +1300, :trading_period=>1, :price=>95.82},
|
24
|
+
{:time=>2015-04-01 00:30:00 +1300, :trading_period=>2, :price=>90.24},
|
25
|
+
...
|
26
|
+
]
|
27
|
+
}
|
28
|
+
```
|
29
|
+
|
30
|
+
See the 'Usage' section for more examples.
|
31
|
+
|
32
|
+
## Installation
|
33
|
+
|
34
|
+
Add this line to your application's Gemfile:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
gem 'wits'
|
38
|
+
```
|
39
|
+
|
40
|
+
And then execute:
|
41
|
+
|
42
|
+
$ bundle
|
43
|
+
|
44
|
+
Or install it yourself as:
|
45
|
+
|
46
|
+
$ gem install wits
|
47
|
+
|
48
|
+
|
49
|
+
## Supported Ruby versions
|
50
|
+
wits supports MRI Ruby 1.9+ and the JRuby and Rubinius equivalent. The specific Ruby versions we build and test on can be found at [TravisCI](https://travis-ci.org/gchan/wits).
|
51
|
+
|
52
|
+
## Usage
|
53
|
+
|
54
|
+
wits can retrieve [Final/Interim Prices](http://electricityinfo.co.nz/comitFta/ftaPage.pricesMain) and [5 Minute Prices](http://electricityinfo.co.nz/comitFta/five_min_prices.main) for a given node and date.
|
55
|
+
|
56
|
+
#### Final/Interim Prices
|
57
|
+
Half-hourly final/interim prices can be retrieved in the following ways:
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
Wits.prices('ben2201') # Defaults to the day before yesterday
|
61
|
+
Wits.prices('BEN', '29/03/2015')
|
62
|
+
Wits.prices('ben', Time.parse('29/03/2015 13:37'))
|
63
|
+
Wits.prices('BEN2201', Date.parse('29/03/2015'))
|
64
|
+
```
|
65
|
+
|
66
|
+
If no date-like argument is provided, data for the day before yesterday will be retrieved.
|
67
|
+
|
68
|
+
There are convenient methods for known nodes. Use `Wits::Nodes.nodes` to see a list of nodes this library is aware of.
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
Wits.ben_prices
|
72
|
+
Wits.benmore_prices('29/03/2015')
|
73
|
+
Wits.ben2201_prices(Time.parse('29/03/2015 13:37'))
|
74
|
+
```
|
75
|
+
|
76
|
+
For Final/Interim prices, there are shorter methods without the `_prices` suffix.
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
Wits.ben
|
80
|
+
Wits.benmore
|
81
|
+
Wits.ben2201
|
82
|
+
```
|
83
|
+
|
84
|
+
All of the above methods can be called on `Wits::FinalInterimPrices`.
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
Wits::FinalInterimPrices.benmore_prices
|
88
|
+
```
|
89
|
+
|
90
|
+
#### 5 Minute Prices
|
91
|
+
Five minute electricity prices can be retrieved in a similar fashion:
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
Wits.five_minute_prices('hay2201') # Defaults to the day before yesterday
|
95
|
+
Wits.five_minute_prices('HAY', '29/03/2015')
|
96
|
+
Wits.five_minute_prices('hay', Time.parse('29/03/2015 13:37'))
|
97
|
+
Wits.five_minute_prices('HAY2201', Date.parse('29/03/2015'))
|
98
|
+
```
|
99
|
+
|
100
|
+
If no date-like argument is provided, data for today's date will be retrieved.
|
101
|
+
|
102
|
+
There are convenient methods for known nodes. Use `Wits::Nodes.nodes` to see a list of nodes this library is aware of.
|
103
|
+
|
104
|
+
```ruby
|
105
|
+
Wits.hay_five_minute_prices
|
106
|
+
Wits.haywards_five_minute_prices('29/03/2015')
|
107
|
+
Wits.hay2201_five_minute_prices(Time.parse('29/03/2015 13:37'))
|
108
|
+
```
|
109
|
+
|
110
|
+
All of the above methods can be called on `Wits::FiveMinutePrices`.
|
111
|
+
|
112
|
+
```ruby
|
113
|
+
Wits::FiveMinutePrices.hay_five_minute_prices
|
114
|
+
```
|
115
|
+
|
116
|
+
#### Average 5 Minute Prices
|
117
|
+
Average 5 Minute Prices can be retrieved by passing the `:average` argument (in conjunction with a date argument) to the above 5 Minute Prices methods:
|
118
|
+
|
119
|
+
```ruby
|
120
|
+
Wits.five_minute_prices('HAY', '29/03/2015', :average)
|
121
|
+
Wits.haywards_five_minute_prices('29/03/2015', :average)
|
122
|
+
Wits.hay2201_five_minute_prices(Date.parse('29/03/2015'), :average)
|
123
|
+
```
|
124
|
+
|
125
|
+
There is also a method to retrieve average prices without passing through an `:average` argument.
|
126
|
+
|
127
|
+
```ruby
|
128
|
+
Wits.average_five_minute_prices('hay2201')
|
129
|
+
Wits.average_five_minute_prices('HAY', '29/03/2015')
|
130
|
+
```
|
131
|
+
|
132
|
+
If no date-like argument is provided, data for today's date will be retrieved.
|
133
|
+
|
134
|
+
Again there are convenient methods for known nodes. The `:average` argument is not required.
|
135
|
+
|
136
|
+
```ruby
|
137
|
+
Wits.hay_average_five_minute_prices
|
138
|
+
Wits.haywards_average_five_minute_prices('29/03/2015')
|
139
|
+
Wits.hay2201_average_five_minute_prices(Date.parse('29/03/2015'))
|
140
|
+
```
|
141
|
+
|
142
|
+
All of the above methods can be called on `Wits::FiveMinutePrices`.
|
143
|
+
|
144
|
+
```ruby
|
145
|
+
Wits::FiveMinutePrices.hay_average_five_minute_prices
|
146
|
+
Wits::FiveMinutePrices.average_five_minute_prices('hay2201')
|
147
|
+
```
|
148
|
+
|
149
|
+
#### Errors
|
150
|
+
|
151
|
+
In addition to the usual Ruby errors and exceptions, wits can raise the following errors:
|
152
|
+
|
153
|
+
* `Wits::Error::ClientError`
|
154
|
+
* `Wits::Error::ConnectionFailed`
|
155
|
+
* `Wits::Error::TimeoutError`
|
156
|
+
* `Wits::Error::ResourceNotFound`
|
157
|
+
* `Wits::Error::ParsingError`
|
158
|
+
|
159
|
+
All of the above error classes inherit `Wits::Error::ClientError`, `Wits::Error`, and `StandardError`.
|
160
|
+
|
161
|
+
#### Time Zones
|
162
|
+
|
163
|
+
wits will respect the local (server) time zone and correctly return Time instances in the local time zone. Daylight savings adjustments are accounted for.
|
164
|
+
|
165
|
+
For instance, if the NZT time for the first trading period is `2015-03-29 00:00:00 +1300`, wits will return `2015-03-28 07:00:00 -0400` for an 'America/New_York' local time zone.
|
166
|
+
|
167
|
+
`Date` instances are always in the context of New Zealand.
|
168
|
+
|
169
|
+
#### Known Issues
|
170
|
+
|
171
|
+
There is no reliable method (without web scraping) of distinguishing interim half-hourly prices from final prices. Until the WITS CSV file correctly reports the price type, the half-hourly prices are always reported as 'Final'
|
172
|
+
|
173
|
+
The CSV files for five minute prices and average five minute prices are missing some data rows on days when daylight savings ends. As a result, wits will return incomplete (and possibly invalid) data for dates when daylight savings ends (e.g. 5 April 2015).
|
174
|
+
|
175
|
+
## Possible Enhancements
|
176
|
+
|
177
|
+
WITS also provides [Price Index](http://electricityinfo.co.nz/comitFta/price_index.summary) and [Demand](http://electricityinfo.co.nz/comitFta/ftaPage.demand) information which could be retrieved and delivered through a client library. Pull Requests are welcome!
|
178
|
+
|
179
|
+
## Development
|
180
|
+
|
181
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
182
|
+
|
183
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
184
|
+
|
185
|
+
Run `bin/guard` to automatically launch specs when files are modified.
|
186
|
+
|
187
|
+
Run `bundle exec rake spec` to manually launch specs.
|
188
|
+
|
189
|
+
## Contributing
|
190
|
+
|
191
|
+
1. Fork it ( https://github.com/gchan/wits/fork )
|
192
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
193
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
194
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
195
|
+
5. Create a new Pull Request
|
196
|
+
|
197
|
+
## License
|
198
|
+
|
199
|
+
wits is Copyright (c) 2015 Gordon Chan and is released under the MIT License. It is free software, and may be redistributed under the terms specified in the LICENSE file.
|
@@ -3,35 +3,34 @@ require 'wits/nodes'
|
|
3
3
|
module Wits
|
4
4
|
module FinalInterimPrices
|
5
5
|
module ConvenienceMethods
|
6
|
-
Wits::Nodes.nodes.each do |node, name|
|
7
|
-
# def ben2201
|
8
|
-
define_method node.downcase do |*args|
|
9
|
-
prices(node, *args)
|
10
|
-
end
|
11
6
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
7
|
+
def self.extended(_base)
|
8
|
+
Wits::Nodes.nodes.each do |node, name|
|
9
|
+
# def ben2201
|
10
|
+
create_prices_method(node.downcase, node)
|
16
11
|
|
17
|
-
|
18
|
-
|
19
|
-
prices(node, *args)
|
20
|
-
end
|
12
|
+
# def hay
|
13
|
+
create_prices_method(node.downcase[0..2], node)
|
21
14
|
|
15
|
+
# def halfway_bush
|
16
|
+
create_prices_method(name.downcase.tr(' ', '_'), node)
|
22
17
|
|
23
|
-
# def ben2201_prices
|
24
|
-
define_method "#{node.downcase}_prices" do |*args|
|
25
|
-
prices(node, *args)
|
26
|
-
end
|
27
18
|
|
28
|
-
|
29
|
-
|
30
|
-
|
19
|
+
# def ben2201_prices
|
20
|
+
create_prices_method("#{node.downcase}_prices", node)
|
21
|
+
|
22
|
+
# def hay_prices
|
23
|
+
create_prices_method("#{node.downcase[0..2]}_prices", node)
|
24
|
+
|
25
|
+
# def halfway_bush_prices
|
26
|
+
create_prices_method("#{name.downcase.tr(' ', '_')}_prices", node)
|
31
27
|
end
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
32
31
|
|
33
|
-
|
34
|
-
define_method
|
32
|
+
def self.create_prices_method(method_name, node)
|
33
|
+
define_method method_name do |*args|
|
35
34
|
prices(node, *args)
|
36
35
|
end
|
37
36
|
end
|
@@ -16,7 +16,7 @@ module Wits
|
|
16
16
|
base.extend ConvenienceMethods
|
17
17
|
end
|
18
18
|
|
19
|
-
def prices(node, date =
|
19
|
+
def prices(node, date = nz_current_date - 2)
|
20
20
|
node = format_node(node)
|
21
21
|
date = format_date(date)
|
22
22
|
|
@@ -62,8 +62,13 @@ module Wits
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def process_prices(csv, date)
|
65
|
+
times = []
|
66
|
+
|
65
67
|
csv.map do |time, trading_period, price|
|
66
|
-
|
68
|
+
repeated_time = times.include?(time)
|
69
|
+
times << time
|
70
|
+
|
71
|
+
format_price(date, time, trading_period, price, repeated_time)
|
67
72
|
end
|
68
73
|
end
|
69
74
|
end
|
@@ -3,38 +3,43 @@ require 'wits/nodes'
|
|
3
3
|
module Wits
|
4
4
|
module FiveMinutePrices
|
5
5
|
module ConvenienceMethods
|
6
|
-
Wits::Nodes.nodes.each do |node, name|
|
7
|
-
# def ben2201_five_minute_prices
|
8
|
-
define_method "#{node.downcase}_five_minute_prices" do |*args|
|
9
|
-
five_minute_prices(node, *args)
|
10
|
-
end
|
11
6
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
7
|
+
def self.extended(base)
|
8
|
+
Wits::Nodes.nodes.each do |node, name|
|
9
|
+
# def ben2201_five_minute_prices
|
10
|
+
create_five_min_method(node.downcase, node)
|
16
11
|
|
17
|
-
|
18
|
-
|
19
|
-
five_minute_prices(node, *args)
|
20
|
-
end
|
12
|
+
# def hay_five_minute_prices
|
13
|
+
create_five_min_method(node.downcase[0..2], node)
|
21
14
|
|
15
|
+
# def halfway_bush_five_minute_prices
|
16
|
+
create_five_min_method(name.downcase.tr(' ', '_'), node)
|
22
17
|
|
23
|
-
|
24
|
-
|
25
|
-
|
18
|
+
|
19
|
+
# def ben2201_avgerage_five_minute_prices
|
20
|
+
create_avg_five_min_method(node.downcase, node)
|
21
|
+
|
22
|
+
# def hay_avgerage_five_minute_prices
|
23
|
+
create_avg_five_min_method(node.downcase[0..2], node)
|
24
|
+
|
25
|
+
# def halfway_bush_avgerage_five_minute_prices
|
26
|
+
create_avg_five_min_method(name.downcase.tr(' ', '_'), node)
|
26
27
|
end
|
28
|
+
end
|
27
29
|
|
28
|
-
|
29
|
-
|
30
|
-
|
30
|
+
private
|
31
|
+
|
32
|
+
def self.create_five_min_method(method_prefix, node)
|
33
|
+
define_method "#{method_prefix}_five_minute_prices" do |*args|
|
34
|
+
five_minute_prices(node, *args)
|
31
35
|
end
|
36
|
+
end
|
32
37
|
|
33
|
-
|
34
|
-
define_method "#{
|
38
|
+
def self.create_avg_five_min_method(method_prefix, node)
|
39
|
+
define_method "#{method_prefix}_average_five_minute_prices" do |*args|
|
35
40
|
average_five_minute_prices(node, *args)
|
36
41
|
end
|
37
42
|
end
|
38
43
|
end
|
39
44
|
end
|
40
|
-
end
|
45
|
+
end
|
@@ -16,11 +16,11 @@ module Wits
|
|
16
16
|
base.extend ConvenienceMethods
|
17
17
|
end
|
18
18
|
|
19
|
-
def average_five_minute_prices(node, date =
|
19
|
+
def average_five_minute_prices(node, date = nz_current_date)
|
20
20
|
five_minute_prices(node, date, :average)
|
21
21
|
end
|
22
22
|
|
23
|
-
def five_minute_prices(node, date =
|
23
|
+
def five_minute_prices(node, date = nz_current_date, type = :price )
|
24
24
|
node = format_node(node)
|
25
25
|
date = format_date(date)
|
26
26
|
type = format_price_type(type)
|
@@ -78,8 +78,13 @@ module Wits
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def process_five_min_prices(csv)
|
81
|
+
times = []
|
82
|
+
|
81
83
|
csv.map do |_node, date, trading_period, time, price, *_|
|
82
|
-
|
84
|
+
repeated_time = times.include?(time)
|
85
|
+
times << time
|
86
|
+
|
87
|
+
format_price(date, time, trading_period, price, repeated_time)
|
83
88
|
end
|
84
89
|
end
|
85
90
|
end
|
data/lib/wits/helpers.rb
CHANGED
@@ -23,9 +23,9 @@ module Wits
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
def format_price(date, time, trading_period, price)
|
26
|
+
def format_price(date, time, trading_period, price, repeated_time)
|
27
27
|
{
|
28
|
-
time: parse_nz_time(date, time),
|
28
|
+
time: parse_nz_time(date, time, repeated_time),
|
29
29
|
trading_period: trading_period.to_i,
|
30
30
|
price: price.to_f
|
31
31
|
}
|
@@ -42,14 +42,30 @@ module Wits
|
|
42
42
|
}
|
43
43
|
end
|
44
44
|
|
45
|
-
def parse_nz_time(date, time)
|
46
|
-
|
45
|
+
def parse_nz_time(date, time, repeated_time)
|
46
|
+
date = Date.parse(date) unless date.is_a?(Date)
|
47
47
|
|
48
|
-
#
|
48
|
+
# TimezonePeriod for local Time (midnight)
|
49
|
+
tz_period = nz_time_zone.period_for_local(date.to_time)
|
50
|
+
|
51
|
+
# Assume we transitioned between NZST and NZDT if
|
52
|
+
# a time is repeated
|
53
|
+
dst = tz_period.dst?
|
54
|
+
dst = !dst if repeated_time
|
55
|
+
|
56
|
+
# Time zone information of the Time object is ignored by TZInfo
|
49
57
|
time = Time.parse("#{date} #{time}")
|
50
58
|
|
51
59
|
# Output in local time
|
52
|
-
|
60
|
+
nz_time_zone.local_to_utc(time, dst).localtime
|
61
|
+
end
|
62
|
+
|
63
|
+
def nz_time_zone
|
64
|
+
@nz_time_zone ||= TZInfo::Timezone.get('Pacific/Auckland')
|
65
|
+
end
|
66
|
+
|
67
|
+
def nz_current_date
|
68
|
+
nz_time_zone.utc_to_local(Time.now.utc).to_date
|
53
69
|
end
|
54
70
|
end
|
55
71
|
end
|
data/lib/wits/nodes.rb
CHANGED
@@ -18,19 +18,16 @@ module Wits
|
|
18
18
|
|
19
19
|
NODE_NAMES = NODES.invert.freeze
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
TUI: 'TUI1101',
|
32
|
-
WKM: 'WKM2201'
|
33
|
-
}.freeze
|
21
|
+
# {
|
22
|
+
# BEN: 'BEN2201',
|
23
|
+
# HWB: 'HWB2201'
|
24
|
+
# ...
|
25
|
+
# }
|
26
|
+
SHORT_CODES = Hash[
|
27
|
+
NODES.keys.map { |node| node[0..2].to_sym }
|
28
|
+
.zip(NODES.keys.map(&:to_s))
|
29
|
+
].freeze
|
30
|
+
|
34
31
|
|
35
32
|
def nodes
|
36
33
|
NODES
|
data/lib/wits/version.rb
CHANGED
data/wits.gemspec
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'wits/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'wits'
|
8
|
+
spec.version = Wits::VERSION
|
9
|
+
spec.authors = ['Gordon Chan']
|
10
|
+
spec.email = ['developer.gordon@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = %q{Retrieves electricity data from WITS Free to Air}
|
13
|
+
spec.description = %q{A Ruby interface for WITS (Wholesale and
|
14
|
+
information trading system) to retrieve New Zealand electricity data.}
|
15
|
+
spec.homepage = 'https://www.github.com/gchan/wits'
|
16
|
+
spec.license = 'MIT'
|
17
|
+
|
18
|
+
spec.files = Dir['lib/**/*.rb'] + %w(CHANGELOG.md LICENSE.txt README.md wits.gemspec)
|
19
|
+
spec.bindir = 'bin'
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
spec.platform = Gem::Platform::RUBY
|
22
|
+
|
23
|
+
spec.add_runtime_dependency 'faraday', '~> 0.9.1'
|
24
|
+
spec.add_runtime_dependency 'tzinfo', '~> 1.2.2'
|
25
|
+
|
26
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
27
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
28
|
+
spec.add_development_dependency 'pry', '~> 0.10.1'
|
29
|
+
|
30
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.5.0'
|
31
|
+
spec.add_development_dependency 'rspec', '~> 3.2.0'
|
32
|
+
spec.add_development_dependency 'vcr', '~> 2.9.3'
|
33
|
+
spec.add_development_dependency 'webmock', '~> 1.21.0'
|
34
|
+
spec.add_development_dependency 'multi_json', '~> 1.11.0'
|
35
|
+
spec.add_development_dependency 'timecop', '~> 0.7.3'
|
36
|
+
spec.add_development_dependency 'simplecov', '~> 0.9.2'
|
37
|
+
spec.add_development_dependency 'rubocop', '~> 0.29.1'
|
38
|
+
spec.add_development_dependency 'coveralls', '~> 0.8.0'
|
39
|
+
spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.4.7'
|
40
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wits
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gordon Chan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -206,6 +206,20 @@ dependencies:
|
|
206
206
|
- - "~>"
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: 0.8.0
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: codeclimate-test-reporter
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - "~>"
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: 0.4.7
|
216
|
+
type: :development
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - "~>"
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: 0.4.7
|
209
223
|
description: |-
|
210
224
|
A Ruby interface for WITS (Wholesale and
|
211
225
|
information trading system) to retrieve New Zealand electricity data.
|
@@ -215,6 +229,9 @@ executables: []
|
|
215
229
|
extensions: []
|
216
230
|
extra_rdoc_files: []
|
217
231
|
files:
|
232
|
+
- CHANGELOG.md
|
233
|
+
- LICENSE.txt
|
234
|
+
- README.md
|
218
235
|
- lib/wits.rb
|
219
236
|
- lib/wits/client.rb
|
220
237
|
- lib/wits/error.rb
|
@@ -225,6 +242,7 @@ files:
|
|
225
242
|
- lib/wits/helpers.rb
|
226
243
|
- lib/wits/nodes.rb
|
227
244
|
- lib/wits/version.rb
|
245
|
+
- wits.gemspec
|
228
246
|
homepage: https://www.github.com/gchan/wits
|
229
247
|
licenses:
|
230
248
|
- MIT
|