Module: PortfolioManager::Services::Reporting::CustomReportingRespondingToDataRequests::Live

Included in:
All::Live
Defined in:
lib/portfolio_manager/services/reporting.rb

Overview

Live Environment

Instance Method Summary collapse

Instance Method Details

#add_data_response(customer_id, data_response) ⇒ PortfolioManager::Xml::ResponseType

Add Data Response

This web service creates/prepares a data response to a specific customer’s data request. The ‘customer` can reference a user you’re connected to or your own account. The information provided indicates the specific data request and a list of properties. This initialization is required if you are responding to a data request for the first time.



344
345
346
# File 'lib/portfolio_manager/services/reporting.rb', line 344

def add_data_response(customer_id, data_response)
  request(Net::HTTP::Post, path_for("reports", "customers", customer_id, "dataResponses"), {}, {}, data_response, "dataResponse", PortfolioManager::Xml::ResponseType, basic_auth: true)
end

#delete_data_request_access(customer_id, data_request_id) ⇒ PortfolioManager::Xml::ResponseType

Delete Data Request Access

This web service deletes a specific customer’s data request access. The data request must be closed. The data request itself is not deleted – just the customer’s access to it. The ‘customer` can reference a user you’re connected to or your own account.



538
539
540
# File 'lib/portfolio_manager/services/reporting.rb', line 538

