module PortfolioManager::REST::Share
Share
services @see portfoliomanager.energystar.gov/webservices/home/api/connection
Public Instance Methods
meter_share_request(meter_id, accept = true)
click to toggle source
Accepts/rejects a pending share request for a specific property or meter.
@see portfoliomanager.energystar.gov/webservices/home/api/connection/shareProperty/post @see portfoliomanager.energystar.gov/webservices/home/api/connection/shareMeter/post
# File lib/portfolio_manager/rest/share.rb, line 31 def meter_share_request(meter_id, accept = true) share_request(meter_id, :meter, accept) end
pending_meter_shares(link = nil)
click to toggle source
Returns a list of property or meter share requests that are pending. These property share requests belong to customers that you are already connected to. The list of pending property share requests is returned in sets of 20.
@see portfoliomanager.energystar.gov/webservices/home/api/connection/pendingPropertyList/get @see portfoliomanager.energystar.gov/webservices/home/api/connection/pendingMeterList/get
# File lib/portfolio_manager/rest/share.rb, line 18 def pending_meter_shares(link = nil) pending_shares(:meter, link) end
pending_property_shares(link = nil)
click to toggle source
# File lib/portfolio_manager/rest/share.rb, line 22 def pending_property_shares(link = nil) pending_shares(:property, link) end
property_share_request(property_id, accept = true)
click to toggle source
# File lib/portfolio_manager/rest/share.rb, line 35 def property_share_request(property_id, accept = true) share_request(property_id, :property, accept) end
Private Instance Methods
pending_shares(resource_name, link)
click to toggle source
# File lib/portfolio_manager/rest/share.rb, line 41 def pending_shares(resource_name, link) link ||= "/share/#{resource_name}/pending/list" perform_get_request(link) end
share_request(resource_id, resource_name, accept = true)
click to toggle source
# File lib/portfolio_manager/rest/share.rb, line 46 def share_request(resource_id, resource_name, accept = true) perform_post_request( "/share/#{resource_name}/#{resource_id}", body: share_response_body(accept, resource_name) ) end
share_response_body(accept, resource_name)
click to toggle source
# File lib/portfolio_manager/rest/share.rb, line 53 def share_response_body(accept, resource_name) accept_note = "Your #{resource_name} sharing request has been verified and accepted." reject_note = "Your #{resource_name} sharing request has been rejected." action = accept ? 'Accept' : 'Reject' note = accept ? accept_note : reject_note request_response_xml(action, note) end