green-button-data 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/green-button-data/fetchable.rb +21 -1
- data/lib/green-button-data/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MjY1ZGViODMxZWUwODVmMjM5YTA2MDRiNTA0ZGVkNTQ0MThlZWM0Ng==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OWM5YWU0ZjU4NThjN2E0NjdlNGFhM2M1ZWRkYTgyZjllM2MxZGEyYQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjBjOWM2YTYzODJlNDgxZjE1OWZlOGNlNTcwY2Y5YTg2ZDI3Y2UzZGEzMWQw
|
10
|
+
ZGU1OTAzMzU5M2MwOWJkODcxZDU4MjhkNTRmMmQzY2Y3YjdkNmM0YzVjMTIy
|
11
|
+
YjgwMWU3N2I5OWJlMWMzMWI1Y2JjYWQ0OTQ3Y2JiN2Q4ZjViYjE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
N2NlMWZkNzVjZjBlNDQ4YmFhNzA0ZjhlNzcwZDEyOGJmNGUyNjY0OTcxMTk4
|
14
|
+
YmMyMzg4YzQ3NDcyZmY4MzhhYWM0MWQ5OTA0ZjUzMjU2YTg3ZDM0OTk0YzY2
|
15
|
+
NTg0NTAyZjE1ZTY4NzUyMzAwYWUyNWQ5YzFhNTUyYjFlODc0Y2E=
|
@@ -160,7 +160,27 @@ module GreenButtonData
|
|
160
160
|
entry_content = nil
|
161
161
|
|
162
162
|
feed.entries.each do |entry|
|
163
|
-
|
163
|
+
# Matches resource name in URL (e.g. ApplicationInformation)
|
164
|
+
resource = '([a-zA-Z]+)'
|
165
|
+
|
166
|
+
# Matches Base 64 encoded resource ID used by PG&E for MeterReading
|
167
|
+
# resource identifier
|
168
|
+
base64_id = '\w+=*'
|
169
|
+
|
170
|
+
# Matches numeric ID with thousands separator in commas used for
|
171
|
+
# UsageSummary IDs for PG&E endpoints but also matches traditional
|
172
|
+
# digits without comma separator
|
173
|
+
num_id = '(\d+,*\d*)+'
|
174
|
+
|
175
|
+
# Matches GUID as the resource ID used mainly by PG&E for
|
176
|
+
# ApplicationInformation resource identifier
|
177
|
+
guid = '[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}' +
|
178
|
+
'-[0-9A-Fa-f]{12}'
|
179
|
+
|
180
|
+
# Identifier can be any of the above patterns
|
181
|
+
identifier = "(#{base64_id}|#{num_id}|#{guid})"
|
182
|
+
|
183
|
+
match_data = /\/(#{resource}|#{resource}\/#{identifier})\/*\z/.
|
164
184
|
match(entry.self)
|
165
185
|
|
166
186
|
unless match_data.nil?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: green-button-data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Jo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|