portfoliomanager-rb 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +1 -1
- data/LICENSE.txt +1 -1
- data/README.md +2 -2
- data/lib/portfolio_manager/client.rb +2 -2
- data/lib/portfolio_manager/mapping_registry.rb +1698 -481
- data/lib/portfolio_manager/services/all.rb +3 -1
- data/lib/portfolio_manager/services/home_energy_yardstick.rb +69 -0
- data/lib/portfolio_manager/services/property.rb +23 -0
- data/lib/portfolio_manager/services/property_use.rb +124 -2
- data/lib/portfolio_manager/services/reporting.rb +603 -0
- data/lib/portfolio_manager/services.rb +10 -9
- data/lib/portfolio_manager/version.rb +1 -1
- data/lib/portfolio_manager/xml.rb +1698 -116
- metadata +3 -2
@@ -8,6 +8,603 @@ module PortfolioManager
|
|
8
8
|
#
|
9
9
|
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting
|
10
10
|
module Reporting
|
11
|
+
# Custom Reporting (Template Management)
|
12
|
+
module CustomReportingTemplateManagement
|
13
|
+
# Live Environment
|
14
|
+
module Live
|
15
|
+
# Get Available Metrics List
|
16
|
+
#
|
17
|
+
# This web service returns a list of all available metrics that can be
|
18
|
+
# used in a report template.
|
19
|
+
#
|
20
|
+
# @param group_ids [nil, Array<Integer>]
|
21
|
+
# @return [PortfolioManager::Xml::ReportMetrics]
|
22
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
23
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
24
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/availableMetricsList/get
|
25
|
+
def get_available_metrics_list(group_ids = nil)
|
26
|
+
request(Net::HTTP::Get, path_for("reports", "metrics"), {
|
27
|
+
"groupIds" => (group_ids.nil? || group_ids.empty?) ? nil : group_ids.collect(&:to_s).join(","),
|
28
|
+
}, {}, nil, nil, PortfolioManager::Xml::ReportMetrics, basic_auth: true)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Add Report Template
|
32
|
+
#
|
33
|
+
# This web service creates a report template in your account based on
|
34
|
+
# the template name and set of metrics provided in the XML request.
|
35
|
+
# This web service returns the unique identifier to the report
|
36
|
+
# template and a link to the corresponding web service to retrieve it.
|
37
|
+
# In addition, a unique identifier to the corresponding report and
|
38
|
+
# link to the web service to retrieve it are also returned.
|
39
|
+
#
|
40
|
+
# The following are limitations you should be aware of:
|
41
|
+
# * The maximum number of metrics that you are allowed to specify is
|
42
|
+
# the same limit that you have in the user interface.
|
43
|
+
#
|
44
|
+
# The list of metrics are specified by their unique identifiers and
|
45
|
+
# will be configured in the report template based on the order
|
46
|
+
# provided in the XML request with the exception of the 4 metrics
|
47
|
+
# listed below. The 4 metrics listed below are always included as the
|
48
|
+
# first 4 metrics in the report template even if they are not
|
49
|
+
# explicitly specified.
|
50
|
+
#
|
51
|
+
# * Property Id (id 448)
|
52
|
+
# * Property Name (id 443)
|
53
|
+
# * Parent Property Id (id 449)
|
54
|
+
# * Parent Property Name (id 1301)
|
55
|
+
#
|
56
|
+
# @param report_template [PortfolioManager::Xml::ReportTemplateType]
|
57
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
58
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
59
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
60
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/template/post
|
61
|
+
def add_report_template(report_template)
|
62
|
+
request(Net::HTTP::Post, path_for("reports", "templates"), {}, {}, report_template, "reportTemplate", PortfolioManager::Xml::ResponseType, basic_auth: true)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Get Report Template
|
66
|
+
#
|
67
|
+
# This web service retrieves information for a specific report
|
68
|
+
# template which includes the template name, the set of metrics, and
|
69
|
+
# the unique identifier to the corresponding report. The metrics are
|
70
|
+
# listed in the order that they display in the report. The report
|
71
|
+
# template must be owned by you.
|
72
|
+
#
|
73
|
+
# @param template_id [Integer]
|
74
|
+
# @return [PortfolioManager::Xml::ReportTemplateType]
|
75
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
76
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
77
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/template/get
|
78
|
+
def get_report_template(template_id)
|
79
|
+
request(Net::HTTP::Get, path_for("reports", "templates", template_id), {}, {}, nil, nil, PortfolioManager::Xml::ReportTemplateType, basic_auth: true)
|
80
|
+
end
|
81
|
+
|
82
|
+
# Edit Report Template
|
83
|
+
#
|
84
|
+
# This web service updates a specified report template based on the
|
85
|
+
# template name and set of metrics provided in the XML request. This
|
86
|
+
# web service returns the unique identifier to the report template and
|
87
|
+
# a link to the corresponding web service to retrieve it. In addition,
|
88
|
+
# a unique identifier to the corresponding report and link to the web
|
89
|
+
# service to retrieve it are also returned. The report template must
|
90
|
+
# be owned by you.
|
91
|
+
#
|
92
|
+
# The following are limitations you should be aware of:
|
93
|
+
# * The maximum number of metrics that you are allowed to specify is
|
94
|
+
# the same limit that you have in the user interface.
|
95
|
+
#
|
96
|
+
# The list of metrics are specified by their unique identifiers and
|
97
|
+
# will be configured in the report template based on the order
|
98
|
+
# provided in the XML request with the exception of the 4 metrics
|
99
|
+
# listed below. The 4 metrics listed below are always included as the
|
100
|
+
# first 4 metrics in the report template even if they are not
|
101
|
+
# explicitly specified.
|
102
|
+
#
|
103
|
+
# * Property Id (id 448)
|
104
|
+
# * Property Name (id 443)
|
105
|
+
# * Parent Property Id (id 449)
|
106
|
+
# * Parent Property Name (id 1301)
|
107
|
+
#
|
108
|
+
# @param template_id [Integer]
|
109
|
+
# @param report_template [PortfolioManager::Xml::ReportTemplateType]
|
110
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
111
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
112
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
113
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/template/put
|
114
|
+
def edit_report_template(template_id, report_template)
|
115
|
+
request(Net::HTTP::Put, path_for("reports", "templates", template_id), {}, {}, report_template, "reportTemplate", PortfolioManager::Xml::ResponseType, basic_auth: true)
|
116
|
+
end
|
117
|
+
|
118
|
+
# Delete Report Template
|
119
|
+
#
|
120
|
+
# This web service deletes a specified report template. The report
|
121
|
+
# template must be owned by you. The corresponding report is also
|
122
|
+
# deleted. The report template cannot be deleted if it's submitted for
|
123
|
+
# processing or is being generated.
|
124
|
+
#
|
125
|
+
# @param template_id [Integer]
|
126
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
127
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
128
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
129
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/template/delete
|
130
|
+
def delete_report_template(template_id)
|
131
|
+
request(Net::HTTP::Delete, path_for("reports", "templates", template_id), {}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
|
132
|
+
end
|
133
|
+
|
134
|
+
# Get Report Template List
|
135
|
+
#
|
136
|
+
# This web service returns a list of report templates in your account.
|
137
|
+
#
|
138
|
+
# @param type [nil, "CUSTOM", "ENERGY_STAR", "DATA_REQUEST"]
|
139
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
140
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
141
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
142
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/allTemplate/get
|
143
|
+
def get_report_template_list(type = nil)
|
144
|
+
request(Net::HTTP::Get, path_for("reports", "templates"), {
|
145
|
+
"type" => type,
|
146
|
+
}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
# Test Environment
|
151
|
+
module Test
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
# Custom Reporting (Report Management)
|
156
|
+
module CustomReportingReportManagement
|
157
|
+
# Live Environment
|
158
|
+
module Live
|
159
|
+
# Get Report
|
160
|
+
#
|
161
|
+
# This web service retrieves the the list of properties, {https://portfoliomanager.energystar.gov/webservices/home/test/api/reporting/customReports/timeframes timeframe},
|
162
|
+
# current status, and the unique identifier to the corresponding
|
163
|
+
# template for a specific report. The report must be owned by you.
|
164
|
+
#
|
165
|
+
# @param report_id [Integer]
|
166
|
+
# @return [PortfolioManager::Xml::Report]
|
167
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
168
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
169
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/report/get
|
170
|
+
def get_report(report_id)
|
171
|
+
request(Net::HTTP::Get, path_for("reports", report_id), {}, {}, nil, nil, PortfolioManager::Xml::Report, basic_auth: true)
|
172
|
+
end
|
173
|
+
|
174
|
+
# Edit Report
|
175
|
+
#
|
176
|
+
# This web service updates a specified report based on the list of
|
177
|
+
# properties and {https://portfoliomanager.energystar.gov/webservices/home/test/api/reporting/customReports/timeframes timeframe}
|
178
|
+
# provided in the XML request. The web service returns the unique
|
179
|
+
# identifier to the report and a link to the corresponding web service
|
180
|
+
# to retrieve it. The report must be owned by you.
|
181
|
+
#
|
182
|
+
# The following are limitations you should be aware of:
|
183
|
+
# * The report cannot be updated if it's already submitted for
|
184
|
+
# processing or is being generated.
|
185
|
+
# * A maximum of 5,000 properties is allowed and replaces the previous
|
186
|
+
# set of properties in the report.
|
187
|
+
# * A maximum of 2 million data points are allowed in a report
|
188
|
+
# (#properties * #metrics * #time periods).
|
189
|
+
#
|
190
|
+
# @param report_id [Integer]
|
191
|
+
# @param report [PortfolioManager::Xml::Report]
|
192
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
193
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
194
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
195
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/report/put
|
196
|
+
def edit_report(report_id, report)
|
197
|
+
request(Net::HTTP::Put, path_for("reports", report_id), {}, {}, report, "report", PortfolioManager::Xml::ResponseType, basic_auth: true)
|
198
|
+
end
|
199
|
+
|
200
|
+
# Get Report Results
|
201
|
+
#
|
202
|
+
# This web service retrieves the results of a report. It returns a
|
203
|
+
# file stream of either an Excel file or a XML file. The report must
|
204
|
+
# be owned by you.
|
205
|
+
#
|
206
|
+
# @param report_id [Integer]
|
207
|
+
# @param type ["EXCEL", "XML"]
|
208
|
+
# @return [PortfolioManager::Xml::Report]
|
209
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
210
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
211
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/reportResults/get
|
212
|
+
def get_report_results(report_id, type = "XML")
|
213
|
+
request(Net::HTTP::Get, path_for("reports", report_id), {
|
214
|
+
"type" => type,
|
215
|
+
}, {}, nil, nil, PortfolioManager::Xml::Report, basic_auth: true)
|
216
|
+
end
|
217
|
+
|
218
|
+
# Generate Report
|
219
|
+
#
|
220
|
+
# This web service generates a specific report. It returns a link to
|
221
|
+
# the corresponding web service to retrieve the generation status. The
|
222
|
+
# report must be owned by you.
|
223
|
+
#
|
224
|
+
# The following are limitations you should be aware of:
|
225
|
+
# * Similar to the user interface, generated reports will only be
|
226
|
+
# available for 90 days. After that time you just need to generate
|
227
|
+
# the report again to populate your template with data.
|
228
|
+
# * You can only have a maximum of 5 reports generating at one time.
|
229
|
+
# To submit more, you will need to wait for at least one of your 5
|
230
|
+
# reports to finish generating.
|
231
|
+
#
|
232
|
+
# @param report_id [Integer]
|
233
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
234
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
235
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
236
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/generateReport/post
|
237
|
+
def generate_report(report_id)
|
238
|
+
request(Net::HTTP::Post, path_for("reports", report_id, "generate"), {}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
|
239
|
+
end
|
240
|
+
|
241
|
+
# Get Report Status
|
242
|
+
#
|
243
|
+
# This web service returns information on the status of the report.
|
244
|
+
# The report must be owned by you.
|
245
|
+
#
|
246
|
+
# The following are valid statuses:
|
247
|
+
# * INITIALIZED - Indicates that the report was initially created or
|
248
|
+
# its configuration (i.e., timeframe, properties, metrics, etc.) has
|
249
|
+
# been updated.
|
250
|
+
# * SUBMITTED - Indicates that the report has been submitted for
|
251
|
+
# generation and is waiting to be generated.
|
252
|
+
# * IN_PROCESS - Indicates that the report is currently being
|
253
|
+
# generated.
|
254
|
+
# * FAILED - Indicates that the report encountered an unknown error
|
255
|
+
# during the generation step.
|
256
|
+
# * GENERATED - Indicates that report has completed generation and is
|
257
|
+
# available for download.
|
258
|
+
#
|
259
|
+
# @param report_id [Integer]
|
260
|
+
# @return [PortfolioManager::Xml::ReportStatusDef]
|
261
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
262
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
263
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/reportStatus/get
|
264
|
+
def get_report_status(report_id)
|
265
|
+
request(Net::HTTP::Get, path_for("reports", report_id, "status"), {}, {}, nil, nil, PortfolioManager::Xml::ReportStatusDef, basic_auth: true)
|
266
|
+
end
|
267
|
+
|
268
|
+
# Get Report List
|
269
|
+
#
|
270
|
+
# This web service returns a list of reports in your account.
|
271
|
+
#
|
272
|
+
# @param type [nil, "CUSTOM", "ENERGY_STAR", "DATA_REQUEST", "DATA_RESPONSE"]
|
273
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
274
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
275
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
276
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/allReport/get
|
277
|
+
def get_report_list(type = nil)
|
278
|
+
request(Net::HTTP::Get, path_for("reports"), {
|
279
|
+
"type" => type,
|
280
|
+
}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
# Test Environment
|
285
|
+
module Test
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
# Custom Reporting (Responding to Data Requests)
|
290
|
+
module CustomReportingRespondingToDataRequests
|
291
|
+
# Live Environment
|
292
|
+
module Live
|
293
|
+
# Get Data Request
|
294
|
+
#
|
295
|
+
# This web service returns the information for a specific customer's
|
296
|
+
# data request. The customer can reference a user you're connected to
|
297
|
+
# or your own account.
|
298
|
+
#
|
299
|
+
# @param customer_id [Integer]
|
300
|
+
# @param data_request_id [Integer]
|
301
|
+
# @return [PortfolioManager::Xml::DataRequest]
|
302
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
303
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
304
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/customerDataRequest/get
|
305
|
+
def get_data_request(customer_id, data_request_id)
|
306
|
+
request(Net::HTTP::Get, path_for("reports", "customers", customer_id, "dataRequests", data_request_id), {}, {}, nil, nil, PortfolioManager::Xml::DataRequest, basic_auth: true)
|
307
|
+
end
|
308
|
+
|
309
|
+
# Get Data Requests
|
310
|
+
#
|
311
|
+
# This web service returns a list of data requests that were accessed
|
312
|
+
# by a specific customer. The customer can reference a user you're
|
313
|
+
# connected to or your own account.
|
314
|
+
#
|
315
|
+
# @param customer_id [Integer]
|
316
|
+
# @param status [nil, "OPEN", "CLOSED", "ALL"]
|
317
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
318
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
319
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
320
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/customerDataRequests/get
|
321
|
+
def get_data_requests(customer_id, status = nil)
|
322
|
+
request(Net::HTTP::Get, path_for("reports", "customers", customer_id, "dataRequests"), {
|
323
|
+
"status" => status,
|
324
|
+
}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
|
325
|
+
end
|
326
|
+
|
327
|
+
# Add Data Response
|
328
|
+
#
|
329
|
+
# This web service creates/prepares a data response to a specific
|
330
|
+
# customer's data request. The `customer` can reference a user you're
|
331
|
+
# connected to or your own account. The information provided indicates
|
332
|
+
# the specific data request and a list of properties. This
|
333
|
+
# initialization is required if you are responding to a data request
|
334
|
+
# for the first time.
|
335
|
+
#
|
336
|
+
# @param customer_id [Integer]
|
337
|
+
# @param data_response [PortfolioManager::Xml::DataResponse]
|
338
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
339
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
340
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
341
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/dataResponse/post
|
342
|
+
def add_data_response(customer_id, data_response)
|
343
|
+
request(Net::HTTP::Post, path_for("reports", "customers", customer_id, "dataResponses"), {}, {}, data_response, "dataResponse", PortfolioManager::Xml::ResponseType, basic_auth: true)
|
344
|
+
end
|
345
|
+
|
346
|
+
# Get Data Response
|
347
|
+
#
|
348
|
+
# This web service retrieves information for a specific customer's
|
349
|
+
# data response. The information returned includes the data request
|
350
|
+
# identifier and a list of properties associated to the data response.
|
351
|
+
# The corresponding metric calculation values to the data response are
|
352
|
+
# not returned. The customer can reference a user you're connected to
|
353
|
+
# or your own account.
|
354
|
+
#
|
355
|
+
# NOTE: If the data response has not been submitted (i.e., sent) and
|
356
|
+
# the corresponding data request is closed then a 403 (access denied)
|
357
|
+
# is returned.
|
358
|
+
#
|
359
|
+
# @param customer_id [Integer]
|
360
|
+
# @param data_response_id [Integer]
|
361
|
+
# @return [PortfolioManager::Xml::DataResponse]
|
362
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
363
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
364
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/dataResponse/get
|
365
|
+
def get_data_response(customer_id, data_response_id)
|
366
|
+
request(Net::HTTP::Get, path_for("reports", "customers", customer_id, "dataResponses", data_response_id), {}, {}, nil, nil, PortfolioManager::Xml::DataResponse, basic_auth: true)
|
367
|
+
end
|
368
|
+
|
369
|
+
# Edit Data Response
|
370
|
+
#
|
371
|
+
# This web service updates the list of properties to a specific
|
372
|
+
# customer's data response. The list of properties provided replaces
|
373
|
+
# the list of the properties currently associated to the customer's
|
374
|
+
# data response. The customer can reference a user you're connected to
|
375
|
+
# or your own account.
|
376
|
+
#
|
377
|
+
# @param customer_id [Integer]
|
378
|
+
# @param data_response_id [Integer]
|
379
|
+
# @param data_response [PortfolioManager::Xml::DataResponse]
|
380
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
381
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
382
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
383
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/dataResponse/put
|
384
|
+
def edit_data_response(customer_id, data_response_id, data_response)
|
385
|
+
request(Net::HTTP::Put, path_for("reports", "customers", customer_id, "dataResponses", data_response_id), {}, {}, data_response, "dataResponse", PortfolioManager::Xml::ResponseType, basic_auth: true)
|
386
|
+
end
|
387
|
+
|
388
|
+
# Delete Data Response
|
389
|
+
#
|
390
|
+
# This web service deletes a specific customer's data response. The
|
391
|
+
# data response must not already been submitted (i.e., sent). The
|
392
|
+
# customer can reference a user you're connected to or your own
|
393
|
+
# account.
|
394
|
+
#
|
395
|
+
# NOTE: If the data response has not been submitted (i.e., sent) and
|
396
|
+
# the corresponding data request is closed then a 403 (access denied)
|
397
|
+
# is returned.
|
398
|
+
#
|
399
|
+
# @param customer_id [Integer]
|
400
|
+
# @param data_response_id [Integer]
|
401
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
402
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
403
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
404
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/dataResponse/delete
|
405
|
+
def delete_data_response(customer_id, data_response_id)
|
406
|
+
request(Net::HTTP::Delete, path_for("reports", "customers", customer_id, "dataResponses", data_response_id), {}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
|
407
|
+
end
|
408
|
+
|
409
|
+
# Get Data Response Errors
|
410
|
+
#
|
411
|
+
# This web service retrieves the errors associated to a specific
|
412
|
+
# customer's data response preview. The errors include the list of
|
413
|
+
# properties that failed to calculate the Site EUI and/or Total Water
|
414
|
+
# Use. The error information is returned as a file stream of either an
|
415
|
+
# Excel file or a XML file. The `customer` can reference a user you're
|
416
|
+
# connected to or your own account.
|
417
|
+
#
|
418
|
+
# @param customer_id [Integer]
|
419
|
+
# @param data_response_id [Integer]
|
420
|
+
# @param type ["EXCEL", "XML"]
|
421
|
+
# @return [PortfolioManager::Xml::ResponseStatus]
|
422
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
423
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
424
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/downloadErrorsDataResponse/get
|
425
|
+
def get_data_response_errors(customer_id, data_response_id, type = "XML")
|
426
|
+
request(Net::HTTP::Get, path_for("reports", "customers", customer_id, "dataResponses", data_response_id, "errors"), {
|
427
|
+
"type" => type,
|
428
|
+
}, {}, nil, nil, PortfolioManager::Xml::ResponseStatus, basic_auth: true)
|
429
|
+
end
|
430
|
+
|
431
|
+
# Generate Data Response Preview
|
432
|
+
#
|
433
|
+
# This web services generates a preview of a specific customer's data
|
434
|
+
# response. The `customer` can reference a user you're connected to or
|
435
|
+
# your own account.
|
436
|
+
#
|
437
|
+
# @param customer_id [Integer]
|
438
|
+
# @param data_response_id [Integer]
|
439
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
440
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
441
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
442
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/generateDataResponse/post
|
443
|
+
def generate_response_data_preview(customer_id, data_response_id)
|
444
|
+
request(Net::HTTP::Post, path_for("reports", "customers", customer_id, "dataResponses", data_response_id, "generate"), {}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
|
445
|
+
end
|
446
|
+
|
447
|
+
# Get Data Response Receipt
|
448
|
+
#
|
449
|
+
# This web service retrieves the receipt (PDF file) for a specific
|
450
|
+
# customer's data response. It returns a file stream of a PDF file and
|
451
|
+
# the data response must be already submitted (i.e., sent). The
|
452
|
+
# `customer` can reference a user you're connected to or your own
|
453
|
+
# account.
|
454
|
+
#
|
455
|
+
# @param customer_id [Integer]
|
456
|
+
# @param data_response_id [Integer]
|
457
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
458
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
459
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
460
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/receiptDataResponse/get
|
461
|
+
def get_data_response_receipt(customer_id, data_response_id)
|
462
|
+
request(Net::HTTP::Get, path_for("reports", "customers", customer_id, "dataResponses", data_response_id, "receipt", "download"), {}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
|
463
|
+
end
|
464
|
+
|
465
|
+
# Submit Data Response
|
466
|
+
#
|
467
|
+
# This web service submits and finalizes a specific customer's data
|
468
|
+
# response. The submission includes a list of email addresses that
|
469
|
+
# will receive a confirmation, the file format of the copy of the data
|
470
|
+
# that is attached to the email attachment, and whether the submission
|
471
|
+
# should ignore any errors where a Site EUI and/or Total Water Use
|
472
|
+
# calculations could not be determined. The `customer` can reference a
|
473
|
+
# user you're connected to or your own account.
|
474
|
+
#
|
475
|
+
# Note that the E-Sign Response step that is in the user interface is
|
476
|
+
# implied in this web service.
|
477
|
+
#
|
478
|
+
# @param customer_id [Integer]
|
479
|
+
# @param data_response_id [Integer]
|
480
|
+
# @param send_data_response [PortfolioManager::Xml::SendDataResponse]
|
481
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
482
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
483
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
484
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/sendDataResponse/post
|
485
|
+
def submit_data_response(customer_id, data_response_id, send_data_response)
|
486
|
+
request(Net::HTTP::Post, path_for("reports", "customers", customer_id, "dataResponses", data_response_id, "send"), {}, {}, send_data_response, "sendDataResponse", PortfolioManager::Xml::ResponseType, basic_auth: true)
|
487
|
+
end
|
488
|
+
|
489
|
+
# Get Data Response Status
|
490
|
+
#
|
491
|
+
# This web service returns the information on the status of a specific
|
492
|
+
# customer's data response and any helpful information to troubleshoot
|
493
|
+
# errors. The `customer` can reference a user you're connected to or
|
494
|
+
# your own account.
|
495
|
+
#
|
496
|
+
# The following are valid statuses:
|
497
|
+
# * INITIALIZED - Indicates that the configuration of the data
|
498
|
+
# response was initially created or its configuration
|
499
|
+
# (i.e., properties) has been updated.
|
500
|
+
# * SUBMITTED - Indicates that the data response has been submitted
|
501
|
+
# for generation and is waiting to be generated.
|
502
|
+
# * IN_PROCESS - Indicates that the data response is currently being
|
503
|
+
# generated.
|
504
|
+
# * FAILED - Indicates that the data response completed generating but
|
505
|
+
# has encountered an unknown error.
|
506
|
+
# * GENERATED - Indicates that data response has completed generating
|
507
|
+
# with no errors.
|
508
|
+
# * GENERATED_WITH_ERRORS - Indicates that data response has completed
|
509
|
+
# generating with no errors. Links are provided to download the
|
510
|
+
# errors.
|
511
|
+
# * SENT - Indicates that the data response has been sent.
|
512
|
+
#
|
513
|
+
# @param customer_id [Integer]
|
514
|
+
# @param data_response_id [Integer]
|
515
|
+
# @return [PortfolioManager::Xml::ResponseStatus]
|
516
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
517
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
518
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/statusDataResponse/get
|
519
|
+
def get_data_response_status(customer_id, data_response_id)
|
520
|
+
request(Net::HTTP::Get, path_for("reports", "customers", customer_id, "dataResponses", data_response_id, "status"), {}, {}, nil, nil, PortfolioManager::Xml::ResponseStatus, basic_auth: true)
|
521
|
+
end
|
522
|
+
|
523
|
+
# Delete Data Request Access
|
524
|
+
#
|
525
|
+
# This web service deletes a specific customer's data request access.
|
526
|
+
# The data request must be closed. The data request itself is not
|
527
|
+
# deleted – just the customer's access to it. The `customer` can
|
528
|
+
# reference a user you're connected to or your own account.
|
529
|
+
#
|
530
|
+
# @param customer_id [Integer]
|
531
|
+
# @param data_request_id [Integer]
|
532
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
533
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
534
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
535
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/dataRequest/delete
|
536
|
+
def delete_data_request_access(customer_id, data_request_id)
|
537
|
+
request(Net::HTTP::Delete, path_for("reports", "customers", customer_id, "dataResponses", "dataRequests", data_request_id), {}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
|
538
|
+
end
|
539
|
+
|
540
|
+
# Get All Data Responses Results
|
541
|
+
#
|
542
|
+
# This web service retrieves all of the data responses to a specific
|
543
|
+
# customer's data request and returns a file stream of either an Excel
|
544
|
+
# file or a XML file. All of the corresponding data responses must
|
545
|
+
# already be submitted (i.e., sent). The `customer` can reference a
|
546
|
+
# user you're connected to or your own account.
|
547
|
+
#
|
548
|
+
# @param customer_id [Integer]
|
549
|
+
# @param data_request_id [Integer]
|
550
|
+
# @param type ["EXCEL", "XML"]
|
551
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
552
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
553
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
554
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/downloadDataResponse/get
|
555
|
+
def get_all_data_responses_results(customer_id, data_request_id, type = "XML")
|
556
|
+
request(Net::HTTP::Get, path_for("reports", "customers", customer_id, "dataResponses", "dataRequests", data_request_id, "download"), {
|
557
|
+
"type" => type,
|
558
|
+
}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
|
559
|
+
end
|
560
|
+
|
561
|
+
# Get Data Responses
|
562
|
+
#
|
563
|
+
# This web service returns a list of all of data responses for a
|
564
|
+
# specific customer's data request. The `customer` can reference a
|
565
|
+
# user you're connected to or your own account.
|
566
|
+
#
|
567
|
+
# @param customer_id [Integer]
|
568
|
+
# @param data_request_id [nil, Integer]
|
569
|
+
# @param status [nil, "OPEN", "CLOSED", "ALL"]
|
570
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
571
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
572
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
573
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/customerDataResponses/get
|
574
|
+
def get_data_response(customer_id, data_request_id = nil, status = nil)
|
575
|
+
request(Net::HTTP::Get, path_for("reports", "customers", customer_id, "dataResponses"), {
|
576
|
+
"dataRequestId" => data_request_id,
|
577
|
+
"status" => status,
|
578
|
+
}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
|
579
|
+
end
|
580
|
+
|
581
|
+
# Get Preview Data Response Results
|
582
|
+
#
|
583
|
+
# This web service retrieves a specific customer's data response
|
584
|
+
# preview and returns the results as a file stream of either an Excel
|
585
|
+
# file or a XML file. The data response must be in preview and not
|
586
|
+
# already submitted (i.e., sent). The `customer` can reference a user
|
587
|
+
# you're connected to or your own account.
|
588
|
+
#
|
589
|
+
# @param customer_id [Integer]
|
590
|
+
# @param data_response_id [Integer]
|
591
|
+
# @param type ["EXCEL", "XML"]
|
592
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
593
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
594
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
595
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/downloadPreviewDataResponse/get
|
596
|
+
def get_preview_data_response_results(customer_id, data_response_id, type = "XML")
|
597
|
+
request(Net::HTTP::Get, path_for("reports", "customers", customer_id, "dataResponses", data_response_id, "download"), {
|
598
|
+
"type" => type,
|
599
|
+
}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
|
600
|
+
end
|
601
|
+
end
|
602
|
+
|
603
|
+
# Test Environment
|
604
|
+
module Test
|
605
|
+
end
|
606
|
+
end
|
607
|
+
|
11
608
|
# Reporting
|
12
609
|
module Reporting
|
13
610
|
# Live Environment
|
@@ -195,11 +792,17 @@ module PortfolioManager
|
|
195
792
|
module All
|
196
793
|
# Live Environment
|
197
794
|
module Live
|
795
|
+
include PortfolioManager::Services::Reporting::CustomReportingTemplateManagement::Live
|
796
|
+
include PortfolioManager::Services::Reporting::CustomReportingReportManagement::Live
|
797
|
+
include PortfolioManager::Services::Reporting::CustomReportingRespondingToDataRequests::Live
|
198
798
|
include PortfolioManager::Services::Reporting::Reporting::Live
|
199
799
|
end
|
200
800
|
|
201
801
|
# Test Environment
|
202
802
|
module Test
|
803
|
+
include PortfolioManager::Services::Reporting::CustomReportingTemplateManagement::Test
|
804
|
+
include PortfolioManager::Services::Reporting::CustomReportingReportManagement::Test
|
805
|
+
include PortfolioManager::Services::Reporting::CustomReportingRespondingToDataRequests::Test
|
203
806
|
include PortfolioManager::Services::Reporting::Reporting::Test
|
204
807
|
end
|
205
808
|
end
|
@@ -8,14 +8,15 @@ module PortfolioManager
|
|
8
8
|
#
|
9
9
|
# @see https://portfoliomanager.energystar.gov/webservices/home/api
|
10
10
|
module Services
|
11
|
-
autoload :All,
|
12
|
-
autoload :BasicAccount,
|
13
|
-
autoload :Building,
|
14
|
-
autoload :Connection,
|
15
|
-
autoload :
|
16
|
-
autoload :
|
17
|
-
autoload :
|
18
|
-
autoload :
|
19
|
-
autoload :
|
11
|
+
autoload :All, "portfolio_manager/services/all"
|
12
|
+
autoload :BasicAccount, "portfolio_manager/services/basic_account"
|
13
|
+
autoload :Building, "portfolio_manager/services/building"
|
14
|
+
autoload :Connection, "portfolio_manager/services/connection"
|
15
|
+
autoload :HomeEnergyYardstick, "portfolio_manager/services/home_energy_yardstick"
|
16
|
+
autoload :Meter, "portfolio_manager/services/meter"
|
17
|
+
autoload :Property, "portfolio_manager/services/property"
|
18
|
+
autoload :PropertyUse, "portfolio_manager/services/property_use"
|
19
|
+
autoload :Reporting, "portfolio_manager/services/reporting"
|
20
|
+
autoload :TargetFinder, "portfolio_manager/services/target_finder"
|
20
21
|
end
|
21
22
|
end
|