green-button-data 1.0.1 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4b900f97fe8680d6c03e09109fc812ba287bbdf5151c19f06bb820443fcffd2
4
- data.tar.gz: 56a31045c3e3c93635b4fd11dcc2e9e4c0eaaa90cc7770ddd68e80deb7ea03fc
3
+ metadata.gz: 7a599621ea47a62b88ed29b76d2040975abd38300211a3a27fe69230f61c21de
4
+ data.tar.gz: 4339136e2b9ae7b59f4fb7f6d59e3662ac35acd0b4c0dfeac86d0074986654ba
5
5
  SHA512:
6
- metadata.gz: f99cfd648839bd8ded9ac36c255610a45ad5fa885589ec13ea5ceaa83c3a81b5d0fbfcc35af750b1a624271cacc2fdc424111699ea535759dcd2c5d900782e26
7
- data.tar.gz: 168ef2b0973a3a006dc2987fbc9067e6266e4b5c92d3504a53568beb723ce99b9c40a7eef78115c0ca97cedab19f667db02d8e635c369878cd745e894f444a5e
6
+ metadata.gz: b83bf41c22fd6303cad744e4a8fc6e3e1077d819fdf1761a5ddee087789c7389224aecb8bca6a81c253487567d7af466f2a3f55bc7dc7b49ee6aec854cee0877
7
+ data.tar.gz: 53c3597f211f376ca5065273cae09ddb6ef67615e6877644d637990ad599393d8f44dd389c0d8c073440bc47148c31127b56f43b0d8b8f60c816903010d0fc3f
data/.circleci/config.yml CHANGED
@@ -1,44 +1,26 @@
1
- version: 2
1
+ version: 2.1
2
2
 
3
- test-steps: &test-steps
4
- working_directory: ~/green-button-data
5
- steps:
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-ruby-2.4:
8
+ test:
9
+ parameters:
10
+ ruby-version:
11
+ type: string
25
12
  docker:
26
- - image: circleci/ruby:2.4
27
- <<: *test-steps
28
-
29
- test-ruby-2.5:
30
- docker:
31
- - image: circleci/ruby:2.5
32
- <<: *test-steps
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:
41
- - image: circleci/ruby:2.4
23
+ - image: cimg/ruby:2.7
42
24
  working_directory: ~/green-button-data
43
25
  steps:
44
26
  - checkout
@@ -52,7 +34,7 @@ jobs:
52
34
 
53
35
  publish:
54
36
  docker:
55
- - image: circleci/ruby:2.4
37
+ - image: cimg/ruby:2.7
56
38
  working_directory: ~/green-button-data
57
39
  steps:
58
40
  - attach_workspace:
@@ -71,9 +53,14 @@ workflows:
71
53
  version: 2
72
54
  tests:
73
55
  jobs:
74
- - test-ruby-2.4
75
- - test-ruby-2.5
76
- - test-ruby-2.6
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
@@ -7,5 +7,7 @@ group :development do
7
7
  end
8
8
 
9
9
  group :test do
10
- gem 'codecov', require: false
10
+ gem 'simplecov', require: false
11
+ gem 'simplecov-cobertura', require: false
12
+ gem 'rspec_junit_formatter', require: false
11
13
  end
data/Gemfile.lock CHANGED
@@ -1,36 +1,53 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- green-button-data (1.0.0)
5
- faraday (~> 0.11)
4
+ green-button-data (2.0.1)
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.6.0)
13
- public_suffix (>= 2.0.2, < 4.0)
14
- codecov (0.1.14)
15
- json
16
- simplecov
17
- url
18
- coderay (1.1.2)
19
- crack (0.4.3)
20
- safe_yaml (~> 1.0.0)
21
- diff-lcs (1.3)
22
- docile (1.3.1)
23
- faraday (0.17.0)
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
- ffi (1.10.0)
26
- formatador (0.2.5)
27
- guard (2.15.0)
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.9.12)
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.3.8)
42
- json (2.1.0)
43
- listen (3.1.5)
44
- rb-fsevent (~> 0.9, >= 0.9.4)
45
- rb-inotify (~> 0.9, >= 0.9.7)
46
- ruby_dep (~> 1.2)
47
- lumberjack (1.0.13)
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.10.5)
53
- mini_portile2 (~> 2.4.0)
54
- notiffany (0.1.1)
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.12.2)
58
- coderay (~> 1.1.0)
59
- method_source (~> 0.9.0)
60
- public_suffix (3.0.3)
61
- rb-fsevent (0.10.3)
62
- rb-inotify (0.10.0)
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
- rspec (3.8.0)
65
- rspec-core (~> 3.8.0)
66
- rspec-expectations (~> 3.8.0)
67
- rspec-mocks (~> 3.8.0)
68
- rspec-core (3.8.0)
69
- rspec-support (~> 3.8.0)
70
- rspec-expectations (3.8.2)
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.8.0)
73
- rspec-mocks (3.8.0)
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.8.0)
76
- rspec-support (3.8.0)
77
- ruby_dep (1.5.0)
78
- safe_yaml (1.0.4)
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.16.1)
100
+ simplecov (0.21.2)
82
101
  docile (~> 1.1)
