Module: PortfolioManager::Services::Meter::ConsumptionData::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_consumption_data(meter_id, meter_data) ⇒ PortfolioManager::Xml::MeterDataType, PortfolioManager::Xml::ResponseType

Add Meter Consumption Data

This web service adds consumption data to a specific meter based on the information provided in the XML request. It returns the unique identifier to each consumption data entry and a link to the corresponding web service to retrieve it. The meter must already be shared with you and you must have write access to the meter. This web service supports all meter types (i.e., electric, natural gas, water, IT, etc.). Green power information can also be added for renewable energy meter types. Demand tracking is also available for electric grid-purchase meters. A maximum of 120 consumption records is allowed.



366
367
368
# File 'lib/portfolio_manager/services/meter.rb', line 366

def add_meter_consumption_data(meter_id, meter_data)
  request(Net::HTTP::Post, path_for("meter", meter_id, "consumptionData"), {}, {}, meter_data, "meterData", PortfolioManager::Xml::MeterDataType, basic_auth: true)
end

#delete_consumption_data(consumption_data_id) ⇒ PortfolioManager::Xml::ResponseType

Delete Consumption Data

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



381
382
383
# File 'lib/portfolio_manager/services/meter.rb', line 381

def delete_consumption_data(consumption_data_id)
  request(Net::HTTP::Delete, path_for("consumptionData", consumption_data_id), {}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
end

#delete_meter_consumption_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 consumption data for that meter will be deleted which is the default behavior.

Delete Meter Consumption Data

This web service deletes consumption data from a specific 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 supports the following meter types; energy, water, data center IT, drinking/waste water flow. Deleting the consumption 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:



407
408
409
410
411
412
# File 'lib/portfolio_manager/services/meter.rb', line 407

def delete_meter_consumption_data(meter_id, start_date = nil, end_date = nil)
  request(Net::HTTP::Delete, path_for("meter", meter_id, "consumptionData"), {
    "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

#edit_consumption_data(consumption_data_id, meter_consumption) ⇒ PortfolioManager::Xml::ResponseType

Edit Consumption Data

This web service updates a specific meter consumption 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.



427
428
429
# File 'lib/portfolio_manager/services/meter.rb', line 427

def edit_consumption_data(consumption_data_id, meter_consumption)
  request(Net::HTTP::Put, path_for("consumptionData", consumption_data_id), {}, {}, meter_consumption, "meterConsumption", PortfolioManager::Xml::ResponseType, basic_auth: true)
end

#get_id_hierarchy_for_consumption_data(consumption_data_id) ⇒ PortfolioManager::Xml::ResponseType

Get ID Hierarchy for Consumption Data

This web service returns the accountId, propertyId, and meterId that correspond to a specific consumption data record. The accountId returned is the Property Data Administrator (PDA). If the specified consumption data record refers to an IT meter or a plant flow meter, then the corresponding propertyUseId that is associated to the meter is also returned, otherwise it is omitted. The corresponding meter must already be shared with you or you must have pending share access.



447
448
449
# File 'lib/portfolio_manager/services/meter.rb', line 447

def get_id_hierarchy_for_consumption_data(consumption_data_id)
  request(Net::HTTP::Get, path_for("idHierarchy", "consumptionData", consumption_data_id), {}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
end

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

Get Meter Consumption Data

This web service retrieves consumption data for a specific meter. The meter must already be shared with you. The consumption data is returned in sets of 120. An optional date range can specified to return a certain set of consumption 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:



466
467
468
469
470
471
472
# File 'lib/portfolio_manager/services/meter.rb', line 466

def get_meter_consumption_data(meter_id, page = 1, start_date = nil, end_date = nil)
  request(Net::HTTP::Get, path_for("meter", meter_id, "consumptionData"), {
    "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::MeterDataType, basic_auth: true)
end

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

Get What Changed Consumption Data Meter List

This web service returns a list of meters that have had their consumption data changed since a user specified date. The list of meters returned are account specific. The returned list only shows meters that you have permission to view. Results are returned in increments of 1,000 per set. Consumption data edits that trigger a 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 consumption 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:



493
494
495
496
497
498
499
# File 'lib/portfolio_manager/services/meter.rb', line 493

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