def delete_data_request_access(customer_id, data_request_id)
  request(Net::HTTP::Delete, path_for("reports", "customers", customer_id, "dataResponses", "dataRequests", data_request_id), {}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
end

#delete_data_response(customer_id, data_response_id) ⇒ PortfolioManager::Xml::ResponseType

Delete Data Response

This web service deletes a specific customer’s data response. The data response must not already been submitted (i.e., sent). The customer can reference a user you’re connected to or your own account.

NOTE: If the data response has not been submitted (i.e., sent) and the corresponding data request is closed then a 403 (access denied) is returned.



407
408
409
# File 'lib/portfolio_manager/services/reporting.rb', line 407

def delete_data_response(customer_id, data_response_id)
  request(Net::HTTP::Delete, path_for("reports", "customers", customer_id, "dataResponses", data_response_id), {}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
end

#edit_data_response(customer_id, data_response_id, data_response) ⇒ PortfolioManager::Xml::ResponseType

Edit Data Response

This web service updates the list of properties to a specific customer’s data response. The list of properties provided replaces the list of the properties currently associated to the customer’s data response. The customer can reference a user you’re connected to or your own account.



386
387
388
# File 'lib/portfolio_manager/services/reporting.rb', line 386

def edit_data_response(customer_id, data_response_id, data_response)
  request(Net::HTTP::Put, path_for("reports", "customers", customer_id, "dataResponses", data_response_id), {}, {}, data_response, "dataResponse", PortfolioManager::Xml::ResponseType, basic_auth: true)
end

#generate_response_data_preview(customer_id, data_response_id) ⇒ PortfolioManager::Xml::ResponseType

Generate Data Response Preview

This web services generates a preview of a specific customer’s data response. The ‘customer` can reference a user you’re connected to or your own account.



445
446
447
# File 'lib/portfolio_manager/services/reporting.rb', line 445

def generate_response_data_preview(customer_id, data_response_id)
  request(Net::HTTP::Post, path_for("reports", "customers", customer_id, "dataResponses", data_response_id, "generate"), {}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
end

#get_all_data_responses_results(customer_id, data_request_id, type = "XML") ⇒ PortfolioManager::Xml::ResponseType

Get All Data Responses Results

This web service retrieves all of the data responses to a specific customer’s data request and returns a file stream of either an Excel file or a XML file. All of the corresponding data responses must already be submitted (i.e., sent). The ‘customer` can reference a user you’re connected to or your own account.



557
558
559
560
561
# File 'lib/portfolio_manager/services/reporting.rb', line 557

def get_all_data_responses_results(customer_id, data_request_id, type = "XML")
  request(Net::HTTP::Get, path_for("reports", "customers", customer_id, "dataResponses", "dataRequests", data_request_id, "download"), {
    "type" => type,
  }, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
end

#get_data_request(customer_id, data_request_id) ⇒ PortfolioManager::Xml::DataRequest, PortfolioManager::Xml::ResponseType

Get Data Request

This web service returns the information for a specific customer’s data request. The customer can reference a user you’re connected to or your own account.



307
308
309
# File 'lib/portfolio_manager/services/reporting.rb', line 307

def get_data_request(customer_id, data_request_id)
  request(Net::HTTP::Get, path_for("reports", "customers", customer_id, "dataRequests", data_request_id), {}, {}, nil, nil, PortfolioManager::Xml::DataRequest, basic_auth: true)
end

#get_data_requests(customer_id, status = nil) ⇒ PortfolioManager::Xml::ResponseType

Get Data Requests

This web service returns a list of data requests that were accessed by a specific customer. The customer can reference a user you’re connected to or your own account.



323
324
325
326
327
# File 'lib/portfolio_manager/services/reporting.rb', line 323

def get_data_requests(customer_id, status = nil)
  request(Net::HTTP::Get, path_for("reports", "customers", customer_id, "dataRequests"), {
    "status" => status,
  }, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
end

#get_data_response(customer_id, data_request_id = nil, status = nil) ⇒ PortfolioManager::Xml::ResponseType

Get Data Responses

This web service returns a list of all of data responses for a specific customer’s data request. The ‘customer` can reference a user you’re connected to or your own account.

Parameters:

  • customer_id (Integer)
  • data_request_id (nil, Integer) (defaults to: nil)
  • status (nil, "OPEN", "CLOSED", "ALL") (defaults to: nil)

Returns:

Raises:

See Also:



367
368
369
# File 'lib/portfolio_manager/services/reporting.rb', line 367

def get_data_response(customer_id, data_response_id)
  request(Net::HTTP::Get, path_for("reports", "customers", customer_id, "dataResponses", data_response_id), {}, {}, nil, nil, PortfolioManager::Xml::DataResponse, basic_auth: true)
end

#get_data_response_errors(customer_id, data_response_id, type = "XML") ⇒ PortfolioManager::Xml::ResponseStatus, PortfolioManager::Xml::ResponseType

Get Data Response Errors

This web service retrieves the errors associated to a specific customer’s data response preview. The errors include the list of properties that failed to calculate the Site EUI and/or Total Water Use. The error information is returned as a file stream of either an Excel file or a XML file. The ‘customer` can reference a user you’re connected to or your own account.



427
428
429
430
431
# File 'lib/portfolio_manager/services/reporting.rb', line 427

def get_data_response_errors(customer_id, data_response_id, type = "XML")
  request(Net::HTTP::Get, path_for("reports", "customers", customer_id, "dataResponses", data_response_id, "errors"), {
    "type" => type,
  }, {}, nil, nil, PortfolioManager::Xml::ResponseStatus, basic_auth: true)
end

#get_data_response_receipt(customer_id, data_response_id) ⇒ PortfolioManager::Xml::ResponseType

Get Data Response Receipt

This web service retrieves the receipt (PDF file) for a specific customer’s data response. It returns a file stream of a PDF file and the data response must be already submitted (i.e., sent). The ‘customer` can reference a user you’re connected to or your own account.



463
464
465
# File 'lib/portfolio_manager/services/reporting.rb', line 463

def get_data_response_receipt(customer_id, data_response_id)
  request(Net::HTTP::Get, path_for("reports", "customers", customer_id, "dataResponses", data_response_id, "receipt", "download"), {}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
end

#get_data_response_status(customer_id, data_response_id) ⇒ PortfolioManager::Xml::ResponseStatus, PortfolioManager::Xml::ResponseType

Get Data Response Status

This web service returns the information on the status of a specific customer’s data response and any helpful information to troubleshoot errors. The ‘customer` can reference a user you’re connected to or your own account.

The following are valid statuses:

  • INITIALIZED - Indicates that the configuration of the data response was initially created or its configuration (i.e., properties) has been updated.

  • SUBMITTED - Indicates that the data response has been submitted for generation and is waiting to be generated.

  • IN_PROCESS - Indicates that the data response is currently being generated.

  • FAILED - Indicates that the data response completed generating but has encountered an unknown error.

  • GENERATED - Indicates that data response has completed generating with no errors.

  • GENERATED_WITH_ERRORS - Indicates that data response has completed generating with no errors. Links are provided to download the errors.

  • SENT - Indicates that the data response has been sent.



521
522
523
# File 'lib/portfolio_manager/services/reporting.rb', line 521

def get_data_response_status(customer_id, data_response_id)
  request(Net::HTTP::Get, path_for("reports", "customers", customer_id, "dataResponses", data_response_id, "status"), {}, {}, nil, nil, PortfolioManager::Xml::ResponseStatus, basic_auth: true)
end

#get_preview_data_response_results(customer_id, data_response_id, type = "XML") ⇒ PortfolioManager::Xml::ResponseType

Get Preview Data Response Results

This web service retrieves a specific customer’s data response preview and returns the results as a file stream of either an Excel file or a XML file. The data response must be in preview and not already submitted (i.e., sent). The ‘customer` can reference a user you’re connected to or your own account.



598
599
600
601
602
# File 'lib/portfolio_manager/services/reporting.rb', line 598

def get_preview_data_response_results(customer_id, data_response_id, type = "XML")
  request(Net::HTTP::Get, path_for("reports", "customers", customer_id, "dataResponses", data_response_id, "download"), {
    "type" => type,
  }, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
end

#submit_data_response(customer_id, data_response_id, send_data_response) ⇒ PortfolioManager::Xml::ResponseType

Submit Data Response

This web service submits and finalizes a specific customer’s data response. The submission includes a list of email addresses that will receive a confirmation, the file format of the copy of the data that is attached to the email attachment, and whether the submission should ignore any errors where a Site EUI and/or Total Water Use calculations could not be determined. The ‘customer` can reference a user you’re connected to or your own account.

Note that the E-Sign Response step that is in the user interface is implied in this web service.



487
488
489
# File 'lib/portfolio_manager/services/reporting.rb', line 487

def submit_data_response(customer_id, data_response_id, send_data_response)
  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)
end