green-button-data 0.1.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.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/.rspec +2 -0
  4. data/Gemfile +11 -0
  5. data/Guardfile +50 -0
  6. data/LICENSE.txt +26 -0
  7. data/README.md +72 -0
  8. data/Rakefile +5 -0
  9. data/green-button-data.gemspec +24 -0
  10. data/lib/green-button-data/core_ext/date.rb +9 -0
  11. data/lib/green-button-data/core_ext/fixnum.rb +10 -0
  12. data/lib/green-button-data/core_ext.rb +2 -0
  13. data/lib/green-button-data/dst.rb +49 -0
  14. data/lib/green-button-data/enumerations.rb +523 -0
  15. data/lib/green-button-data/feed.rb +7 -0
  16. data/lib/green-button-data/parser/application_information.rb +180 -0
  17. data/lib/green-button-data/parser/authorization.rb +45 -0
  18. data/lib/green-button-data/parser/content.rb +36 -0
  19. data/lib/green-button-data/parser/entry.rb +47 -0
  20. data/lib/green-button-data/parser/feed.rb +47 -0
  21. data/lib/green-button-data/parser/interval.rb +32 -0
  22. data/lib/green-button-data/parser/interval_block.rb +32 -0
  23. data/lib/green-button-data/parser/interval_reading.rb +30 -0
  24. data/lib/green-button-data/parser/local_time_parameters.rb +105 -0
  25. data/lib/green-button-data/parser/rational_number.rb +22 -0
  26. data/lib/green-button-data/parser/reading_type.rb +134 -0
  27. data/lib/green-button-data/parser/service_category.rb +17 -0
  28. data/lib/green-button-data/parser/usage_point.rb +20 -0
  29. data/lib/green-button-data/parser.rb +2 -0
  30. data/lib/green-button-data/utilities.rb +106 -0
  31. data/lib/green-button-data/version.rb +3 -0
  32. data/lib/green-button-data.rb +24 -0
  33. data/spec/fixtures/ESPIApplicationInformation.xml +49 -0
  34. data/spec/fixtures/ESPIAuthorization.xml +25 -0
  35. data/spec/fixtures/ESPIIntervalBlock.xml +3814 -0
  36. data/spec/fixtures/ESPILocalTimeParameters.xml +16 -0
  37. data/spec/fixtures/ESPIReadingType.xml +535 -0
  38. data/spec/fixtures/ESPIUsagePoint.xml +18 -0
  39. data/spec/fixtures.rb +22 -0
  40. data/spec/green-button-data/core_ext/date_spec.rb +18 -0
  41. data/spec/green-button-data/core_ext/fixnum_spec.rb +13 -0
  42. data/spec/green-button-data/parser/application_information_spec.rb +154 -0
  43. data/spec/green-button-data/parser/authorization_spec.rb +52 -0
  44. data/spec/green-button-data/parser/interval_block_spec.rb +39 -0
  45. data/spec/green-button-data/parser/local_time_parameter_spec.rb +56 -0
  46. data/spec/green-button-data/parser/reading_type_spec.rb +76 -0
  47. data/spec/green-button-data/parser/usage_point_spec.rb +22 -0
  48. data/spec/green-button-data/utilities_spec.rb +63 -0
  49. data/spec/spec_helper.rb +20 -0
  50. data/spec/support/custom_expectations/warn_expectation.rb +31 -0
  51. metadata +148 -0