83
- json (>= 1.8, < 3)
84
- simplecov-html (~> 0.10.0)
85
- simplecov-html (0.10.2)
86
- thor (0.20.3)
87
- url (0.3.2)
88
- webmock (1.24.6)
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
- webmock (~> 1.21)
123
+ rspec_junit_formatter
124
+ simplecov
125
+ simplecov-cobertura
126
+ webmock (~> 2.3)
103
127
 
104
128
  BUNDLED WITH
105
- 1.16.6
129
+ 2.3.11
@@ -22,13 +22,13 @@ Gem::Specification.new do |s|
22
22
  s.require_paths = ['lib']
23
23
 
24
24
  s.platform = Gem::Platform::RUBY
25
- s.required_ruby_version = '>= 2.4.0'
25
+ s.required_ruby_version = '>= 2.6.0'
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.11'
29
+ s.add_dependency 'faraday', '~> 1.0'
30
30
 
31
31
  s.add_development_dependency 'rspec', '~> 3.0'
32
- s.add_development_dependency 'webmock', '~> 1.21'
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 Fixnum = 4611686018427387903
40
- max_fixnum = 2 ** (@client_secret_expires_at.size * 8 - 2) - 1
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(max_fixnum)
44
+ time = Time.at(max_integer)
45
45
 
46
46
  if kwargs[:local] == true
47
47
  return time.localtime
@@ -1,4 +1,4 @@
1
- Fixnum.class_eval do
1
+ Integer.class_eval do
2
2
  if 0.respond_to? :digits
3
3
  def num_digits(base = 10)
4
4
  self.digits.count
@@ -13,4 +13,4 @@ Fixnum.class_eval do
13
13
  end
14
14
  end
15
15
  end
16
- end # Fixnum.class_eval
16
+ end # Integer.class_eval
@@ -1,3 +1,3 @@
1
1
  require 'green-button-data/core_extensions/date'
2
- require 'green-button-data/core_extensions/fixnum'
2
+ require 'green-button-data/core_extensions/integer'
3
3
  require 'green-button-data/core_extensions/string'
@@ -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
- 'customeragreement'
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', class: CustomerAgreement,
62
- as: :customer_agreement
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
@@ -22,7 +22,7 @@ module GreenButtonData
22
22
  element :'ns0:unitCost', class: Integer, as: :unit_cost
23
23
 
24
24
  def cost
25
- @amount / 100_000.0 if @amount.class == Fixnum
25
+ @amount / 100_000.0 if @amount.class == Integer
26
26
  end
27
27
  end
28
28
  end
@@ -0,0 +1,9 @@
1
+ module GreenButtonData
2
+ module Parser
3
+ class Customer
4
+ include SAXMachine
5
+
6
+ element :name
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ module GreenButtonData
2
+ module Parser
3
+ class CustomerAccount
4
+ include SAXMachine
5
+
6
+ element :name, as: :account_id
7
+
8
+ # Special case for SCE namespacing
9
+ element :'cust:name', as: :account_id
10
+ end
11
+ end
12
+ 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
@@ -0,0 +1,9 @@
1
+ module GreenButtonData
2
+ module Parser
3
+ class DocStatus
4
+ include SAXMachine
5
+
6
+ element :value
7
+ end
8
+ end
9
+ end
@@ -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'
@@ -20,5 +20,13 @@ module GreenButtonData
20
20
 
21
21
  related_urls
22
22
  end
23
+
24
+ def construct_links_hash(entry)
25
+ {
26
+ related: entry.related,
27
+ self: entry.self,
28
+ up: entry.up
29
+ }
30
+ end
23
31
  end
24
32
  end
@@ -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
- customer_agreement_id: customer_agreement_id,
18
- service_uuid: service_uuid
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
@@ -1,3 +1,3 @@
1
1
  module GreenButtonData
2
- VERSION = '1.0.1'
2
+ VERSION = '2.0.1'
3
3
  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: 1.0.1
4
+ version: 2.0.1
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: 2020-01-08 00:00:00.000000000 Z
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.11'
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.11'
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: '1.21'
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: '1.21'
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/fixnum.rb
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
@@ -196,14 +200,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
196
200
  requirements:
197
201
  - - ">="
198
202
  - !ruby/object:Gem::Version
199
- version: 2.4.0
203
+ version: 2.6.0
200
204
  required_rubygems_version: !ruby/object:Gem::Requirement
201
205
  requirements:
202
206
  - - ">="
203
207
  - !ruby/object:Gem::Version
204
208
  version: '0'
205
209
  requirements: []
206
- rubygems_version: 3.0.3
210
+ rubygems_version: 3.2.32
207
211
  signing_key:
208
212
  specification_version: 4
209
213
  summary: Client and parser for Green Button API