green-button-data 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MGI3MGE4OTJjMTE1NjMzMWUwY2QyODA5NTNmZjFlZDgxNmI4YjZiYg==
4
+ MDZiY2U4YTc5MWZjMGQ0YmEzNTEzMTk5MmQwZDA5YzlmZWI3Mjk4MA==
5
5
  data.tar.gz: !binary |-
6
- MTdiZmJhMDZlYTNlZGMzYWQyMGU5NTM2MWUzYmYyYTJhNDExOGU4Ng==
6
+ M2VmZWZkOGI2MzU5NTgxZTMwYjVkNzZiYzM4ZjEyYjE0YjY3NzliYQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NTY3NDczMDNjNzRiNGEyZWY1MjYwMDNiYjk0OGFlYTQ5ODJjYTYyMTAwZDg3
10
- ZjYwYWUwYTlkMTcxNzE0NzYyNzg4YjBlOTBkYjYyZDYzODEzN2JlMDVjYTAz
11
- NDNmY2FhYzU0ZGEwMzY1ZmRlODU4NjhmM2Y4NWY3MzI4MjY4Y2I=
9
+ MjZlN2JlYTI1YTk2NzliNmY1Mzg2ZGRiZDM1ZjFhN2VlMzdhODA0ODJhMmJm
10
+ MzY4MGY1MjdlMzRjYzIxMWNjNDliY2EyOWFkODY0MDU3MTA1MThhYzAzOTNi
11
+ ZTY3ZDg2ZGJlYmUxNWY1OWM3OTEwY2NmOTc0ZTg4NGZiMTE3OTA=
12
12
  data.tar.gz: !binary |-
13
- MDM3NmM0NmNhNGIwZTc4MDRiNDQyZTYzZmVhYjUzOWM2NjdiODJjM2RhMWRi
14
- MTAzNmRiMTljMzc2YzRmNjU2MzM4N2ZhMDUxOTg5Y2NhMmI2ODBiMjNjZGIx
15
- YTQ1YWY3YmI5MzkxNWEyM2I1ZTY3YjJiNDI4ZDQwN2JkN2JmNzk=
13
+ MjgzZjk3MGQzNWNlZWZkMGViZDBhMmFhNDQzZGVkN2E2MWVhYzU4M2U3NzNi
14
+ MzE3Njc1NGRlOTFiMzE4YWNjOTU3YzAyMjdkMjAzMzU1Yzg3M2JkYjRjYTc1
15
+ NmYwYmI2NWNiZjdmOTUxNmFhNjg0ZTc3NDRkNWZkMWRlYTY1MmE=
@@ -160,7 +160,27 @@ module GreenButtonData
160
160
  entry_content = nil
161
161
 
162
162
  feed.entries.each do |entry|
163
- match_data = /\/(([a-zA-Z]+)|([a-zA-Z]+)\/(\w+=*|(\d+,*\d*)+))\/*\z/.
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?
@@ -1,3 +1,3 @@
1
1
  module GreenButtonData
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
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.3.1
4
+ version: 0.3.2
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-04 00:00:00.000000000 Z
11
+ date: 2015-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri