smartermeter 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/README.md +16 -16
- data/Rakefile +9 -14
- data/lib/smartermeter/daemon.rb +9 -10
- data/lib/smartermeter/interfaces/swing.rb +35 -30
- data/lib/smartermeter/samples.rb +21 -25
- data/lib/smartermeter/service.rb +49 -66
- data/lib/smartermeter/services/pachube.erb +2 -0
- data/lib/smartermeter/services/{google_powermeter.rb → pachube.rb} +10 -10
- data/lib/smartermeter.rb +2 -2
- data/smartermeter.gemspec +8 -16
- metadata +147 -154
- data/lib/smartermeter/services/google_powermeter.erb +0 -16
- data/spec/fixtures/data.csv +0 -21
- data/spec/fixtures/expected_google_request.xml +0 -292
- data/spec/fixtures/vcr_cassettes/brighterplanet.yml +0 -106
- data/spec/sample_spec.rb +0 -8
- data/spec/samples_spec.rb +0 -39
- data/spec/service_spec.rb +0 -7
- data/spec/services/brighterplanet_spec.rb +0 -26
- data/spec/services/google_powermeter_spec.rb +0 -19
- data/spec/spec_helper.rb +0 -15
@@ -1,292 +0,0 @@
|
|
1
|
-
<?xml version="1.0"?>
|
2
|
-
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
3
|
-
|
4
|
-
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
5
|
-
<id>https://www.google.com/powermeter/feeds/path/durMeasurement/2009-09-27T07_00_00.000Z</id>
|
6
|
-
<category scheme="http://schemas.google.com/g/2005#kind"
|
7
|
-
term="http://schemas.google.com/meter/2008#durMeasurement"/>
|
8
|
-
<meter:subject>https://www.google.com/powermeter/feeds/path</meter:subject>
|
9
|
-
<meter:startTime meter:uncertainty="1.000000">2009-09-27T07:00:00.000Z</meter:startTime>
|
10
|
-
<meter:endTime meter:uncertainty="1.000000">2009-09-27T08:00:00.000Z</meter:endTime>
|
11
|
-
<meter:quantity meter:uncertainty="0.001000" meter:unit="kW h">
|
12
|
-
|
13
|
-
</meter:quantity>
|
14
|
-
</entry>
|
15
|
-
|
16
|
-
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
17
|
-
<id>https://www.google.com/powermeter/feeds/path/durMeasurement/2009-09-27T08_00_00.000Z</id>
|
18
|
-
<category scheme="http://schemas.google.com/g/2005#kind"
|
19
|
-
term="http://schemas.google.com/meter/2008#durMeasurement"/>
|
20
|
-
<meter:subject>https://www.google.com/powermeter/feeds/path</meter:subject>
|
21
|
-
<meter:startTime meter:uncertainty="1.000000">2009-09-27T08:00:00.000Z</meter:startTime>
|
22
|
-
<meter:endTime meter:uncertainty="1.000000">2009-09-27T09:00:00.000Z</meter:endTime>
|
23
|
-
<meter:quantity meter:uncertainty="0.001000" meter:unit="kW h">
|
24
|
-
0.205
|
25
|
-
</meter:quantity>
|
26
|
-
</entry>
|
27
|
-
|
28
|
-
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
29
|
-
<id>https://www.google.com/powermeter/feeds/path/durMeasurement/2009-09-27T09_00_00.000Z</id>
|
30
|
-
<category scheme="http://schemas.google.com/g/2005#kind"
|
31
|
-
term="http://schemas.google.com/meter/2008#durMeasurement"/>
|
32
|
-
<meter:subject>https://www.google.com/powermeter/feeds/path</meter:subject>
|
33
|
-
<meter:startTime meter:uncertainty="1.000000">2009-09-27T09:00:00.000Z</meter:startTime>
|
34
|
-
<meter:endTime meter:uncertainty="1.000000">2009-09-27T10:00:00.000Z</meter:endTime>
|
35
|
-
<meter:quantity meter:uncertainty="0.001000" meter:unit="kW h">
|
36
|
-
0.257
|
37
|
-
</meter:quantity>
|
38
|
-
</entry>
|
39
|
-
|
40
|
-
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
41
|
-
<id>https://www.google.com/powermeter/feeds/path/durMeasurement/2009-09-27T10_00_00.000Z</id>
|
42
|
-
<category scheme="http://schemas.google.com/g/2005#kind"
|
43
|
-
term="http://schemas.google.com/meter/2008#durMeasurement"/>
|
44
|
-
<meter:subject>https://www.google.com/powermeter/feeds/path</meter:subject>
|
45
|
-
<meter:startTime meter:uncertainty="1.000000">2009-09-27T10:00:00.000Z</meter:startTime>
|
46
|
-
<meter:endTime meter:uncertainty="1.000000">2009-09-27T11:00:00.000Z</meter:endTime>
|
47
|
-
<meter:quantity meter:uncertainty="0.001000" meter:unit="kW h">
|
48
|
-
0.131
|
49
|
-
</meter:quantity>
|
50
|
-
</entry>
|
51
|
-
|
52
|
-
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
53
|
-
<id>https://www.google.com/powermeter/feeds/path/durMeasurement/2009-09-27T11_00_00.000Z</id>
|
54
|
-
<category scheme="http://schemas.google.com/g/2005#kind"
|
55
|
-
term="http://schemas.google.com/meter/2008#durMeasurement"/>
|
56
|
-
<meter:subject>https://www.google.com/powermeter/feeds/path</meter:subject>
|
57
|
-
<meter:startTime meter:uncertainty="1.000000">2009-09-27T11:00:00.000Z</meter:startTime>
|
58
|
-
<meter:endTime meter:uncertainty="1.000000">2009-09-27T12:00:00.000Z</meter:endTime>
|
59
|
-
<meter:quantity meter:uncertainty="0.001000" meter:unit="kW h">
|
60
|
-
0.142
|
61
|
-
</meter:quantity>
|
62
|
-
</entry>
|
63
|
-
|
64
|
-
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
65
|
-
<id>https://www.google.com/powermeter/feeds/path/durMeasurement/2009-09-27T12_00_00.000Z</id>
|
66
|
-
<category scheme="http://schemas.google.com/g/2005#kind"
|
67
|
-
term="http://schemas.google.com/meter/2008#durMeasurement"/>
|
68
|
-
<meter:subject>https://www.google.com/powermeter/feeds/path</meter:subject>
|
69
|
-
<meter:startTime meter:uncertainty="1.000000">2009-09-27T12:00:00.000Z</meter:startTime>
|
70
|
-
<meter:endTime meter:uncertainty="1.000000">2009-09-27T13:00:00.000Z</meter:endTime>
|
71
|
-
<meter:quantity meter:uncertainty="0.001000" meter:unit="kW h">
|
72
|
-
0.136
|
73
|
-
</meter:quantity>
|
74
|
-
</entry>
|
75
|
-
|
76
|
-
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
77
|
-
<id>https://www.google.com/powermeter/feeds/path/durMeasurement/2009-09-27T13_00_00.000Z</id>
|
78
|
-
<category scheme="http://schemas.google.com/g/2005#kind"
|
79
|
-
term="http://schemas.google.com/meter/2008#durMeasurement"/>
|
80
|
-
<meter:subject>https://www.google.com/powermeter/feeds/path</meter:subject>
|
81
|
-
<meter:startTime meter:uncertainty="1.000000">2009-09-27T13:00:00.000Z</meter:startTime>
|
82
|
-
<meter:endTime meter:uncertainty="1.000000">2009-09-27T14:00:00.000Z</meter:endTime>
|
83
|
-
<meter:quantity meter:uncertainty="0.001000" meter:unit="kW h">
|
84
|
-
0.127
|
85
|
-
</meter:quantity>
|
86
|
-
</entry>
|
87
|
-
|
88
|
-
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
89
|
-
<id>https://www.google.com/powermeter/feeds/path/durMeasurement/2009-09-27T14_00_00.000Z</id>
|
90
|
-
<category scheme="http://schemas.google.com/g/2005#kind"
|
91
|
-
term="http://schemas.google.com/meter/2008#durMeasurement"/>
|
92
|
-
<meter:subject>https://www.google.com/powermeter/feeds/path</meter:subject>
|
93
|
-
<meter:startTime meter:uncertainty="1.000000">2009-09-27T14:00:00.000Z</meter:startTime>
|
94
|
-
<meter:endTime meter:uncertainty="1.000000">2009-09-27T15:00:00.000Z</meter:endTime>
|
95
|
-
<meter:quantity meter:uncertainty="0.001000" meter:unit="kW h">
|
96
|
-
0.137
|
97
|
-
</meter:quantity>
|
98
|
-
</entry>
|
99
|
-
|
100
|
-
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
101
|
-
<id>https://www.google.com/powermeter/feeds/path/durMeasurement/2009-09-27T15_00_00.000Z</id>
|
102
|
-
<category scheme="http://schemas.google.com/g/2005#kind"
|
103
|
-
term="http://schemas.google.com/meter/2008#durMeasurement"/>
|
104
|
-
<meter:subject>https://www.google.com/powermeter/feeds/path</meter:subject>
|
105
|
-
<meter:startTime meter:uncertainty="1.000000">2009-09-27T15:00:00.000Z</meter:startTime>
|
106
|
-
<meter:endTime meter:uncertainty="1.000000">2009-09-27T16:00:00.000Z</meter:endTime>
|
107
|
-
<meter:quantity meter:uncertainty="0.001000" meter:unit="kW h">
|
108
|
-
0.136
|
109
|
-
</meter:quantity>
|
110
|
-
</entry>
|
111
|
-
|
112
|
-
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
113
|
-
<id>https://www.google.com/powermeter/feeds/path/durMeasurement/2009-09-27T16_00_00.000Z</id>
|
114
|
-
<category scheme="http://schemas.google.com/g/2005#kind"
|
115
|
-
term="http://schemas.google.com/meter/2008#durMeasurement"/>
|
116
|
-
<meter:subject>https://www.google.com/powermeter/feeds/path</meter:subject>
|
117
|
-
<meter:startTime meter:uncertainty="1.000000">2009-09-27T16:00:00.000Z</meter:startTime>
|
118
|
-
<meter:endTime meter:uncertainty="1.000000">2009-09-27T17:00:00.000Z</meter:endTime>
|
119
|
-
<meter:quantity meter:uncertainty="0.001000" meter:unit="kW h">
|
120
|
-
0.134
|
121
|
-
</meter:quantity>
|
122
|
-
</entry>
|
123
|
-
|
124
|
-
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
125
|
-
<id>https://www.google.com/powermeter/feeds/path/durMeasurement/2009-09-27T17_00_00.000Z</id>
|
126
|
-
<category scheme="http://schemas.google.com/g/2005#kind"
|
127
|
-
term="http://schemas.google.com/meter/2008#durMeasurement"/>
|
128
|
-
<meter:subject>https://www.google.com/powermeter/feeds/path</meter:subject>
|
129
|
-
<meter:startTime meter:uncertainty="1.000000">2009-09-27T17:00:00.000Z</meter:startTime>
|
130
|
-
<meter:endTime meter:uncertainty="1.000000">2009-09-27T18:00:00.000Z</meter:endTime>
|
131
|
-
<meter:quantity meter:uncertainty="0.001000" meter:unit="kW h">
|
132
|
-
0.416
|
133
|
-
</meter:quantity>
|
134
|
-
</entry>
|
135
|
-
|
136
|
-
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
137
|
-
<id>https://www.google.com/powermeter/feeds/path/durMeasurement/2009-09-27T18_00_00.000Z</id>
|
138
|
-
<category scheme="http://schemas.google.com/g/2005#kind"
|
139
|
-
term="http://schemas.google.com/meter/2008#durMeasurement"/>
|
140
|
-
<meter:subject>https://www.google.com/powermeter/feeds/path</meter:subject>
|
141
|
-
<meter:startTime meter:uncertainty="1.000000">2009-09-27T18:00:00.000Z</meter:startTime>
|
142
|
-
<meter:endTime meter:uncertainty="1.000000">2009-09-27T19:00:00.000Z</meter:endTime>
|
143
|
-
<meter:quantity meter:uncertainty="0.001000" meter:unit="kW h">
|
144
|
-
1.732
|
145
|
-
</meter:quantity>
|
146
|
-
</entry>
|
147
|
-
|
148
|
-
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
149
|
-
<id>https://www.google.com/powermeter/feeds/path/durMeasurement/2009-09-27T19_00_00.000Z</id>
|
150
|
-
<category scheme="http://schemas.google.com/g/2005#kind"
|
151
|
-
term="http://schemas.google.com/meter/2008#durMeasurement"/>
|
152
|
-
<meter:subject>https://www.google.com/powermeter/feeds/path</meter:subject>
|
153
|
-
<meter:startTime meter:uncertainty="1.000000">2009-09-27T19:00:00.000Z</meter:startTime>
|
154
|
-
<meter:endTime meter:uncertainty="1.000000">2009-09-27T20:00:00.000Z</meter:endTime>
|
155
|
-
<meter:quantity meter:uncertainty="0.001000" meter:unit="kW h">
|
156
|
-
1.844
|
157
|
-
</meter:quantity>
|
158
|
-
</entry>
|
159
|
-
|
160
|
-
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
161
|
-
<id>https://www.google.com/powermeter/feeds/path/durMeasurement/2009-09-27T20_00_00.000Z</id>
|
162
|
-
<category scheme="http://schemas.google.com/g/2005#kind"
|
163
|
-
term="http://schemas.google.com/meter/2008#durMeasurement"/>
|
164
|
-
<meter:subject>https://www.google.com/powermeter/feeds/path</meter:subject>
|
165
|
-
<meter:startTime meter:uncertainty="1.000000">2009-09-27T20:00:00.000Z</meter:startTime>
|
166
|
-
<meter:endTime meter:uncertainty="1.000000">2009-09-27T21:00:00.000Z</meter:endTime>
|
167
|
-
<meter:quantity meter:uncertainty="0.001000" meter:unit="kW h">
|
168
|
-
0.19
|
169
|
-
</meter:quantity>
|
170
|
-
</entry>
|
171
|
-
|
172
|
-
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
173
|
-
<id>https://www.google.com/powermeter/feeds/path/durMeasurement/2009-09-27T21_00_00.000Z</id>
|
174
|
-
<category scheme="http://schemas.google.com/g/2005#kind"
|
175
|
-
term="http://schemas.google.com/meter/2008#durMeasurement"/>
|
176
|
-
<meter:subject>https://www.google.com/powermeter/feeds/path</meter:subject>
|
177
|
-
<meter:startTime meter:uncertainty="1.000000">2009-09-27T21:00:00.000Z</meter:startTime>
|
178
|
-
<meter:endTime meter:uncertainty="1.000000">2009-09-27T22:00:00.000Z</meter:endTime>
|
179
|
-
<meter:quantity meter:uncertainty="0.001000" meter:unit="kW h">
|
180
|
-
0.189
|
181
|
-
</meter:quantity>
|
182
|
-
</entry>
|
183
|
-
|
184
|
-
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
185
|
-
<id>https://www.google.com/powermeter/feeds/path/durMeasurement/2009-09-27T22_00_00.000Z</id>
|
186
|
-
<category scheme="http://schemas.google.com/g/2005#kind"
|
187
|
-
term="http://schemas.google.com/meter/2008#durMeasurement"/>
|
188
|
-
<meter:subject>https://www.google.com/powermeter/feeds/path</meter:subject>
|
189
|
-
<meter:startTime meter:uncertainty="1.000000">2009-09-27T22:00:00.000Z</meter:startTime>
|
190
|
-
<meter:endTime meter:uncertainty="1.000000">2009-09-27T23:00:00.000Z</meter:endTime>
|
191
|
-
<meter:quantity meter:uncertainty="0.001000" meter:unit="kW h">
|
192
|
-
0.182
|
193
|
-
</meter:quantity>
|
194
|
-
</entry>
|
195
|
-
|
196
|
-
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
197
|
-
<id>https://www.google.com/powermeter/feeds/path/durMeasurement/2009-09-27T23_00_00.000Z</id>
|
198
|
-
<category scheme="http://schemas.google.com/g/2005#kind"
|
199
|
-
term="http://schemas.google.com/meter/2008#durMeasurement"/>
|
200
|
-
<meter:subject>https://www.google.com/powermeter/feeds/path</meter:subject>
|
201
|
-
<meter:startTime meter:uncertainty="1.000000">2009-09-27T23:00:00.000Z</meter:startTime>
|
202
|
-
<meter:endTime meter:uncertainty="1.000000">2009-09-28T00:00:00.000Z</meter:endTime>
|
203
|
-
<meter:quantity meter:uncertainty="0.001000" meter:unit="kW h">
|
204
|
-
0.173
|
205
|
-
</meter:quantity>
|
206
|
-
</entry>
|
207
|
-
|
208
|
-
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
209
|
-
<id>https://www.google.com/powermeter/feeds/path/durMeasurement/2009-09-28T00_00_00.000Z</id>
|
210
|
-
<category scheme="http://schemas.google.com/g/2005#kind"
|
211
|
-
term="http://schemas.google.com/meter/2008#durMeasurement"/>
|
212
|
-
<meter:subject>https://www.google.com/powermeter/feeds/path</meter:subject>
|
213
|
-
<meter:startTime meter:uncertainty="1.000000">2009-09-28T00:00:00.000Z</meter:startTime>
|
214
|
-
<meter:endTime meter:uncertainty="1.000000">2009-09-28T01:00:00.000Z</meter:endTime>
|
215
|
-
<meter:quantity meter:uncertainty="0.001000" meter:unit="kW h">
|
216
|
-
1.136
|
217
|
-
</meter:quantity>
|
218
|
-
</entry>
|
219
|
-
|
220
|
-
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
221
|
-
<id>https://www.google.com/powermeter/feeds/path/durMeasurement/2009-09-28T01_00_00.000Z</id>
|
222
|
-
<category scheme="http://schemas.google.com/g/2005#kind"
|
223
|
-
term="http://schemas.google.com/meter/2008#durMeasurement"/>
|
224
|
-
<meter:subject>https://www.google.com/powermeter/feeds/path</meter:subject>
|
225
|
-
<meter:startTime meter:uncertainty="1.000000">2009-09-28T01:00:00.000Z</meter:startTime>
|
226
|
-
<meter:endTime meter:uncertainty="1.000000">2009-09-28T02:00:00.000Z</meter:endTime>
|
227
|
-
<meter:quantity meter:uncertainty="0.001000" meter:unit="kW h">
|
228
|
-
3.55
|
229
|
-
</meter:quantity>
|
230
|
-
</entry>
|
231
|
-
|
232
|
-
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
233
|
-
<id>https://www.google.com/powermeter/feeds/path/durMeasurement/2009-09-28T02_00_00.000Z</id>
|
234
|
-
<category scheme="http://schemas.google.com/g/2005#kind"
|
235
|
-
term="http://schemas.google.com/meter/2008#durMeasurement"/>
|
236
|
-
<meter:subject>https://www.google.com/powermeter/feeds/path</meter:subject>
|
237
|
-
<meter:startTime meter:uncertainty="1.000000">2009-09-28T02:00:00.000Z</meter:startTime>
|
238
|
-
<meter:endTime meter:uncertainty="1.000000">2009-09-28T03:00:00.000Z</meter:endTime>
|
239
|
-
<meter:quantity meter:uncertainty="0.001000" meter:unit="kW h">
|
240
|
-
3.011
|
241
|
-
</meter:quantity>
|
242
|
-
</entry>
|
243
|
-
|
244
|
-
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
245
|
-
<id>https://www.google.com/powermeter/feeds/path/durMeasurement/2009-09-28T03_00_00.000Z</id>
|
246
|
-
<category scheme="http://schemas.google.com/g/2005#kind"
|
247
|
-
term="http://schemas.google.com/meter/2008#durMeasurement"/>
|
248
|
-
<meter:subject>https://www.google.com/powermeter/feeds/path</meter:subject>
|
249
|
-
<meter:startTime meter:uncertainty="1.000000">2009-09-28T03:00:00.000Z</meter:startTime>
|
250
|
-
<meter:endTime meter:uncertainty="1.000000">2009-09-28T04:00:00.000Z</meter:endTime>
|
251
|
-
<meter:quantity meter:uncertainty="0.001000" meter:unit="kW h">
|
252
|
-
1.426
|
253
|
-
</meter:quantity>
|
254
|
-
</entry>
|
255
|
-
|
256
|
-
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
257
|
-
<id>https://www.google.com/powermeter/feeds/path/durMeasurement/2009-09-28T04_00_00.000Z</id>
|
258
|
-
<category scheme="http://schemas.google.com/g/2005#kind"
|
259
|
-
term="http://schemas.google.com/meter/2008#durMeasurement"/>
|
260
|
-
<meter:subject>https://www.google.com/powermeter/feeds/path</meter:subject>
|
261
|
-
<meter:startTime meter:uncertainty="1.000000">2009-09-28T04:00:00.000Z</meter:startTime>
|
262
|
-
<meter:endTime meter:uncertainty="1.000000">2009-09-28T05:00:00.000Z</meter:endTime>
|
263
|
-
<meter:quantity meter:uncertainty="0.001000" meter:unit="kW h">
|
264
|
-
0.508
|
265
|
-
</meter:quantity>
|
266
|
-
</entry>
|
267
|
-
|
268
|
-
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
269
|
-
<id>https://www.google.com/powermeter/feeds/path/durMeasurement/2009-09-28T05_00_00.000Z</id>
|
270
|
-
<category scheme="http://schemas.google.com/g/2005#kind"
|
271
|
-
term="http://schemas.google.com/meter/2008#durMeasurement"/>
|
272
|
-
<meter:subject>https://www.google.com/powermeter/feeds/path</meter:subject>
|
273
|
-
<meter:startTime meter:uncertainty="1.000000">2009-09-28T05:00:00.000Z</meter:startTime>
|
274
|
-
<meter:endTime meter:uncertainty="1.000000">2009-09-28T06:00:00.000Z</meter:endTime>
|
275
|
-
<meter:quantity meter:uncertainty="0.001000" meter:unit="kW h">
|
276
|
-
0.58
|
277
|
-
</meter:quantity>
|
278
|
-
</entry>
|
279
|
-
|
280
|
-
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:meter="http://schemas.google.com/meter/2008">
|
281
|
-
<id>https://www.google.com/powermeter/feeds/path/durMeasurement/2009-09-28T06_00_00.000Z</id>
|
282
|
-
<category scheme="http://schemas.google.com/g/2005#kind"
|
283
|
-
term="http://schemas.google.com/meter/2008#durMeasurement"/>
|
284
|
-
<meter:subject>https://www.google.com/powermeter/feeds/path</meter:subject>
|
285
|
-
<meter:startTime meter:uncertainty="1.000000">2009-09-28T06:00:00.000Z</meter:startTime>
|
286
|
-
<meter:endTime meter:uncertainty="1.000000">2009-09-28T07:00:00.000Z</meter:endTime>
|
287
|
-
<meter:quantity meter:uncertainty="0.001000" meter:unit="kW h">
|
288
|
-
0.316
|
289
|
-
</meter:quantity>
|
290
|
-
</entry>
|
291
|
-
|
292
|
-
</feed>
|
@@ -1,106 +0,0 @@
|
|
1
|
-
---
|
2
|
-
- !ruby/struct:VCR::HTTPInteraction
|
3
|
-
request: !ruby/struct:VCR::Request
|
4
|
-
method: :get
|
5
|
-
uri: http://carbon.brighterplanet.com:80/electricity_uses.json?energy=1
|
6
|
-
body:
|
7
|
-
headers:
|
8
|
-
accept:
|
9
|
-
- "*/*; q=0.5, application/xml"
|
10
|
-
accept-encoding:
|
11
|
-
- gzip, deflate
|
12
|
-
response: !ruby/struct:VCR::Response
|
13
|
-
status: !ruby/struct:VCR::ResponseStatus
|
14
|
-
code: 200
|
15
|
-
message: OK
|
16
|
-
headers:
|
17
|
-
server:
|
18
|
-
- nginx/0.6.35
|
19
|
-
date:
|
20
|
-
- Sat, 19 Mar 2011 18:49:12 GMT
|
21
|
-
content-type:
|
22
|
-
- application/json; charset=utf-8
|
23
|
-
transfer-encoding:
|
24
|
-
- chunked
|
25
|
-
status:
|
26
|
-
- 200 OK
|
27
|
-
etag:
|
28
|
-
- "\"f8891da38901f85f0b33fdd539c84199\""
|
29
|
-
cache-control:
|
30
|
-
- max-age=0, private, must-revalidate
|
31
|
-
x-ua-compatible:
|
32
|
-
- IE=Edge,chrome=1
|
33
|
-
x-runtime:
|
34
|
-
- "0.174617"
|
35
|
-
body: "{\"timeframe\":\"2011-01-01/2012-01-01\",\"emission\":0.6460529833458619,\"emission_units\":\"kilograms\",\"errors\":[],\"reports\":[{\"committee\":{\"name\":\"emission\",\"quorums\":[{\"name\":\"from date, emission factor, loss factor and energy\",\"requirements\":[\"date\",\"emission_factor\",\"loss_factor\",\"energy\"],\"appreciates\":[],\"complies\":[]}]},\"conclusion\":0.6460529833458619,\"quorum\":{\"name\":\"from date, emission factor, loss factor and energy\",\"requirements\":[\"date\",\"emission_factor\",\"loss_factor\",\"energy\"],\"appreciates\":[],\"complies\":[]}},{\"committee\":{\"name\":\"emission_factor\",\"quorums\":[{\"name\":\"from eGRID subregion\",\"requirements\":[\"egrid_subregion\"],\"appreciates\":[],\"complies\":[]}]},\"conclusion\":0.606076,\"quorum\":{\"name\":\"from eGRID subregion\",\"requirements\":[\"egrid_subregion\"],\"appreciates\":[],\"complies\":[]}},{\"committee\":{\"name\":\"loss_factor\",\"quorums\":[{\"name\":\"from eGRID region\",\"requirements\":[\"egrid_region\"],\"appreciates\":[],\"complies\":[]}]},\"conclusion\":0.0618788,\"quorum\":{\"name\":\"from eGRID region\",\"requirements\":[\"egrid_region\"],\"appreciates\":[],\"complies\":[]}},{\"committee\":{\"name\":\"egrid_region\",\"quorums\":[{\"name\":\"from eGRID subregion\",\"requirements\":[\"egrid_subregion\"],\"appreciates\":[],\"complies\":[]}]},\"conclusion\":{\"egrid_region\":{\"loss_factor\":0.0618788,\"name\":\"US\"}},\"quorum\":{\"name\":\"from eGRID subregion\",\"requirements\":[\"egrid_subregion\"],\"appreciates\":[],\"complies\":[]}},{\"committee\":{\"name\":\"egrid_subregion\",\"quorums\":[{\"name\":\"from zip code\",\"requirements\":[\"zip_code\"],\"appreciates\":[],\"complies\":[]},{\"name\":\"default\",\"requirements\":[],\"appreciates\":[],\"complies\":[]}]},\"conclusion\":{\"egrid_subregion\":{\"abbreviation\":\"US\",\"egrid_region_name\":\"US\",\"electricity_ch4_emission_factor\":0.000309198,\"electricity_ch4_emission_factor_units\":\"kilograms_co2e_per_kilowatt_hour\",\"electricity_co2_biogenic_emission_factor\":0.0,\"electricity_co2_biogenic_emission_factor_units\":\"kilograms_per_kilowatt_hour\",\"electricity_co2_emission_factor\":0.602982,\"electricity_co2_emission_factor_units\":\"kilograms_per_kilowatt_hour\",\"electricity_emission_factor\":0.606076,\"electricity_emission_factor_units\":\"kilograms_co2e_per_kilowatt_hour\",\"electricity_n2o_emission_factor\":0.00278485,\"electricity_n2o_emission_factor_units\":\"kilograms_co2e_per_kilowatt_hour\",\"name\":\"United States\",\"nerc_abbreviation\":\"US\",\"net_generation\":4056440000.0,\"net_generation_units\":\"megawatt_hours\"}},\"quorum\":{\"name\":\"default\",\"requirements\":[],\"appreciates\":[],\"complies\":[]}},{\"committee\":{\"name\":\"date\",\"quorums\":[{\"name\":\"from timeframe\",\"requirements\":[],\"appreciates\":[],\"complies\":[]}]},\"conclusion\":\"2011-01-01\",\"quorum\":{\"name\":\"from timeframe\",\"requirements\":[],\"appreciates\":[],\"complies\":[]}}],\"methodology\":\"http://carbon.brighterplanet.com/electricity_uses.html?energy=1&timeframe=2011-01-01%2F2012-01-01\",\"execution_id\":\"cd84d18a392c2782e8b0a114dd65a225184823a4be28aea4896d2d6c01d18dae959051b2a26b06b6\",\"compliance\":[],\"scope\":null,\"energy\":1.0,\"date\":\"2011-01-01\",\"egrid_subregion\":{\"egrid_subregion\":{\"abbreviation\":\"US\",\"egrid_region_name\":\"US\",\"electricity_ch4_emission_factor\":0.000309198,\"electricity_ch4_emission_factor_units\":\"kilograms_co2e_per_kilowatt_hour\",\"electricity_co2_biogenic_emission_factor\":0.0,\"electricity_co2_biogenic_emission_factor_units\":\"kilograms_per_kilowatt_hour\",\"electricity_co2_emission_factor\":0.602982,\"electricity_co2_emission_factor_units\":\"kilograms_per_kilowatt_hour\",\"electricity_emission_factor\":0.606076,\"electricity_emission_factor_units\":\"kilograms_co2e_per_kilowatt_hour\",\"electricity_n2o_emission_factor\":0.00278485,\"electricity_n2o_emission_factor_units\":\"kilograms_co2e_per_kilowatt_hour\",\"name\":\"United States\",\"nerc_abbreviation\":\"US\",\"net_generation\":4056440000.0,\"net_generation_units\":\"megawatt_hours\"}},\"egrid_region\":{\"egrid_region\":{\"loss_factor\":0.0618788,\"name\":\"US\"}},\"loss_factor\":0.0618788,\"emission_factor\":0.606076}"
|
36
|
-
http_version: "1.1"
|
37
|
-
- !ruby/struct:VCR::HTTPInteraction
|
38
|
-
request: !ruby/struct:VCR::Request
|
39
|
-
method: :get
|
40
|
-
uri: http://carbon.brighterplanet.com:80/electricity_uses.json?energy=1&zip_code=94110
|
41
|
-
body:
|
42
|
-
headers:
|
43
|
-
accept:
|
44
|
-
- "*/*; q=0.5, application/xml"
|
45
|
-
accept-encoding:
|
46
|
-
- gzip, deflate
|
47
|
-
response: !ruby/struct:VCR::Response
|
48
|
-
status: !ruby/struct:VCR::ResponseStatus
|
49
|
-
code: 200
|
50
|
-
message: OK
|
51
|
-
headers:
|
52
|
-
server:
|
53
|
-
- nginx/0.6.35
|
54
|
-
date:
|
55
|
-
- Sat, 19 Mar 2011 19:15:01 GMT
|
56
|
-
content-type:
|
57
|
-
- application/json; charset=utf-8
|
58
|
-
transfer-encoding:
|
59
|
-
- chunked
|
60
|
-
status:
|
61
|
-
- 200 OK
|
62
|
-
etag:
|
63
|
-
- "\"91afe2c319e60d06dd3b10f60c90a15d\""
|
64
|
-
cache-control:
|
65
|
-
- max-age=0, private, must-revalidate
|
66
|
-
x-ua-compatible:
|
67
|
-
- IE=Edge,chrome=1
|
68
|
-
x-runtime:
|
69
|
-
- "0.041468"
|
70
|
-
body: "{\"timeframe\":\"2011-01-01/2012-01-01\",\"emission\":0.3484751557886446,\"emission_units\":\"kilograms\",\"errors\":[],\"reports\":[{\"committee\":{\"name\":\"emission\",\"quorums\":[{\"name\":\"from date, emission factor, loss factor and energy\",\"requirements\":[\"date\",\"emission_factor\",\"loss_factor\",\"energy\"],\"appreciates\":[],\"complies\":[]}]},\"conclusion\":0.3484751557886446,\"quorum\":{\"name\":\"from date, emission factor, loss factor and energy\",\"requirements\":[\"date\",\"emission_factor\",\"loss_factor\",\"energy\"],\"appreciates\":[],\"complies\":[]}},{\"committee\":{\"name\":\"emission_factor\",\"quorums\":[{\"name\":\"from eGRID subregion\",\"requirements\":[\"egrid_subregion\"],\"appreciates\":[],\"complies\":[]}]},\"conclusion\":0.32989,\"quorum\":{\"name\":\"from eGRID subregion\",\"requirements\":[\"egrid_subregion\"],\"appreciates\":[],\"complies\":[]}},{\"committee\":{\"name\":\"loss_factor\",\"quorums\":[{\"name\":\"from eGRID region\",\"requirements\":[\"egrid_region\"],\"appreciates\":[],\"complies\":[]}]},\"conclusion\":0.0533328,\"quorum\":{\"name\":\"from eGRID region\",\"requirements\":[\"egrid_region\"],\"appreciates\":[],\"complies\":[]}},{\"committee\":{\"name\":\"egrid_region\",\"quorums\":[{\"name\":\"from eGRID subregion\",\"requirements\":[\"egrid_subregion\"],\"appreciates\":[],\"complies\":[]}]},\"conclusion\":{\"egrid_region\":{\"loss_factor\":0.0533328,\"name\":\"W\"}},\"quorum\":{\"name\":\"from eGRID subregion\",\"requirements\":[\"egrid_subregion\"],\"appreciates\":[],\"complies\":[]}},{\"committee\":{\"name\":\"egrid_subregion\",\"quorums\":[{\"name\":\"from zip code\",\"requirements\":[\"zip_code\"],\"appreciates\":[],\"complies\":[]},{\"name\":\"default\",\"requirements\":[],\"appreciates\":[],\"complies\":[]}]},\"conclusion\":{\"egrid_subregion\":{\"abbreviation\":\"CAMX\",\"egrid_region_name\":\"W\",\"electricity_ch4_emission_factor\":0.000342876,\"electricity_ch4_emission_factor_units\":\"kilograms_co2e_per_kilowatt_hour\",\"electricity_co2_biogenic_emission_factor\":0.0,\"electricity_co2_biogenic_emission_factor_units\":\"kilograms_per_kilowatt_hour\",\"electricity_co2_emission_factor\":0.328455,\"electricity_co2_emission_factor_units\":\"kilograms_per_kilowatt_hour\",\"electricity_emission_factor\":0.32989,\"electricity_emission_factor_units\":\"kilograms_co2e_per_kilowatt_hour\",\"electricity_n2o_emission_factor\":0.00109161,\"electricity_n2o_emission_factor_units\":\"kilograms_co2e_per_kilowatt_hour\",\"name\":\"WECC California\",\"nerc_abbreviation\":\"WECC\",\"net_generation\":219612000.0,\"net_generation_units\":\"megawatt_hours\"}},\"quorum\":{\"name\":\"from zip code\",\"requirements\":[\"zip_code\"],\"appreciates\":[],\"complies\":[]}},{\"committee\":{\"name\":\"date\",\"quorums\":[{\"name\":\"from timeframe\",\"requirements\":[],\"appreciates\":[],\"complies\":[]}]},\"conclusion\":\"2011-01-01\",\"quorum\":{\"name\":\"from timeframe\",\"requirements\":[],\"appreciates\":[],\"complies\":[]}}],\"methodology\":\"http://carbon.brighterplanet.com/electricity_uses.html?energy=1&timeframe=2011-01-01%2F2012-01-01&zip_code=94110\",\"execution_id\":\"863c7b45fcba5ba36bb2389f518b51be1665166db5f6a3c8d7ce3a3950c38d7e07d551fad2e7f4e7\",\"compliance\":[],\"scope\":null,\"energy\":1.0,\"zip_code\":{\"zip_code\":{\"climate_division_name\":\"CA4\",\"description\":\"San Francisco\",\"egrid_subregion_abbreviation\":\"CAMX\",\"latitude\":\"37.74873\",\"longitude\":\"-122.41545\",\"name\":\"94110\",\"state_postal_abbreviation\":\"CA\"}},\"date\":\"2011-01-01\",\"egrid_subregion\":{\"egrid_subregion\":{\"abbreviation\":\"CAMX\",\"egrid_region_name\":\"W\",\"electricity_ch4_emission_factor\":0.000342876,\"electricity_ch4_emission_factor_units\":\"kilograms_co2e_per_kilowatt_hour\",\"electricity_co2_biogenic_emission_factor\":0.0,\"electricity_co2_biogenic_emission_factor_units\":\"kilograms_per_kilowatt_hour\",\"electricity_co2_emission_factor\":0.328455,\"electricity_co2_emission_factor_units\":\"kilograms_per_kilowatt_hour\",\"electricity_emission_factor\":0.32989,\"electricity_emission_factor_units\":\"kilograms_co2e_per_kilowatt_hour\",\"electricity_n2o_emission_factor\":0.00109161,\"electricity_n2o_emission_factor_units\":\"kilograms_co2e_per_kilowatt_hour\",\"name\":\"WECC California\",\"nerc_abbreviation\":\"WECC\",\"net_generation\":219612000.0,\"net_generation_units\":\"megawatt_hours\"}},\"egrid_region\":{\"egrid_region\":{\"loss_factor\":0.0533328,\"name\":\"W\"}},\"loss_factor\":0.0533328,\"emission_factor\":0.32989}"
|
71
|
-
http_version: "1.1"
|
72
|
-
- !ruby/struct:VCR::HTTPInteraction
|
73
|
-
request: !ruby/struct:VCR::Request
|
74
|
-
method: :get
|
75
|
-
uri: http://carbon.brighterplanet.com:80/electricity_uses.json?date=2011-03-29&energy=1
|
76
|
-
body:
|
77
|
-
headers:
|
78
|
-
accept:
|
79
|
-
- "*/*; q=0.5, application/xml"
|
80
|
-
accept-encoding:
|
81
|
-
- gzip, deflate
|
82
|
-
response: !ruby/struct:VCR::Response
|
83
|
-
status: !ruby/struct:VCR::ResponseStatus
|
84
|
-
code: 200
|
85
|
-
message: OK
|
86
|
-
headers:
|
87
|
-
server:
|
88
|
-
- nginx/0.6.35
|
89
|
-
date:
|
90
|
-
- Tue, 29 Mar 2011 15:36:35 GMT
|
91
|
-
content-type:
|
92
|
-
- application/json; charset=utf-8
|
93
|
-
transfer-encoding:
|
94
|
-
- chunked
|
95
|
-
status:
|
96
|
-
- 200 OK
|
97
|
-
etag:
|
98
|
-
- "\"642c6acc898b96f4017bc27c2f321ee4\""
|
99
|
-
cache-control:
|
100
|
-
- max-age=0, private, must-revalidate
|
101
|
-
x-ua-compatible:
|
102
|
-
- IE=Edge,chrome=1
|
103
|
-
x-runtime:
|
104
|
-
- "0.026969"
|
105
|
-
body: "{\"timeframe\":\"2011-01-01/2012-01-01\",\"emission\":0.6460529833458619,\"emission_units\":\"kilograms\",\"errors\":[],\"reports\":[{\"committee\":{\"name\":\"emission\",\"quorums\":[{\"name\":\"from date, emission factor, loss factor and energy\",\"requirements\":[\"date\",\"emission_factor\",\"loss_factor\",\"energy\"],\"appreciates\":[],\"complies\":[]}]},\"conclusion\":0.6460529833458619,\"quorum\":{\"name\":\"from date, emission factor, loss factor and energy\",\"requirements\":[\"date\",\"emission_factor\",\"loss_factor\",\"energy\"],\"appreciates\":[],\"complies\":[]}},{\"committee\":{\"name\":\"emission_factor\",\"quorums\":[{\"name\":\"from eGRID subregion\",\"requirements\":[\"egrid_subregion\"],\"appreciates\":[],\"complies\":[]}]},\"conclusion\":0.606076,\"quorum\":{\"name\":\"from eGRID subregion\",\"requirements\":[\"egrid_subregion\"],\"appreciates\":[],\"complies\":[]}},{\"committee\":{\"name\":\"loss_factor\",\"quorums\":[{\"name\":\"from eGRID region\",\"requirements\":[\"egrid_region\"],\"appreciates\":[],\"complies\":[]}]},\"conclusion\":0.0618788,\"quorum\":{\"name\":\"from eGRID region\",\"requirements\":[\"egrid_region\"],\"appreciates\":[],\"complies\":[]}},{\"committee\":{\"name\":\"egrid_region\",\"quorums\":[{\"name\":\"from eGRID subregion\",\"requirements\":[\"egrid_subregion\"],\"appreciates\":[],\"complies\":[]}]},\"conclusion\":{\"egrid_region\":{\"loss_factor\":0.0618788,\"name\":\"US\"}},\"quorum\":{\"name\":\"from eGRID subregion\",\"requirements\":[\"egrid_subregion\"],\"appreciates\":[],\"complies\":[]}},{\"committee\":{\"name\":\"egrid_subregion\",\"quorums\":[{\"name\":\"from zip code\",\"requirements\":[\"zip_code\"],\"appreciates\":[],\"complies\":[]},{\"name\":\"default\",\"requirements\":[],\"appreciates\":[],\"complies\":[]}]},\"conclusion\":{\"egrid_subregion\":{\"abbreviation\":\"US\",\"egrid_region_name\":\"US\",\"electricity_ch4_emission_factor\":0.000309198,\"electricity_ch4_emission_factor_units\":\"kilograms_co2e_per_kilowatt_hour\",\"electricity_co2_biogenic_emission_factor\":0.0,\"electricity_co2_biogenic_emission_factor_units\":\"kilograms_per_kilowatt_hour\",\"electricity_co2_emission_factor\":0.602982,\"electricity_co2_emission_factor_units\":\"kilograms_per_kilowatt_hour\",\"electricity_emission_factor\":0.606076,\"electricity_emission_factor_units\":\"kilograms_co2e_per_kilowatt_hour\",\"electricity_n2o_emission_factor\":0.00278485,\"electricity_n2o_emission_factor_units\":\"kilograms_co2e_per_kilowatt_hour\",\"name\":\"United States\",\"nerc_abbreviation\":\"US\",\"net_generation\":4056440000.0,\"net_generation_units\":\"megawatt_hours\"}},\"quorum\":{\"name\":\"default\",\"requirements\":[],\"appreciates\":[],\"complies\":[]}}],\"methodology\":\"http://carbon.brighterplanet.com/electricity_uses.html?date=2011-03-29&energy=1&timeframe=2011-01-01%2F2012-01-01\",\"execution_id\":\"dec9aeca7a2b8750494fdd452337a4b6d8ca3649a7aebafce76d3976f91b0943e4669cf580a7a225\",\"compliance\":[],\"scope\":null,\"date\":\"2011-03-29\",\"energy\":1.0,\"egrid_subregion\":{\"egrid_subregion\":{\"abbreviation\":\"US\",\"egrid_region_name\":\"US\",\"electricity_ch4_emission_factor\":0.000309198,\"electricity_ch4_emission_factor_units\":\"kilograms_co2e_per_kilowatt_hour\",\"electricity_co2_biogenic_emission_factor\":0.0,\"electricity_co2_biogenic_emission_factor_units\":\"kilograms_per_kilowatt_hour\",\"electricity_co2_emission_factor\":0.602982,\"electricity_co2_emission_factor_units\":\"kilograms_per_kilowatt_hour\",\"electricity_emission_factor\":0.606076,\"electricity_emission_factor_units\":\"kilograms_co2e_per_kilowatt_hour\",\"electricity_n2o_emission_factor\":0.00278485,\"electricity_n2o_emission_factor_units\":\"kilograms_co2e_per_kilowatt_hour\",\"name\":\"United States\",\"nerc_abbreviation\":\"US\",\"net_generation\":4056440000.0,\"net_generation_units\":\"megawatt_hours\"}},\"egrid_region\":{\"egrid_region\":{\"loss_factor\":0.0618788,\"name\":\"US\"}},\"loss_factor\":0.0618788,\"emission_factor\":0.606076}"
|
106
|
-
http_version: "1.1"
|
data/spec/sample_spec.rb
DELETED
data/spec/samples_spec.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe SmarterMeter::Samples do
|
4
|
-
before(:all) do
|
5
|
-
@data = File.read(File.join($FIXTURES_DIR, 'data.csv'))
|
6
|
-
@date_present = Date.new(2009, 9, 27)
|
7
|
-
end
|
8
|
-
|
9
|
-
subject { SmarterMeter::Samples.parse_csv(@data) }
|
10
|
-
|
11
|
-
it "can calculate the total number of kilowatt hours used" do
|
12
|
-
subject.total_kwh.should be_within(0.1).of(43.72)
|
13
|
-
end
|
14
|
-
|
15
|
-
it "can calculate the total number of kilowatt hours used on a specific day" do
|
16
|
-
subject.total_kwh_on(Date.new(2009, 9, 27)).should be_within(0.1).of(16.65)
|
17
|
-
end
|
18
|
-
|
19
|
-
it "can calculate the total number of kilowatt hours used on a day not given" do
|
20
|
-
subject.total_kwh_on(Date.new(2010, 9, 27)).should == 0
|
21
|
-
end
|
22
|
-
|
23
|
-
it "can access samples for a given day" do
|
24
|
-
subject.length.should == 7
|
25
|
-
subject.keys.should include(@date_present)
|
26
|
-
subject[@date_present].length.should == 24
|
27
|
-
subject[@date_present].each{|s| s.should be_kind_of(SmarterMeter::Sample)}
|
28
|
-
end
|
29
|
-
|
30
|
-
it "can handle an incomplete sample" do
|
31
|
-
subject[@date_present][0].kwh.should == nil
|
32
|
-
subject[@date_present][0].time.should == Time.local(2009, 9, 27, 0)
|
33
|
-
end
|
34
|
-
|
35
|
-
it "can handle a complete sample" do
|
36
|
-
subject[@date_present][1].kwh.should == 0.205
|
37
|
-
subject[@date_present][1].time.should == Time.local(2009, 9, 27, 1)
|
38
|
-
end
|
39
|
-
end
|
data/spec/service_spec.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__), "..")
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe SmarterMeter::Services::BrighterPlanet do
|
5
|
-
it "can determine kilograms of carbon produced from the number of killowatt hours" do
|
6
|
-
VCR.use_cassette('brighterplanet', :record => :new_episodes) do
|
7
|
-
subject.calculate_kg_carbon(1).should be_within(0.1).of(0.64)
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
it "can query for electricity from a specific zipcode" do
|
12
|
-
VCR.use_cassette('brighterplanet', :record => :new_episodes) do
|
13
|
-
subject.calculate_kg_carbon(1, :zip_code => "94110").should be_within(0.1).of(0.34)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
it "can query for electricity on a specific date" do
|
18
|
-
VCR.use_cassette('brighterplanet', :record => :new_episodes) do
|
19
|
-
subject.calculate_kg_carbon(1, :date => "2011-03-29").should be_within(0.1).of(0.64)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
it "doesn't allow electricity queries to include keys other than those specified" do
|
24
|
-
expect { subject.calculate_kg_carbon(1, :energy => 2) }.to raise_error(ArgumentError)
|
25
|
-
end
|
26
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__), "..")
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe SmarterMeter::Services::GooglePowerMeter do
|
5
|
-
before(:each) do
|
6
|
-
@subject = SmarterMeter::Services::GooglePowerMeter.new(:token => "secret",
|
7
|
-
:variable => "/path")
|
8
|
-
data = File.read(File.join($FIXTURES_DIR, 'data.csv'))
|
9
|
-
@results = SmarterMeter::Samples.parse_csv(data)
|
10
|
-
end
|
11
|
-
|
12
|
-
it "can format a request for the API" do
|
13
|
-
fixture_file = File.join(File.dirname(__FILE__), "..", "fixtures", "expected_google_request.xml")
|
14
|
-
expected_result = File.read(fixture_file)
|
15
|
-
|
16
|
-
samples = @results.values.first
|
17
|
-
@subject.request_body(samples).should == expected_result
|
18
|
-
end
|
19
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler/setup'
|
3
|
-
Bundler.require(:default)
|
4
|
-
require 'rspec'
|
5
|
-
require 'vcr'
|
6
|
-
|
7
|
-
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
8
|
-
require 'smartermeter'
|
9
|
-
|
10
|
-
$FIXTURES_DIR = File.expand_path(File.join(File.dirname(__FILE__), "fixtures"))
|
11
|
-
|
12
|
-
VCR.config do |c|
|
13
|
-
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
|
14
|
-
c.stub_with :webmock
|
15
|
-
end
|