@@ -0,0 +1,16 @@
1
+ <entry xmlns:espi="http://naesb.org/espi" xmlns="http://www.w3.org/2005/Atom">
2
+ <id>urn:uuid:e30ce77d-ec22-4da5-83c2-991ba34c97d6</id>
3
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/LocalTimeParameters" rel="up"/>
4
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/LocalTimeParameters/1" rel="self"/>
5
+ <title>DST For North America</title>
6
+ <content>
7
+ <espi:LocalTimeParameters>
8
+ <espi:dstEndRule>B40E2000</espi:dstEndRule>
9
+ <espi:dstOffset>3600</espi:dstOffset>
10
+ <espi:dstStartRule>360E2000</espi:dstStartRule>
11
+ <espi:tzOffset>-18000</espi:tzOffset>
12
+ </espi:LocalTimeParameters>
13
+ </content>
14
+ <published>2013-09-19T04:00:00Z</published>
15
+ <updated>2013-09-19T04:00:00Z</updated>
16
+ </entry>
@@ -0,0 +1,535 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <?xml-stylesheet type="text/xsl" href="GreenButtonDataStyleSheet.xslt"?>
3
+ <feed xmlns="http://www.w3.org/2005/Atom" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4
+ <id>urn:uuid:37ef9651-afd6-4e80-94a2-b4451f6aba65</id>
5
+ <title>Green Button Usage Feed</title>
6
+ <updated>2015-07-31T23:43:24Z</updated>
7
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType" rel="self"/>
8
+ <entry xmlns:espi="http://naesb.org/espi" xmlns="http://www.w3.org/2005/Atom">
9
+ <id>urn:uuid:0f64c8da-d125-45b6-a9c0-ae56cc5b8938</id>
10
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType" rel="up"/>
11
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType/11" rel="self"/>
12
+ <title>Energy Delivered (Wh)</title>
13
+ <content>
14
+ <espi:ReadingType>
15
+ <espi:accumulationBehaviour>4</espi:accumulationBehaviour>
16
+ <espi:commodity>1</espi:commodity>
17
+ <espi:currency>840</espi:currency>
18
+ <espi:dataQualifier>12</espi:dataQualifier>
19
+ <espi:flowDirection>1</espi:flowDirection>
20
+ <espi:intervalLength>300</espi:intervalLength>
21
+ <espi:kind>12</espi:kind>
22
+ <espi:phase>769</espi:phase>
23
+ <espi:powerOfTenMultiplier>0</espi:powerOfTenMultiplier>
24
+ <espi:timeAttribute>0</espi:timeAttribute>
25
+ <espi:uom>72</espi:uom>
26
+ </espi:ReadingType>
27
+ </content>
28
+ <published>2013-04-04T03:35:38Z</published>
29
+ <updated>2013-04-04T03:35:38Z</updated>
30
+ </entry>
31
+
32
+ <entry xmlns:espi="http://naesb.org/espi" xmlns="http://www.w3.org/2005/Atom">
33
+ <id>urn:uuid:13fb2ac6-0d67-4c72-85e0-89e15db46b1d</id>
34
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType" rel="up"/>
35
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType/3" rel="self"/>
36
+ <title>Type of Meter Reading Data</title>
37
+ <content>
38
+ <espi:ReadingType>
39
+ <espi:accumulationBehaviour>4</espi:accumulationBehaviour>
40
+ <espi:commodity>1</espi:commodity>
41
+ <espi:currency>840</espi:currency>
42
+ <espi:dataQualifier>12</espi:dataQualifier>
43
+ <espi:flowDirection>1</espi:flowDirection>
44
+ <espi:intervalLength>3600</espi:intervalLength>
45
+ <espi:kind>12</espi:kind>
46
+ <espi:phase>769</espi:phase>
47
+ <espi:powerOfTenMultiplier>0</espi:powerOfTenMultiplier>
48
+ <espi:timeAttribute>0</espi:timeAttribute>
49
+ <espi:uom>72</espi:uom>
50
+ </espi:ReadingType>
51
+ </content>
52
+ <published>2012-10-24T07:00:00Z</published>
53
+ <updated>2012-10-24T07:00:00Z</updated>
54
+ </entry>
55
+
56
+ <entry xmlns:espi="http://naesb.org/espi" xmlns="http://www.w3.org/2005/Atom">
57
+ <id>urn:uuid:17c58ea4-b833-4804-8b5a-8237848e70ef</id>
58
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType" rel="up"/>
59
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType/14" rel="self"/>
60
+ <title>Type of Meter Reading Data</title>
61
+ <content>
62
+ <espi:ReadingType>
63
+ <espi:accumulationBehaviour>12</espi:accumulationBehaviour>
64
+ <espi:commodity>1</espi:commodity>
65
+ <espi:currency>840</espi:currency>
66
+ <espi:dataQualifier>12</espi:dataQualifier>
67
+ <espi:flowDirection>1</espi:flowDirection>
68
+ <espi:intervalLength>900</espi:intervalLength>
69
+ <espi:kind>4</espi:kind>
70
+ <espi:phase>128</espi:phase>
71
+ <espi:powerOfTenMultiplier>0</espi:powerOfTenMultiplier>
72
+ <espi:timeAttribute>53</espi:timeAttribute>
73
+ <espi:uom>5</espi:uom>
74
+ </espi:ReadingType>
75
+ </content>
76
+ <published>2012-10-24T07:00:00Z</published>
77
+ <updated>2012-10-24T07:00:00Z</updated>
78
+ </entry>
79
+
80
+ <entry xmlns:espi="http://naesb.org/espi" xmlns="http://www.w3.org/2005/Atom">
81
+ <id>urn:uuid:24c66449-1231-4d0d-ae4e-e82007d66332</id>
82
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType" rel="up"/>
83
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType/17" rel="self"/>
84
+ <title>Type of Meter Reading Data</title>
85
+ <content>
86
+ <espi:ReadingType>
87
+ <espi:accumulationBehaviour>12</espi:accumulationBehaviour>
88
+ <espi:commodity>1</espi:commodity>
89
+ <espi:currency>840</espi:currency>
90
+ <espi:dataQualifier>12</espi:dataQualifier>
91
+ <espi:flowDirection>1</espi:flowDirection>
92
+ <espi:intervalLength>900</espi:intervalLength>
93
+ <espi:kind>37</espi:kind>
94
+ <espi:phase>229</espi:phase>
95
+ <espi:powerOfTenMultiplier>0</espi:powerOfTenMultiplier>
96
+ <espi:timeAttribute>53</espi:timeAttribute>
97
+ <espi:uom>38</espi:uom>
98
+ </espi:ReadingType>
99
+ </content>
100
+ <published>2012-10-24T07:00:00Z</published>
101
+ <updated>2012-10-24T07:00:00Z</updated>
102
+ </entry>
103
+
104
+ <entry xmlns:espi="http://naesb.org/espi" xmlns="http://www.w3.org/2005/Atom">
105
+ <id>urn:uuid:2557def0-8321-11e0-9d78-0800200c9a20</id>
106
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType" rel="up"/>
107
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType/22" rel="self"/>
108
+ <title>Energy Delivered (kWh)</title>
109
+ <content>
110
+ <espi:ReadingType>
111
+ <espi:accumulationBehaviour>4</espi:accumulationBehaviour>
112
+ <espi:commodity>1</espi:commodity>
113
+ <espi:dataQualifier>12</espi:dataQualifier>
114
+ <espi:defaultQuality>0</espi:defaultQuality>
115
+ <espi:flowDirection>1</espi:flowDirection>
116
+ <espi:intervalLength>900</espi:intervalLength>
117
+ <espi:kind>12</espi:kind>
118
+ <espi:phase>769</espi:phase>
119
+ <espi:powerOfTenMultiplier>0</espi:powerOfTenMultiplier>
120
+ <espi:timeAttribute>0</espi:timeAttribute>
121
+ <espi:uom>72</espi:uom>
122
+ </espi:ReadingType>
123
+ </content>
124
+ <published>2002-11-02T13:00:00Z</published>
125
+ <updated>2002-11-02T13:00:00Z</updated>
126
+ </entry>
127
+
128
+ <entry xmlns:espi="http://naesb.org/espi" xmlns="http://www.w3.org/2005/Atom">
129
+ <id>urn:uuid:2ccb84b0-d94a-4e9c-9ed7-b79d5cbb8eb4</id>
130
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType" rel="up"/>
131
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType/5" rel="self"/>
132
+ <title>Type of Meter Reading Data</title>
133
+ <content>
134
+ <espi:ReadingType>
135
+ <espi:accumulationBehaviour>4</espi:accumulationBehaviour>
136
+ <espi:commodity>1</espi:commodity>
137
+ <espi:currency>840</espi:currency>
138
+ <espi:dataQualifier>12</espi:dataQualifier>
139
+ <espi:flowDirection>1</espi:flowDirection>
140
+ <espi:intervalLength>3600</espi:intervalLength>
141
+ <espi:kind>12</espi:kind>
142
+ <espi:phase>769</espi:phase>
143
+ <espi:powerOfTenMultiplier>0</espi:powerOfTenMultiplier>
144
+ <espi:timeAttribute>0</espi:timeAttribute>
145
+ <espi:uom>72</espi:uom>
146
+ </espi:ReadingType>
147
+ </content>
148
+ <published>2012-10-24T07:00:00Z</published>
149
+ <updated>2012-10-24T07:00:00Z</updated>
150
+ </entry>
151
+
152
+ <entry xmlns:espi="http://naesb.org/espi" xmlns="http://www.w3.org/2005/Atom">
153
+ <id>urn:uuid:2f36559c-0e4b-4f70-bdfb-efcac5c8b52b</id>
154
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType" rel="up"/>
155
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType/20" rel="self"/>
156
+ <title>Type of Meter Reading Data</title>
157
+ <content>
158
+ <espi:ReadingType>
159
+ <espi:accumulationBehaviour>12</espi:accumulationBehaviour>
160
+ <espi:commodity>1</espi:commodity>
161
+ <espi:currency>840</espi:currency>
162
+ <espi:dataQualifier>12</espi:dataQualifier>
163
+ <espi:flowDirection>1</espi:flowDirection>
164
+ <espi:intervalLength>900</espi:intervalLength>
165
+ <espi:kind>54</espi:kind>
166
+ <espi:phase>65</espi:phase>
167
+ <espi:powerOfTenMultiplier>0</espi:powerOfTenMultiplier>
168
+ <espi:timeAttribute>53</espi:timeAttribute>
169
+ <espi:uom>29</espi:uom>
170
+ </espi:ReadingType>
171
+ </content>
172
+ <published>2012-10-24T07:00:00Z</published>
173
+ <updated>2012-10-24T07:00:00Z</updated>
174
+ </entry>
175
+
176
+ <entry xmlns:espi="http://naesb.org/espi" xmlns="http://www.w3.org/2005/Atom">
177
+ <id>urn:uuid:5568f5a2-62cf-4190-aff3-131fe661fb27</id>
178
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType" rel="up"/>
179
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType/13" rel="self"/>
180
+ <title>Type of Meter Reading Data</title>
181
+ <content>
182
+ <espi:ReadingType>
183
+ <espi:accumulationBehaviour>4</espi:accumulationBehaviour>
184
+ <espi:commodity>1</espi:commodity>
185
+ <espi:currency>840</espi:currency>
186
+ <espi:dataQualifier>12</espi:dataQualifier>
187
+ <espi:flowDirection>1</espi:flowDirection>
188
+ <espi:intervalLength>900</espi:intervalLength>
189
+ <espi:kind>12</espi:kind>
190
+ <espi:phase>229</espi:phase>
191
+ <espi:powerOfTenMultiplier>3</espi:powerOfTenMultiplier>
192
+ <espi:timeAttribute>53</espi:timeAttribute>
193
+ <espi:uom>72</espi:uom>
194
+ </espi:ReadingType>
195
+ </content>
196
+ <published>2012-10-24T07:00:00Z</published>
197
+ <updated>2012-10-24T07:00:00Z</updated>
198
+ </entry>
199
+
200
+ <entry xmlns:espi="http://naesb.org/espi" xmlns="http://www.w3.org/2005/Atom">
201
+ <id>urn:uuid:6b2cc266-4437-4e3b-909f-c79d494efc6b</id>
202
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType" rel="up"/>
203
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType/10" rel="self"/>
204
+ <title>Type of Meter Reading Data</title>
205
+ <content>
206
+ <espi:ReadingType>
207
+ <espi:accumulationBehaviour>4</espi:accumulationBehaviour>
208
+ <espi:commodity>1</espi:commodity>
209
+ <espi:currency>840</espi:currency>
210
+ <espi:dataQualifier>12</espi:dataQualifier>
211
+ <espi:flowDirection>1</espi:flowDirection>
212
+ <espi:intervalLength>3600</espi:intervalLength>
213
+ <espi:kind>12</espi:kind>
214
+ <espi:phase>769</espi:phase>
215
+ <espi:powerOfTenMultiplier>0</espi:powerOfTenMultiplier>
216
+ <espi:timeAttribute>0</espi:timeAttribute>
217
+ <espi:uom>72</espi:uom>
218
+ </espi:ReadingType>
219
+ </content>
220
+ <published>2012-10-24T07:00:00Z</published>
221
+ <updated>2012-10-24T07:00:00Z</updated>
222
+ </entry>
223
+
224
+ <entry xmlns:espi="http://naesb.org/espi" xmlns="http://www.w3.org/2005/Atom">
225
+ <id>urn:uuid:752d8f78-8ee8-4b15-a7f0-3a20bbfd1a00</id>
226
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType" rel="up"/>
227
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType/9" rel="self"/>
228
+ <title>Type of Meter Reading Data</title>
229
+ <content>
230
+ <espi:ReadingType>
231
+ <espi:accumulationBehaviour>4</espi:accumulationBehaviour>
232
+ <espi:commodity>1</espi:commodity>
233
+ <espi:currency>840</espi:currency>
234
+ <espi:dataQualifier>12</espi:dataQualifier>
235
+ <espi:flowDirection>1</espi:flowDirection>
236
+ <espi:intervalLength>3600</espi:intervalLength>
237
+ <espi:kind>12</espi:kind>
238
+ <espi:phase>769</espi:phase>
239
+ <espi:powerOfTenMultiplier>0</espi:powerOfTenMultiplier>
240
+ <espi:timeAttribute>0</espi:timeAttribute>
241
+ <espi:uom>72</espi:uom>
242
+ </espi:ReadingType>
243
+ </content>
244
+ <published>2012-10-24T07:00:00Z</published>
245
+ <updated>2012-10-24T07:00:00Z</updated>
246
+ </entry>
247
+
248
+ <entry xmlns:espi="http://naesb.org/espi" xmlns="http://www.w3.org/2005/Atom">
249
+ <id>urn:uuid:8b423daf-311a-4e1c-a60c-8dc7f1f0bd13</id>
250
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType" rel="up"/>
251
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType/4" rel="self"/>
252
+ <title>Type of Meter Reading Data</title>
253
+ <content>
254
+ <espi:ReadingType>
255
+ <espi:accumulationBehaviour>4</espi:accumulationBehaviour>
256
+ <espi:commodity>1</espi:commodity>
257
+ <espi:currency>840</espi:currency>
258
+ <espi:dataQualifier>12</espi:dataQualifier>
259
+ <espi:flowDirection>1</espi:flowDirection>
260
+ <espi:intervalLength>3600</espi:intervalLength>
261
+ <espi:kind>12</espi:kind>
262
+ <espi:phase>769</espi:phase>
263
+ <espi:powerOfTenMultiplier>0</espi:powerOfTenMultiplier>
264
+ <espi:timeAttribute>0</espi:timeAttribute>
265
+ <espi:uom>72</espi:uom>
266
+ </espi:ReadingType>
267
+ </content>
268
+ <published>2012-10-24T07:00:00Z</published>
269
+ <updated>2012-10-24T07:00:00Z</updated>
270
+ </entry>
271
+
272
+ <entry xmlns:espi="http://naesb.org/espi" xmlns="http://www.w3.org/2005/Atom">
273
+ <id>urn:uuid:99b292fc-55f7-4f27-a3b9-cddab97cca90</id>
274
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType" rel="up"/>
275
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType/1" rel="self"/>
276
+ <title>Type of Meter Reading Data</title>
277
+ <content>
278
+ <espi:ReadingType>
279
+ <espi:accumulationBehaviour>4</espi:accumulationBehaviour>
280
+ <espi:commodity>1</espi:commodity>
281
+ <espi:currency>840</espi:currency>
282
+ <espi:dataQualifier>12</espi:dataQualifier>
283
+ <espi:flowDirection>1</espi:flowDirection>
284
+ <espi:intervalLength>86400</espi:intervalLength>
285
+ <espi:kind>12</espi:kind>
286
+ <espi:phase>769</espi:phase>
287
+ <espi:powerOfTenMultiplier>0</espi:powerOfTenMultiplier>
288
+ <espi:timeAttribute>0</espi:timeAttribute>
289
+ <espi:uom>72</espi:uom>
290
+ </espi:ReadingType>
291
+ </content>
292
+ <published>2013-09-19T04:00:00Z</published>
293
+ <updated>2013-09-19T04:00:00Z</updated>
294
+ </entry>
295
+
296
+ <entry xmlns:espi="http://naesb.org/espi" xmlns="http://www.w3.org/2005/Atom">
297
+ <id>urn:uuid:a73882c2-816c-49ff-afd7-cad73d56de24</id>
298
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType" rel="up"/>
299
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType/6" rel="self"/>
300
+ <title>Type of Meter Reading Data</title>
301
+ <content>
302
+ <espi:ReadingType>
303
+ <espi:accumulationBehaviour>4</espi:accumulationBehaviour>
304
+ <espi:commodity>1</espi:commodity>
305
+ <espi:currency>840</espi:currency>
306
+ <espi:dataQualifier>12</espi:dataQualifier>
307
+ <espi:flowDirection>1</espi:flowDirection>
308
+ <espi:intervalLength>3600</espi:intervalLength>
309
+ <espi:kind>12</espi:kind>
310
+ <espi:phase>769</espi:phase>
311
+ <espi:powerOfTenMultiplier>0</espi:powerOfTenMultiplier>
312
+ <espi:timeAttribute>0</espi:timeAttribute>
313
+ <espi:uom>72</espi:uom>
314
+ </espi:ReadingType>
315
+ </content>
316
+ <published>2012-10-24T07:00:00Z</published>
317
+ <updated>2012-10-24T07:00:00Z</updated>
318
+ </entry>
319
+
320
+ <entry xmlns:espi="http://naesb.org/espi" xmlns="http://www.w3.org/2005/Atom">
321
+ <id>urn:uuid:b76154ef-7880-4177-a2d3-4482675edfe7</id>
322
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType" rel="up"/>
323
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType/12" rel="self"/>
324
+ <title>Energy Delivered (Wh)</title>
325
+ <content>
326
+ <espi:ReadingType>
327
+ <espi:accumulationBehaviour>4</espi:accumulationBehaviour>
328
+ <espi:commodity>1</espi:commodity>
329
+ <espi:currency>840</espi:currency>
330
+ <espi:dataQualifier>12</espi:dataQualifier>
331
+ <espi:flowDirection>1</espi:flowDirection>
332
+ <espi:intervalLength>300</espi:intervalLength>
333
+ <espi:kind>12</espi:kind>
334
+ <espi:phase>769</espi:phase>
335
+ <espi:powerOfTenMultiplier>0</espi:powerOfTenMultiplier>
336
+ <espi:timeAttribute>0</espi:timeAttribute>
337
+ <espi:uom>72</espi:uom>
338
+ </espi:ReadingType>
339
+ </content>
340
+ <published>2013-04-04T03:35:38Z</published>
341
+ <updated>2013-04-04T03:35:38Z</updated>
342
+ </entry>
343
+
344
+ <entry xmlns:espi="http://naesb.org/espi" xmlns="http://www.w3.org/2005/Atom">
345
+ <id>urn:uuid:ba9bcb55-48db-4430-ac4d-fdd22305c437</id>
346
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType" rel="up"/>
347
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType/18" rel="self"/>
348
+ <title>Type of Meter Reading Data</title>
349
+ <content>
350
+ <espi:ReadingType>
351
+ <espi:accumulationBehaviour>12</espi:accumulationBehaviour>
352
+ <espi:commodity>1</espi:commodity>
353
+ <espi:currency>840</espi:currency>
354
+ <espi:dataQualifier>12</espi:dataQualifier>
355
+ <espi:flowDirection>1</espi:flowDirection>
356
+ <espi:intervalLength>900</espi:intervalLength>
357
+ <espi:kind>38</espi:kind>
358
+ <espi:phase>229</espi:phase>
359
+ <espi:powerOfTenMultiplier>0</espi:powerOfTenMultiplier>
360
+ <espi:timeAttribute>53</espi:timeAttribute>
361
+ <espi:uom>65</espi:uom>
362
+ </espi:ReadingType>
363
+ </content>
364
+ <published>2012-10-24T07:00:00Z</published>
365
+ <updated>2012-10-24T07:00:00Z</updated>
366
+ </entry>
367
+
368
+ <entry xmlns:espi="http://naesb.org/espi" xmlns="http://www.w3.org/2005/Atom">
369
+ <id>urn:uuid:c0e9c7a7-4942-4eb3-bba5-d31ce921812e</id>
370
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType" rel="up"/>
371
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType/2" rel="self"/>
372
+ <title>Type of Meter Reading Data</title>
373
+ <content>
374
+ <espi:ReadingType>
375
+ <espi:accumulationBehaviour>4</espi:accumulationBehaviour>
376
+ <espi:commodity>1</espi:commodity>
377
+ <espi:currency>840</espi:currency>
378
+ <espi:dataQualifier>12</espi:dataQualifier>
379
+ <espi:flowDirection>1</espi:flowDirection>
380
+ <espi:intervalLength>3600</espi:intervalLength>
381
+ <espi:kind>12</espi:kind>
382
+ <espi:phase>769</espi:phase>
383
+ <espi:powerOfTenMultiplier>0</espi:powerOfTenMultiplier>
384
+ <espi:timeAttribute>0</espi:timeAttribute>
385
+ <espi:uom>72</espi:uom>
386
+ </espi:ReadingType>
387
+ </content>
388
+ <published>2013-09-19T04:00:00Z</published>
389
+ <updated>2013-09-19T04:00:00Z</updated>
390
+ </entry>
391
+
392
+ <entry xmlns:espi="http://naesb.org/espi" xmlns="http://www.w3.org/2005/Atom">
393
+ <id>urn:uuid:c24fa771-c579-4c3a-981b-3018d7f00586</id>
394
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType" rel="up"/>
395
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType/15" rel="self"/>
396
+ <title>Type of Meter Reading Data</title>
397
+ <content>
398
+ <espi:ReadingType>
399
+ <espi:accumulationBehaviour>12</espi:accumulationBehaviour>
400
+ <espi:commodity>1</espi:commodity>
401
+ <espi:currency>840</espi:currency>
402
+ <espi:dataQualifier>12</espi:dataQualifier>
403
+ <espi:flowDirection>1</espi:flowDirection>
404
+ <espi:intervalLength>900</espi:intervalLength>
405
+ <espi:kind>4</espi:kind>
406
+ <espi:phase>64</espi:phase>
407
+ <espi:powerOfTenMultiplier>0</espi:powerOfTenMultiplier>
408
+ <espi:timeAttribute>53</espi:timeAttribute>
409
+ <espi:uom>5</espi:uom>
410
+ </espi:ReadingType>
411
+ </content>
412
+ <published>2012-10-24T07:00:00Z</published>
413
+ <updated>2012-10-24T07:00:00Z</updated>
414
+ </entry>
415
+
416
+ <entry xmlns:espi="http://naesb.org/espi" xmlns="http://www.w3.org/2005/Atom">
417
+ <id>urn:uuid:ca52f200-ac39-4adb-a722-bf9ff4bc4f5a</id>
418
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType" rel="up"/>
419
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType/8" rel="self"/>
420
+ <title>Type of Meter Reading Data</title>
421
+ <content>
422
+ <espi:ReadingType>
423
+ <espi:accumulationBehaviour>4</espi:accumulationBehaviour>
424
+ <espi:commodity>1</espi:commodity>
425
+ <espi:currency>840</espi:currency>
426
+ <espi:dataQualifier>12</espi:dataQualifier>
427
+ <espi:flowDirection>1</espi:flowDirection>
428
+ <espi:intervalLength>3600</espi:intervalLength>
429
+ <espi:kind>12</espi:kind>
430
+ <espi:phase>769</espi:phase>
431
+ <espi:powerOfTenMultiplier>0</espi:powerOfTenMultiplier>
432
+ <espi:timeAttribute>0</espi:timeAttribute>
433
+ <espi:uom>72</espi:uom>
434
+ </espi:ReadingType>
435
+ </content>
436
+ <published>2012-10-24T07:00:00Z</published>
437
+ <updated>2012-10-24T07:00:00Z</updated>
438
+ </entry>
439
+
440
+ <entry xmlns:espi="http://naesb.org/espi" xmlns="http://www.w3.org/2005/Atom">
441
+ <id>urn:uuid:cafa2ccf-38d8-4f79-85fe-e3394be1f3ee</id>
442
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType" rel="up"/>
443
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType/21" rel="self"/>
444
+ <title>Type of Meter Reading Data</title>
445
+ <content>
446
+ <espi:ReadingType>
447
+ <espi:accumulationBehaviour>12</espi:accumulationBehaviour>
448
+ <espi:commodity>1</espi:commodity>
449
+ <espi:currency>840</espi:currency>
450
+ <espi:dataQualifier>12</espi:dataQualifier>
451
+ <espi:flowDirection>1</espi:flowDirection>
452
+ <espi:intervalLength>900</espi:intervalLength>
453
+ <espi:kind>54</espi:kind>
454
+ <espi:phase>33</espi:phase>
455
+ <espi:powerOfTenMultiplier>0</espi:powerOfTenMultiplier>
456
+ <espi:timeAttribute>53</espi:timeAttribute>
457
+ <espi:uom>29</espi:uom>
458
+ </espi:ReadingType>
459
+ </content>
460
+ <published>2012-10-24T07:00:00Z</published>
461
+ <updated>2012-10-24T07:00:00Z</updated>
462
+ </entry>
463
+
464
+ <entry xmlns:espi="http://naesb.org/espi" xmlns="http://www.w3.org/2005/Atom">
465
+ <id>urn:uuid:d9b4323d-35fa-4ff3-befc-11371ddefa27</id>
466
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType" rel="up"/>
467
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType/19" rel="self"/>
468
+ <title>Type of Meter Reading Data</title>
469
+ <content>
470
+ <espi:ReadingType>
471
+ <espi:accumulationBehaviour>12</espi:accumulationBehaviour>
472
+ <espi:commodity>1</espi:commodity>
473
+ <espi:currency>840</espi:currency>
474
+ <espi:dataQualifier>12</espi:dataQualifier>
475
+ <espi:flowDirection>1</espi:flowDirection>
476
+ <espi:intervalLength>900</espi:intervalLength>
477
+ <espi:kind>54</espi:kind>
478
+ <espi:phase>129</espi:phase>
479
+ <espi:powerOfTenMultiplier>0</espi:powerOfTenMultiplier>
480
+ <espi:timeAttribute>53</espi:timeAttribute>
481
+ <espi:uom>29</espi:uom>
482
+ </espi:ReadingType>
483
+ </content>
484
+ <published>2012-10-24T07:00:00Z</published>
485
+ <updated>2012-10-24T07:00:00Z</updated>
486
+ </entry>
487
+
488
+ <entry xmlns:espi="http://naesb.org/espi" xmlns="http://www.w3.org/2005/Atom">
489
+ <id>urn:uuid:e461cea2-d729-467c-8e24-edaaa76441ac</id>
490
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType" rel="up"/>
491
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType/7" rel="self"/>
492
+ <title>Type of Meter Reading Data</title>
493
+ <content>
494
+ <espi:ReadingType>
495
+ <espi:accumulationBehaviour>4</espi:accumulationBehaviour>
496
+ <espi:commodity>1</espi:commodity>
497
+ <espi:currency>840</espi:currency>
498
+ <espi:dataQualifier>12</espi:dataQualifier>
499
+ <espi:flowDirection>1</espi:flowDirection>
500
+ <espi:intervalLength>3600</espi:intervalLength>
501
+ <espi:kind>12</espi:kind>
502
+ <espi:phase>769</espi:phase>
503
+ <espi:powerOfTenMultiplier>0</espi:powerOfTenMultiplier>
504
+ <espi:timeAttribute>0</espi:timeAttribute>
505
+ <espi:uom>72</espi:uom>
506
+ </espi:ReadingType>
507
+ </content>
508
+ <published>2012-10-24T07:00:00Z</published>
509
+ <updated>2012-10-24T07:00:00Z</updated>
510
+ </entry>
511
+
512
+ <entry xmlns:espi="http://naesb.org/espi" xmlns="http://www.w3.org/2005/Atom">
513
+ <id>urn:uuid:f1149a79-2f3a-4a6f-959e-d45a3d1960ad</id>
514
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType" rel="up"/>
515
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/ReadingType/16" rel="self"/>
516
+ <title>Type of Meter Reading Data</title>
517
+ <content>
518
+ <espi:ReadingType>
519
+ <espi:accumulationBehaviour>12</espi:accumulationBehaviour>
520
+ <espi:commodity>1</espi:commodity>
521
+ <espi:currency>840</espi:currency>
522
+ <espi:dataQualifier>12</espi:dataQualifier>
523
+ <espi:flowDirection>1</espi:flowDirection>
524
+ <espi:intervalLength>900</espi:intervalLength>
525
+ <espi:kind>4</espi:kind>
526
+ <espi:phase>32</espi:phase>
527
+ <espi:powerOfTenMultiplier>0</espi:powerOfTenMultiplier>
528
+ <espi:timeAttribute>53</espi:timeAttribute>
529
+ <espi:uom>5</espi:uom>
530
+ </espi:ReadingType>
531
+ </content>
532
+ <published>2012-10-24T07:00:00Z</published>
533
+ <updated>2012-10-24T07:00:00Z</updated>
534
+ </entry>
535
+ </feed>
@@ -0,0 +1,18 @@
1
+ <entry xmlns:espi="http://naesb.org/espi" xmlns="http://www.w3.org/2005/Atom">
2
+ <id>urn:uuid:c8c34b3a-d175-447b-bd00-176f60194de0</id>
3
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/Subscription/5/UsagePoint" rel="up"/>
4
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/Subscription/5/UsagePoint/1" rel="self"/>
5
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/Subscription/5/UsagePoint/1/MeterReading" rel="related"/>
6
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/Subscription/5/UsagePoint/1/ElectricPowerUsageSummary" rel="related"/>
7
+ <link href="https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/LocalTimeParameters/1" rel="related"/>
8
+ <title>Green Button Sample Data File</title>
9
+ <content>
10
+ <espi:UsagePoint>
11
+ <espi:ServiceCategory>
12
+ <espi:kind>0</espi:kind>
13
+ </espi:ServiceCategory>
14
+ </espi:UsagePoint>
15
+ </content>
16
+ <published>2013-09-19T04:00:00Z</published>
17
+ <updated>2013-09-19T04:00:00Z</updated>
18
+ </entry>
data/spec/fixtures.rb ADDED
@@ -0,0 +1,22 @@
1
+ module Fixtures
2
+ FIXTURES = {
3
+ espi_application_information: "ESPIApplicationInformation.xml",
4
+ espi_authorization: "ESPIAuthorization.xml",
5
+ espi_interval_block: "ESPIIntervalBlock.xml",
6
+ espi_local_time_parameters: "ESPILocalTimeParameters.xml",
7
+ espi_reading_type: "ESPIReadingType.xml",
8
+ espi_usage_point: "ESPIUsagePoint.xml"
9
+ }
10
+
11
+ ##
12
+ # Dynamically load fixtures and define them as methods
13
+ FIXTURES.each do |method, filename|
14
+ define_method(method) { load_fixture filename }
15
+ end
16
+
17
+ ##
18
+ # Reads in the XML fixture file
19
+ def load_fixture(filename)
20
+ File.read "#{File.dirname __FILE__}/fixtures/#{filename}"
21
+ end
22
+ end
@@ -0,0 +1,18 @@
1
+ require "spec_helper"
2
+
3
+ describe Date do
4
+ let(:local_date) { DateTime.new 2015, 10, 21, 16, 21, 21, '-7:00' }
5
+ let(:utc_date) { DateTime.new 2015, 10, 21, 23, 21, 21 }
6
+
7
+ describe "#utc" do
8
+ it "should convert to UTC" do
9
+ expect(local_date.utc).to eq DateTime.new 2015, 10, 21, 23, 21, 21
10
+ end
11
+ end
12
+
13
+ describe "#local" do
14
+ it "should convert to local time" do
15
+ expect(utc_date.local).to eq DateTime.new 2015, 10, 21, 16, 21, 21, '-7:00'
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,13 @@
1
+ require "spec_helper"
2
+
3
+ describe Fixnum do
4
+ describe "#digits" do
5
+ it "should return number of digits for a fixed number" do
6
+ expect(1234.digits).to eq 4
7
+ end
8
+
9
+ it "should return 1 for 0" do
10
+ expect(0.digits).to eq 1
11
+ end
12
+ end
13
+ end