Module: PortfolioManager::Services::Meter::WasteData::Live

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

Overview

Live Environment

Instance Method Summary collapse

Instance Method Details

#add_meter_waste_data(meter_id, waste_data_list) ⇒ PortfolioManager::Xml::WasteMeterDataType, PortfolioManager::Xml::ResponseType

Add Meter Waste Data

This web service adds waste data to a specific meter based on the information provided in the XML request. It returns the unique identifier to each waste data entry. The meter must already be shared with you and you must have write access to the meter. A maximum of 120 waste data records is allowed.



525
526
527
# File 'lib/portfolio_manager/services/meter.rb', line 525

def add_meter_waste_data(meter_id, waste_data_list)
  request(Net::HTTP::Post, path_for("meter", meter_id, "wasteData"), {}, {}, waste_data_list, "wasteDataList", PortfolioManager::Xml::WasteMeterDataType, basic_auth: true)
end

#delete_meter_waste_data(meter_id, start_date = nil, end_date = nil) ⇒ PortfolioManager::Xml::ResponseType

Note:

If you misspell the “startDate” or “endDate” parameter then the resulting behavior is equivalent to if the parameter was omitted. For example, if you run this web service and misspelled both date range parameters then all of the waste data for that meter will be deleted which is the default behavior.

Delete Meter Waste Data

This web service deletes waste data from a specified meter based on a specified optional date range. The meter must already be shared to you and you must have read write access. This web service only supports waste meters. Deleting the waste data is permanent and cannot be undone.

Parameters:

  • meter_id (Integer)
  • start_date (nil, Date) (defaults to: nil)
  • end_date (nil, Date) (defaults to: nil)

Returns:

Raises:

See Also:



565
566
567
568
569
570
# File 'lib/portfolio_manager/services/meter.rb', line 565

def delete_meter_waste_data(meter_id, start_date = nil, end_date = nil)
  request(Net::HTTP::Delete, path_for("meter", meter_id, "wasteData"), {
    "startDate" => start_date.nil? ? nil : start_date.strftime("%Y-%m-%d"),
    "endDate" => end_date.nil? ? nil : end_date.strftime("%Y-%m-%d"),
  }, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
end

#delete_waste_data(waste_data_id) ⇒ PortfolioManager::Xml::ResponseType

Delete Waste Data

This web service deletes a specific waste data. The corresponding meter must already be shared with you and you must have write access.



540
541
542
# File 'lib/portfolio_manager/services/meter.rb', line 540

def delete_waste_data(waste_data_id)
  request(Net::HTTP::Delete, path_for("wasteData", waste_data_id), {}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
end

#edit_waste_data(waste_data_id, waste_data) ⇒ PortfolioManager::Xml::ResponseType

Edit Waste Data

This web service updates a specific waste meter data record based on the information provided in the XML request. The corresponding meter must already be shared with you and you must have write access to the meter.



585
586
587
# File 'lib/portfolio_manager/services/meter.rb', line 585

def edit_waste_data(waste_data_id, waste_data)
  request(Net::HTTP::Put, path_for("wasteData", waste_data_id), {}, {}, waste_data, "wasteData", PortfolioManager::Xml::ResponseType, basic_auth: true)
end

#get_id_hierarchy_for_waste_data(waste_data_id) ⇒ PortfolioManager::Xml::ResponseType

Get ID Hierarchy for Waste Data

This web service returns the accountId, propertyId, and meterId that correspond to a specific waste data record. The accountId returned is the Property Data Administrator (PDA). The corresponding meter must already be shared with you or you must have pending share access.



602
603
604
# File 'lib/portfolio_manager/services/meter.rb', line 602

def get_id_hierarchy_for_waste_data(waste_data_id)
  request(Net::HTTP::Get, path_for("idHierarchy", "wasteData", waste_data_id), {}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
end

#get_meter_waste_data(meter_id, page = 1, start_date = nil, end_date = nil) ⇒ PortfolioManager::Xml::WasteMeterDataType, PortfolioManager::Xml::ResponseType

Get Meter Waste Data

This web service retrieves waste data for a specific meter. The meter must already be shared with you. The waste data is returned in sets of 120. An optional date range can be specified to return a certain set of waste data records.

Parameters:

  • meter_id (Integer)
  • page (Integer) (defaults to: 1)
  • start_date (nil, Date) (defaults to: nil)
  • end_date (nil, Date) (defaults to: nil)

Returns:

Raises:

See Also:



621
622
623
624
625
626
627
# File 'lib/portfolio_manager/services/meter.rb', line 621

def get_meter_waste_data(meter_id, page = 1, start_date = nil, end_date = nil)
  request(Net::HTTP::Get, path_for("meter", meter_id, "wasteData"), {
    "page" => page,
    "startDate" => start_date.nil? ? nil : start_date.strftime("%Y-%m-%d"),
    "endDate" => end_date.nil? ? nil : end_date.strftime("%Y-%m-%d"),
  }, {}, nil, nil, PortfolioManager::Xml::WasteMeterDataType, basic_auth: true)
end

#get_what_changed_waste_data_meter_list(customer_id, date, next_page_key = nil, previous_page_key = nil) ⇒ PortfolioManager::Xml::ResponseType

Get What Changed Waste Data Meter List

This web service returns a list of waste meters that have had their consumption data changed since a user specified date. The list of waste meters returned are account specific. The returned list only shows waste meters that you have permission to view. Results are returned in increments of 1,000 per set. Waste data edits that trigger a waste meter to be included in the returned list may have been performed by any user with write access to the meter. The list returns links to each meter’s waste data.

Parameters:

  • customer_id (Integer)
  • date (Date)
  • next_page_key (nil, String) (defaults to: nil)
  • previous_page_key (nil, String) (defaults to: nil)

Returns:

Raises:

See Also:



648
649
650
651
652
653
654
# File 'lib/portfolio_manager/services/meter.rb', line 648

def get_what_changed_waste_data_meter_list(customer_id, date, next_page_key = nil, previous_page_key = nil)
  request(Net::HTTP::Get, path_for("customer", customer_id, "meter", "wasteData", "whatChanged"), {
    "date" => date.strftime("%Y-%m-%d"),
    "nextPageKey" => next_page_key,
    "previousPageKey" => previous_page_key,
  }, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
end