green-button-data 1.0.3 → 2.0.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/.circleci/config.yml +23 -36
- data/Gemfile +3 -1
- data/Gemfile.lock +83 -59
- data/green-button-data.gemspec +2 -2
- data/lib/green-button-data/application_information.rb +3 -3
- data/lib/green-button-data/core_extensions/{fixnum.rb → integer.rb} +2 -2
- data/lib/green-button-data/core_extensions.rb +1 -1
- data/lib/green-button-data/fetchable.rb +10 -4
- data/lib/green-button-data/parser/content.rb +27 -2
- data/lib/green-button-data/parser/cost_additional_detail_last_period.rb +1 -1
- data/lib/green-button-data/parser/customer.rb +9 -0
- data/lib/green-button-data/parser/customer_account.rb +12 -0
- data/lib/green-button-data/parser/customer_agreement.rb +3 -0
- data/lib/green-button-data/parser/doc_status.rb +9 -0
- data/lib/green-button-data/parser/main_address.rb +12 -3
- data/lib/green-button-data/parser/meter.rb +15 -0
- data/lib/green-button-data/parser/service_location.rb +3 -0
- data/lib/green-button-data/parser/street_detail.rb +6 -0
- data/lib/green-button-data/parser/town_detail.rb +4 -0
- data/lib/green-button-data/parser.rb +4 -0
- data/lib/green-button-data/relations.rb +8 -0
- data/lib/green-button-data/retail_customer.rb +16 -8
- data/lib/green-button-data/version.rb +1 -1
- metadata +11 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d207288b949cde07e389e2b6edea024b90fef2b4d225f813f16477ae886b60a1
|
4
|
+
data.tar.gz: bb1b61976e41ba69ce39df05730dccf61a23494bbefb15e4d5b4a33d140b656e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6852fb2f50359d24000cb891a3df3af5399b4cb061c9a2c24287d060dd86dae1594645be7d8767f0d71f4497b478495c996f2b9ec9ee575f0d3ffaf31f8ab48
|
7
|
+
data.tar.gz: 1d1b06c3fa7781f62cc18d089454830a003511819570d987ede9f14929a76a9f671afc8942da3aa19af6058d6978c168135b63b4b54f9666a6265c39b8a2fb3b
|
data/.circleci/config.yml
CHANGED
@@ -1,40 +1,22 @@
|
|
1
|
-
version: 2
|
1
|
+
version: 2.1
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
- checkout
|
7
|
-
- restore_cache:
|
8
|
-
keys:
|
9
|
-
- v1-gem-cache-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
|
10
|
-
- v1-gem-cache-{{ arch }}-{{ .Branch }}
|
11
|
-
- v1-gem-cache-{{ arch }}
|
12
|
-
- run:
|
13
|
-
name: Install dependencies
|
14
|
-
command: bundle install
|
15
|
-
- save_cache:
|
16
|
-
paths:
|
17
|
-
- ~/.bundle
|
18
|
-
key: v1-gem-cache-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
|
19
|
-
- run:
|
20
|
-
name: Run tests
|
21
|
-
command: rspec
|
3
|
+
orbs:
|
4
|
+
ruby: circleci/ruby@1.7.1
|
5
|
+
codecov: codecov/codecov@3.2.2
|
22
6
|
|
23
7
|
jobs:
|
24
|
-
test
|
8
|
+
test:
|
9
|
+
parameters:
|
10
|
+
ruby-version:
|
11
|
+
type: string
|
25
12
|
docker:
|
26
|
-
- image:
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
-
|
32
|
-
|
33
|
-
|
34
|
-
test-ruby-2.6:
|
35
|
-
docker:
|
36
|
-
- image: circleci/ruby:2.6
|
37
|
-
<<: *test-steps
|
13
|
+
- image: cimg/ruby:<< parameters.ruby-version >>
|
14
|
+
working_directory: ~/green-button-data
|
15
|
+
steps:
|
16
|
+
- checkout
|
17
|
+
- ruby/install-deps
|
18
|
+
- ruby/rspec-test
|
19
|
+
- codecov/upload
|
38
20
|
|
39
21
|
build:
|
40
22
|
docker:
|
@@ -71,9 +53,14 @@ workflows:
|
|
71
53
|
version: 2
|
72
54
|
tests:
|
73
55
|
jobs:
|
74
|
-
- test
|
75
|
-
|
76
|
-
|
56
|
+
- test:
|
57
|
+
matrix:
|
58
|
+
parameters:
|
59
|
+
ruby-version:
|
60
|
+
- "2.6"
|
61
|
+
- "2.7"
|
62
|
+
- "3.0"
|
63
|
+
- "3.1"
|
77
64
|
release:
|
78
65
|
jobs:
|
79
66
|
- build:
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,36 +1,53 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
green-button-data (1.0.
|
5
|
-
faraday (~> 0
|
4
|
+
green-button-data (1.0.3)
|
5
|
+
faraday (~> 1.0)
|
6
6
|
nokogiri (~> 1.8)
|
7
7
|
sax-machine (~> 1.3)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
addressable (2.
|
13
|
-
public_suffix (>= 2.0.2, <
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
12
|
+
addressable (2.8.0)
|
13
|
+
public_suffix (>= 2.0.2, < 5.0)
|
14
|
+
coderay (1.1.3)
|
15
|
+
crack (0.4.5)
|
16
|
+
rexml
|
17
|
+
diff-lcs (1.5.0)
|
18
|
+
docile (1.4.0)
|
19
|
+
faraday (1.10.0)
|
20
|
+
faraday-em_http (~> 1.0)
|
21
|
+
faraday-em_synchrony (~> 1.0)
|
22
|
+
faraday-excon (~> 1.1)
|
23
|
+
faraday-httpclient (~> 1.0)
|
24
|
+
faraday-multipart (~> 1.0)
|
25
|
+
faraday-net_http (~> 1.0)
|
26
|
+
faraday-net_http_persistent (~> 1.0)
|
27
|
+
faraday-patron (~> 1.0)
|
28
|
+
faraday-rack (~> 1.0)
|
29
|
+
faraday-retry (~> 1.0)
|
30
|
+
ruby2_keywords (>= 0.0.4)
|
31
|
+
faraday-em_http (1.0.0)
|
32
|
+
faraday-em_synchrony (1.0.0)
|
33
|
+
faraday-excon (1.1.0)
|
34
|
+
faraday-httpclient (1.0.1)
|
35
|
+
faraday-multipart (1.0.3)
|
24
36
|
multipart-post (>= 1.2, < 3)
|
25
|
-
|
26
|
-
|
27
|
-
|
37
|
+
faraday-net_http (1.0.1)
|
38
|
+
faraday-net_http_persistent (1.2.0)
|
39
|
+
faraday-patron (1.0.0)
|
40
|
+
faraday-rack (1.0.0)
|
41
|
+
faraday-retry (1.0.3)
|
42
|
+
ffi (1.15.5)
|
43
|
+
formatador (1.1.0)
|
44
|
+
guard (2.18.0)
|
28
45
|
formatador (>= 0.2.4)
|
29
46
|
listen (>= 2.7, < 4.0)
|
30
47
|
lumberjack (>= 1.0.12, < 2.0)
|
31
48
|
nenv (~> 0.1)
|
32
49
|
notiffany (~> 0.0)
|
33
|
-
pry (>= 0.
|
50
|
+
pry (>= 0.13.0)
|
34
51
|
shellany (~> 0.0)
|
35
52
|
thor (>= 0.18.1)
|
36
53
|
guard-compat (1.2.1)
|
@@ -38,54 +55,59 @@ GEM
|
|
38
55
|
guard (~> 2.1)
|
39
56
|
guard-compat (~> 1.1)
|
40
57
|
rspec (>= 2.99.0, < 4.0)
|
41
|
-
hashdiff (0.
|
42
|
-
|
43
|
-
|
44
|
-
rb-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
method_source (0.9.2)
|
49
|
-
mini_portile2 (2.4.0)
|
58
|
+
hashdiff (1.0.1)
|
59
|
+
listen (3.7.1)
|
60
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
61
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
62
|
+
lumberjack (1.2.8)
|
63
|
+
method_source (1.0.0)
|
64
|
+
mini_portile2 (2.8.0)
|
50
65
|
multipart-post (2.1.1)
|
51
66
|
nenv (0.3.0)
|
52
|
-
nokogiri (1.
|
53
|
-
mini_portile2 (~> 2.
|
54
|
-
|
67
|
+
nokogiri (1.13.4)
|
68
|
+
mini_portile2 (~> 2.8.0)
|
69
|
+
racc (~> 1.4)
|
70
|
+
notiffany (0.1.3)
|
55
71
|
nenv (~> 0.1)
|
56
72
|
shellany (~> 0.0)
|
57
|
-
pry (0.
|
58
|
-
coderay (~> 1.1
|
59
|
-
method_source (~>
|
60
|
-
public_suffix (
|
61
|
-
|
62
|
-
rb-
|
73
|
+
pry (0.14.1)
|
74
|
+
coderay (~> 1.1)
|
75
|
+
method_source (~> 1.0)
|
76
|
+
public_suffix (4.0.6)
|
77
|
+
racc (1.6.0)
|
78
|
+
rb-fsevent (0.11.1)
|
79
|
+
rb-inotify (0.10.1)
|
63
80
|
ffi (~> 1.0)
|
64
|
-
|
65
|
-
|
66
|
-
rspec-
|
67
|
-
rspec-
|
68
|
-
|
69
|
-
|
70
|
-
|
81
|
+
rexml (3.2.5)
|
82
|
+
rspec (3.11.0)
|
83
|
+
rspec-core (~> 3.11.0)
|
84
|
+
rspec-expectations (~> 3.11.0)
|
85
|
+
rspec-mocks (~> 3.11.0)
|
86
|
+
rspec-core (3.11.0)
|
87
|
+
rspec-support (~> 3.11.0)
|
88
|
+
rspec-expectations (3.11.0)
|
71
89
|
diff-lcs (>= 1.2.0, < 2.0)
|
72
|
-
rspec-support (~> 3.
|
73
|
-
rspec-mocks (3.
|
90
|
+
rspec-support (~> 3.11.0)
|
91
|
+
rspec-mocks (3.11.1)
|
74
92
|
diff-lcs (>= 1.2.0, < 2.0)
|
75
|
-
rspec-support (~> 3.
|
76
|
-
rspec-support (3.
|
77
|
-
|
78
|
-
|
93
|
+
rspec-support (~> 3.11.0)
|
94
|
+
rspec-support (3.11.0)
|
95
|
+
rspec_junit_formatter (0.5.1)
|
96
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
97
|
+
ruby2_keywords (0.0.5)
|
79
98
|
sax-machine (1.3.2)
|
80
99
|
shellany (0.0.1)
|
81
|
-
simplecov (0.
|
100
|
+
simplecov (0.21.2)
|
82
101
|
docile (~> 1.1)
|
83
|
-
|
84
|
-
|
85
|
-
simplecov-
|
86
|
-
|
87
|
-
|
88
|
-
|
102
|
+
simplecov-html (~> 0.11)
|
103
|
+
simplecov_json_formatter (~> 0.1)
|
104
|
+
simplecov-cobertura (2.1.0)
|
105
|
+
rexml
|
106
|
+
simplecov (~> 0.19)
|
107
|
+
simplecov-html (0.12.3)
|
108
|
+
simplecov_json_formatter (0.1.4)
|
109
|
+
thor (1.2.1)
|
110
|
+
webmock (2.3.2)
|
89
111
|
addressable (>= 2.3.6)
|
90
112
|
crack (>= 0.3.2)
|
91
113
|
hashdiff
|
@@ -94,12 +116,14 @@ PLATFORMS
|
|
94
116
|
ruby
|
95
117
|
|
96
118
|
DEPENDENCIES
|
97
|
-
codecov
|
98
119
|
green-button-data!
|
99
120
|
guard (~> 2.13)
|
100
121
|
guard-rspec
|
101
122
|
rspec (~> 3.0)
|
102
|
-
|
123
|
+
rspec_junit_formatter
|
124
|
+
simplecov
|
125
|
+
simplecov-cobertura
|
126
|
+
webmock (~> 2.3)
|
103
127
|
|
104
128
|
BUNDLED WITH
|
105
|
-
|
129
|
+
2.3.11
|
data/green-button-data.gemspec
CHANGED
@@ -26,9 +26,9 @@ Gem::Specification.new do |s|
|
|
26
26
|
|
27
27
|
s.add_dependency 'nokogiri', '~> 1.8'
|
28
28
|
s.add_dependency 'sax-machine', '~> 1.3'
|
29
|
-
s.add_dependency 'faraday', '~> 0
|
29
|
+
s.add_dependency 'faraday', '~> 1.0'
|
30
30
|
|
31
31
|
s.add_development_dependency 'rspec', '~> 3.0'
|
32
|
-
s.add_development_dependency 'webmock', '~>
|
32
|
+
s.add_development_dependency 'webmock', '~> 2.3'
|
33
33
|
s.add_development_dependency 'guard', '~>2.13'
|
34
34
|
end
|
@@ -36,12 +36,12 @@ module GreenButtonData
|
|
36
36
|
|
37
37
|
def client_secret_expires_at(kwargs = {})
|
38
38
|
if @client_secret_expires_at == 0
|
39
|
-
# Maximum
|
40
|
-
|
39
|
+
# Maximum Integer = 4611686018427387903
|
40
|
+
max_integer = 2 ** (@client_secret_expires_at.size * 8 - 2) - 1
|
41
41
|
|
42
42
|
# Roughly 146 billion years into the future; Sun would be long dead by
|
43
43
|
# this time; so for all intents and purposes, never expires
|
44
|
-
time = Time.at(
|
44
|
+
time = Time.at(max_integer)
|
45
45
|
|
46
46
|
if kwargs[:local] == true
|
47
47
|
return time.localtime
|
@@ -173,14 +173,17 @@ module GreenButtonData
|
|
173
173
|
[
|
174
174
|
'applicationinformation',
|
175
175
|
'authorization',
|
176
|
+
'customer',
|
177
|
+
'customeraccount',
|
178
|
+
'customeragreement',
|
176
179
|
'electricpowerusagesummary',
|
177
180
|
'intervalblock',
|
178
181
|
'localtimeparameters',
|
182
|
+
'meter',
|
179
183
|
'readingtype',
|
180
|
-
'usagepoint',
|
181
|
-
'usagesummary',
|
182
184
|
'servicelocation',
|
183
|
-
'
|
185
|
+
'usagepoint',
|
186
|
+
'usagesummary'
|
184
187
|
]
|
185
188
|
end
|
186
189
|
|
@@ -190,8 +193,11 @@ module GreenButtonData
|
|
190
193
|
|
191
194
|
def type_match_class?(type)
|
192
195
|
class_name_mapping = {
|
196
|
+
'Customer' => 'RetailCustomer',
|
193
197
|
'ServiceLocation' => 'RetailCustomer',
|
198
|
+
'CustomerAccount' => 'RetailCustomer',
|
194
199
|
'CustomerAgreement' => 'RetailCustomer',
|
200
|
+
'Meter' => 'RetailCustomer',
|
195
201
|
'ElectricPowerUsageSummary' => 'UsageSummary'
|
196
202
|
}
|
197
203
|
type == class_name || (class_name_mapping.has_key?(type) && class_name_mapping[type] == class_name)
|
@@ -228,7 +234,7 @@ module GreenButtonData
|
|
228
234
|
attributes_hash = attributes_to_hash(content)
|
229
235
|
attributes_hash[:id] = id
|
230
236
|
attributes_hash[:usage_point_id] = usage_point_id
|
231
|
-
|
237
|
+
attributes_hash[:links] = construct_links_hash entry
|
232
238
|
attributes_hash[:related_urls] = construct_related_urls entry
|
233
239
|
models << self.new(attributes_hash)
|
234
240
|
end
|
@@ -21,6 +21,18 @@ module GreenButtonData
|
|
21
21
|
as: :service_location
|
22
22
|
element :CustomerAgreement, class: CustomerAgreement,
|
23
23
|
as: :customer_agreement
|
24
|
+
element :Customer,
|
25
|
+
class: Customer,
|
26
|
+
as: :customer
|
27
|
+
element :CustomerAccount,
|
28
|
+
class: CustomerAccount,
|
29
|
+
as: :customer_account
|
30
|
+
element :Meter,
|
31
|
+
class: Meter,
|
32
|
+
as: :meter
|
33
|
+
element :MeterReading,
|
34
|
+
class: Meter,
|
35
|
+
as: :meter_reading
|
24
36
|
|
25
37
|
# ESPI Namespacing
|
26
38
|
element :'espi:ApplicationInformation', class: ApplicationInformation,
|
@@ -41,6 +53,9 @@ module GreenButtonData
|
|
41
53
|
as: :service_location
|
42
54
|
element :'espi:CustomerAgreement', class: CustomerAgreement,
|
43
55
|
as: :customer_agreement
|
56
|
+
element :'espi:MeterReading',
|
57
|
+
class: Meter,
|
58
|
+
as: :meter_reading
|
44
59
|
|
45
60
|
# Special case for PG&E generic namespaces
|
46
61
|
element :'ns0:ApplicationInformation', class: ApplicationInformation,
|
@@ -58,8 +73,18 @@ module GreenButtonData
|
|
58
73
|
as: :customer_agreement
|
59
74
|
|
60
75
|
# Special case for SCE namespacing
|
61
|
-
element :'cust:CustomerAgreement',
|
62
|
-
|
76
|
+
element :'cust:CustomerAgreement',
|
77
|
+
class: CustomerAgreement,
|
78
|
+
as: :customer_agreement
|
79
|
+
element :'cust:CustomerAccount',
|
80
|
+
class: CustomerAccount,
|
81
|
+
as: :customer_account
|
82
|
+
element :'cust:ServiceLocation',
|
83
|
+
class: ServiceLocation,
|
84
|
+
as: :service_location
|
85
|
+
element :'cust:Meter',
|
86
|
+
class: Meter,
|
87
|
+
as: :meter
|
63
88
|
end
|
64
89
|
end
|
65
90
|
end
|
@@ -4,6 +4,9 @@ module GreenButtonData
|
|
4
4
|
include SAXMachine
|
5
5
|
|
6
6
|
element :name, as: :customer_agreement_id
|
7
|
+
element :type
|
8
|
+
element :docStatus, class: DocStatus, as: :doc_status
|
9
|
+
element :signDate, class: Integer, as: :sign_date
|
7
10
|
|
8
11
|
# ESPI Namespacing
|
9
12
|
element :'espi:name', as: :customer_agreement_id
|
@@ -16,11 +16,15 @@ module GreenButtonData
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def zipcode
|
19
|
-
town_detail.code.gsub(/\s+/, "")
|
19
|
+
return town_detail.code.gsub(/\s+/, "") if town_detail.code
|
20
|
+
|
21
|
+
postal_code
|
20
22
|
end
|
21
23
|
|
22
24
|
def address_general
|
23
|
-
street_detail.address_general
|
25
|
+
return street_detail.address_general if street_detail.address_general
|
26
|
+
|
27
|
+
street_detail.number + ' ' + street_detail.name
|
24
28
|
end
|
25
29
|
|
26
30
|
def to_s
|
@@ -29,7 +33,7 @@ module GreenButtonData
|
|
29
33
|
|
30
34
|
element :townDetail, class: TownDetail, as: :town_detail
|
31
35
|
element :streetDetail, class: StreetDetail, as: :street_detail
|
32
|
-
|
36
|
+
element :postalCode, as: :postal_code
|
33
37
|
|
34
38
|
# ESPI Namespacing
|
35
39
|
element :'espi:townDetail', class: TownDetail, as: :town_detail
|
@@ -38,6 +42,11 @@ module GreenButtonData
|
|
38
42
|
# Special case for PG&E generic namespacing
|
39
43
|
element :'ns0:townDetail', class: TownDetail, as: :town_detail
|
40
44
|
element :'ns0:streetDetail', class: StreetDetail, as: :street_detail
|
45
|
+
|
46
|
+
# Special case for SCE namespacing
|
47
|
+
element :'cust:townDetail', class: TownDetail, as: :town_detail
|
48
|
+
element :'cust:streetDetail', class: StreetDetail, as: :street_detail
|
49
|
+
element :'cust:postalCode', as: :postal_code
|
41
50
|
end
|
42
51
|
end
|
43
52
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module GreenButtonData
|
2
|
+
module Parser
|
3
|
+
class Meter
|
4
|
+
include SAXMachine
|
5
|
+
|
6
|
+
element :type, as: :meter_type
|
7
|
+
element :serialNumber, as: :meter_serial_number
|
8
|
+
element :intervalLength, class: Integer, as: :meter_interval_length
|
9
|
+
|
10
|
+
# Special case for SCE namespacing
|
11
|
+
element :'cust:serialNumber', as: :meter_serial_number
|
12
|
+
element :'cust:type', as: :meter_type
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -10,6 +10,9 @@ module GreenButtonData
|
|
10
10
|
|
11
11
|
# Special case for PG&E generic namespacing
|
12
12
|
element :'ns0:mainAddress', class: MainAddress, as: :main_address
|
13
|
+
|
14
|
+
# Special case for SCE namespacing
|
15
|
+
element :'cust:mainAddress', class: MainAddress, as: :main_address
|
13
16
|
end
|
14
17
|
end
|
15
18
|
end
|
@@ -4,12 +4,18 @@ module GreenButtonData
|
|
4
4
|
include SAXMachine
|
5
5
|
|
6
6
|
element :addressGeneral, as: :address_general
|
7
|
+
element :name, as: :name
|
8
|
+
element :number, as: :number
|
7
9
|
|
8
10
|
# ESPI Namespacing
|
9
11
|
element :'espi:addressGeneral', as: :address_general
|
10
12
|
|
11
13
|
# Special case for PG&E generic namespacing
|
12
14
|
element :'ns0:addressGeneral', as: :address_general
|
15
|
+
|
16
|
+
# Special case for SCE namespacing
|
17
|
+
element :'cust:name', as: :name
|
18
|
+
element :'cust:number', as: :number
|
13
19
|
end
|
14
20
|
end
|
15
21
|
end
|
@@ -16,6 +16,10 @@ module GreenButtonData
|
|
16
16
|
element :'ns0:stateOrProvince', as: :state_or_province
|
17
17
|
element :'ns0:code', as: :code
|
18
18
|
element :'ns0:name', as: :name
|
19
|
+
|
20
|
+
# Special case for SCE namespacing
|
21
|
+
element :'cust:stateOrProvince', as: :state_or_province
|
22
|
+
element :'cust:name', as: :name
|
19
23
|
end
|
20
24
|
end
|
21
25
|
end
|
@@ -14,8 +14,12 @@ require 'green-button-data/parser/usage_summary'
|
|
14
14
|
require 'green-button-data/parser/street_detail'
|
15
15
|
require 'green-button-data/parser/town_detail'
|
16
16
|
require 'green-button-data/parser/main_address'
|
17
|
+
require 'green-button-data/parser/doc_status'
|
18
|
+
require 'green-button-data/parser/customer'
|
17
19
|
require 'green-button-data/parser/service_location'
|
20
|
+
require 'green-button-data/parser/customer_account'
|
18
21
|
require 'green-button-data/parser/customer_agreement'
|
22
|
+
require 'green-button-data/parser/meter'
|
19
23
|
require 'green-button-data/parser/content'
|
20
24
|
require 'green-button-data/parser/entry'
|
21
25
|
require 'green-button-data/parser/feed'
|
@@ -1,5 +1,13 @@
|
|
1
1
|
module GreenButtonData
|
2
2
|
class RetailCustomer < Entry
|
3
|
+
attr_reader :account_id,
|
4
|
+
:customer_agreement_id,
|
5
|
+
:links,
|
6
|
+
:meter_interval_length,
|
7
|
+
:meter_serial_number,
|
8
|
+
:meter_type,
|
9
|
+
:name
|
10
|
+
|
3
11
|
def has_address?
|
4
12
|
present?(address_general)
|
5
13
|
end
|
@@ -13,10 +21,14 @@ module GreenButtonData
|
|
13
21
|
end
|
14
22
|
|
15
23
|
def agreement_id_service_uuid_map
|
16
|
-
{
|
17
|
-
|
18
|
-
|
19
|
-
|
24
|
+
result = {}
|
25
|
+
|
26
|
+
if has_agreement_id_map?
|
27
|
+
result[:customer_agreement_id] = customer_agreement_id
|
28
|
+
result[:service_uuid] = service_uuid
|
29
|
+
end
|
30
|
+
|
31
|
+
result
|
20
32
|
end
|
21
33
|
|
22
34
|
private
|
@@ -25,10 +37,6 @@ module GreenButtonData
|
|
25
37
|
@id
|
26
38
|
end
|
27
39
|
|
28
|
-
def customer_agreement_id
|
29
|
-
@customer_agreement_id
|
30
|
-
end
|
31
|
-
|
32
40
|
def present?(data)
|
33
41
|
!blank?(data)
|
34
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: green-button-data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Jo
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2022-04-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nokogiri
|
@@ -46,14 +46,14 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '0
|
49
|
+
version: '1.0'
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: '0
|
56
|
+
version: '1.0'
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: rspec
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
@@ -74,14 +74,14 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - "~>"
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: '
|
77
|
+
version: '2.3'
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
82
|
- - "~>"
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version: '
|
84
|
+
version: '2.3'
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
86
|
name: guard
|
87
87
|
requirement: !ruby/object:Gem::Requirement
|
@@ -125,7 +125,7 @@ files:
|
|
125
125
|
- lib/green-button-data/configuration.rb
|
126
126
|
- lib/green-button-data/core_extensions.rb
|
127
127
|
- lib/green-button-data/core_extensions/date.rb
|
128
|
-
- lib/green-button-data/core_extensions/
|
128
|
+
- lib/green-button-data/core_extensions/integer.rb
|
129
129
|
- lib/green-button-data/core_extensions/string.rb
|
130
130
|
- lib/green-button-data/dst.rb
|
131
131
|
- lib/green-button-data/entry.rb
|
@@ -160,7 +160,10 @@ files:
|
|
160
160
|
- lib/green-button-data/parser/authorization.rb
|
161
161
|
- lib/green-button-data/parser/content.rb
|
162
162
|
- lib/green-button-data/parser/cost_additional_detail_last_period.rb
|
163
|
+
- lib/green-button-data/parser/customer.rb
|
164
|
+
- lib/green-button-data/parser/customer_account.rb
|
163
165
|
- lib/green-button-data/parser/customer_agreement.rb
|
166
|
+
- lib/green-button-data/parser/doc_status.rb
|
164
167
|
- lib/green-button-data/parser/entry.rb
|
165
168
|
- lib/green-button-data/parser/feed.rb
|
166
169
|
- lib/green-button-data/parser/interval.rb
|
@@ -168,6 +171,7 @@ files:
|
|
168
171
|
- lib/green-button-data/parser/interval_reading.rb
|
169
172
|
- lib/green-button-data/parser/local_time_parameters.rb
|
170
173
|
- lib/green-button-data/parser/main_address.rb
|
174
|
+
- lib/green-button-data/parser/meter.rb
|
171
175
|
- lib/green-button-data/parser/rational_number.rb
|
172
176
|
- lib/green-button-data/parser/reading_type.rb
|
173
177
|
- lib/green-button-data/parser/service_category.rb
|