portfoliomanager-rb 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/.travis.yml +6 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +15 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +42 -0
- data/LICENSE.txt +30 -0
- data/README.md +92 -0
- data/Rakefile +6 -0
- data/WARRANTY.txt +22 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/portfolio_manager/client.rb +199 -0
- data/lib/portfolio_manager/mapper.rb +14 -0
- data/lib/portfolio_manager/mapping_registry.rb +7326 -0
- data/lib/portfolio_manager/services/all.rb +30 -0
- data/lib/portfolio_manager/services/basic_account.rb +301 -0
- data/lib/portfolio_manager/services/building.rb +158 -0
- data/lib/portfolio_manager/services/connection.rb +386 -0
- data/lib/portfolio_manager/services/meter.rb +955 -0
- data/lib/portfolio_manager/services/property.rb +931 -0
- data/lib/portfolio_manager/services/property_use.rb +306 -0
- data/lib/portfolio_manager/services/reporting.rb +208 -0
- data/lib/portfolio_manager/services/target_finder.rb +76 -0
- data/lib/portfolio_manager/services.rb +21 -0
- data/lib/portfolio_manager/version.rb +3 -0
- data/lib/portfolio_manager/xml.rb +9221 -0
- data/lib/portfolio_manager.rb +15 -0
- data/portfoliomanager.gemspec +28 -0
- metadata +104 -0
@@ -0,0 +1,306 @@
|
|
1
|
+
require "net/http"
|
2
|
+
|
3
|
+
module PortfolioManager
|
4
|
+
module Services
|
5
|
+
# Property Use Services
|
6
|
+
#
|
7
|
+
# The Property Use Services allows you to define how a property will be used
|
8
|
+
# and operated. These services allow you to add, update, and delete the use
|
9
|
+
# types of a property as well as manage their operating characteristics.
|
10
|
+
#
|
11
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/propertyUse
|
12
|
+
module PropertyUse
|
13
|
+
# Property Use
|
14
|
+
module PropertyUse
|
15
|
+
# Live Environment
|
16
|
+
module Live
|
17
|
+
# Add Property Use
|
18
|
+
#
|
19
|
+
# This web service creates a property use under a specified property
|
20
|
+
# based on the information provided in the XML request. It returns the
|
21
|
+
# unique identifier to the newly created property use and a link to
|
22
|
+
# the corresponding web service to retrieve it. To specify the use of
|
23
|
+
# default values, just omit the "value" XML tag for that particular
|
24
|
+
# use detail information from the XML request or omit the entire
|
25
|
+
# reference to the particular use detail information from the XML
|
26
|
+
# request altogether.
|
27
|
+
#
|
28
|
+
# @param property_id [Integer]
|
29
|
+
# @param property_use [PortfolioManager::Xml::BankBranchType, PortfolioManager::Xml::BarracksType, PortfolioManager::Xml::CollegeUniversityType, PortfolioManager::Xml::ConvenienceStoreWithGasStationType, PortfolioManager::Xml::ConvenienceStoreWithoutGasStationType, PortfolioManager::Xml::CourthouseType, PortfolioManager::Xml::DataCenterType, PortfolioManager::Xml::DistributionCenterType, PortfolioManager::Xml::DrinkingWaterTreatmentAndDistributionType, PortfolioManager::Xml::FinancialOfficeType, PortfolioManager::Xml::FoodSalesType, PortfolioManager::Xml::HospitalType, PortfolioManager::Xml::HotelType, PortfolioManager::Xml::IceCurlingRinkType, PortfolioManager::Xml::IndoorArenaType, PortfolioManager::Xml::K12SchoolType, PortfolioManager::Xml::MedicalOfficeType, PortfolioManager::Xml::MultifamilyHousingType, PortfolioManager::Xml::NonRefrigeratedWarehouseType, PortfolioManager::Xml::OfficeType, PortfolioManager::Xml::OtherStadiumType, PortfolioManager::Xml::ParkingType, PortfolioManager::Xml::RefrigeratedWarehouseType, PortfolioManager::Xml::ResidenceHallDormitoryType, PortfolioManager::Xml::ResidentialCareFacilityType, PortfolioManager::Xml::RetailType, PortfolioManager::Xml::SelfStorageFacilityType, PortfolioManager::Xml::SeniorLivingCommunityType, PortfolioManager::Xml::SingleFamilyHomeType, PortfolioManager::Xml::StadiumClosedType, PortfolioManager::Xml::StadiumOpenType, PortfolioManager::Xml::SupermarketType, PortfolioManager::Xml::SwimmingPoolType, PortfolioManager::Xml::WastewaterTreatmentPlantType, PortfolioManager::Xml::WholesaleClubSupercenterType, PortfolioManager::Xml::WorshipFacilityType]
|
30
|
+
# @param elename [nil, String]
|
31
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
32
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
33
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
34
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/propertyUse/propertyUse/post
|
35
|
+
def add_property_use(property_id, property_use, elename = nil)
|
36
|
+
request(Net::HTTP::Post, path_for("property", property_id, "propertyUse"), {}, {}, property_use, elename, PortfolioManager::Xml::ResponseType, basic_auth: true)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Delete Property Use
|
40
|
+
#
|
41
|
+
# This web service deletes a specific property use. The corresponding
|
42
|
+
# property must already be shared with you.
|
43
|
+
#
|
44
|
+
# @param property_use_id [Integer]
|
45
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
46
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
47
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
48
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/propertyUse/propertyUse/delete
|
49
|
+
def delete_property_use(property_use_id)
|
50
|
+
request(Net::HTTP::Delete, path_for("propertyUse", property_use_id), {}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
|
51
|
+
end
|
52
|
+
|
53
|
+
# Edit Property Use
|
54
|
+
#
|
55
|
+
# This web service updates a specific property use under a given
|
56
|
+
# property based on the information provided in the XML request. Only
|
57
|
+
# the name of the property use can be updated with this web service.
|
58
|
+
# It returns the unique identifier to the property use and a link to
|
59
|
+
# the corresponding web service to retrieve it. The corresponding
|
60
|
+
# property must already be shared with you.
|
61
|
+
#
|
62
|
+
# @param property_use_id [Integer]
|
63
|
+
# @param property_use [PortfolioManager::Xml::PropertyUse]
|
64
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
65
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
66
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
67
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/propertyUse/propertyUse/put
|
68
|
+
def edit_property_use(property_use_id, property_use)
|
69
|
+
request(Net::HTTP::Put, path_for("propertyUse", property_use_id), {}, {}, property_use, "propertyUse", PortfolioManager::Xml::ResponseType, basic_auth: true)
|
70
|
+
end
|
71
|
+
|
72
|
+
# Get ID Hierarchy for Property Use
|
73
|
+
#
|
74
|
+
# This web service returns the accountId and propertyId that
|
75
|
+
# corresponds to a specific property use. The accountId returned is
|
76
|
+
# the Property Data Administrator (PDA). The corresponding property
|
77
|
+
# must already be shared with you or you must have pending share
|
78
|
+
# access.
|
79
|
+
#
|
80
|
+
# @param property_use_id [Integer]
|
81
|
+
# @return [PortfolioManager::Xml::HierarchyType, PortfolioManager::Xml::ResponseType]
|
82
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
83
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
84
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/propertyUse/hierarchy/get
|
85
|
+
def get_id_hierarchy_for_property_use(property_use_id)
|
86
|
+
request(Net::HTTP::Get, path_for("idHierarchy", "propertyUse", property_use_id), {}, {}, nil, nil, PortfolioManager::Xml::HierarchyType, basic_auth: true)
|
87
|
+
end
|
88
|
+
|
89
|
+
# Get Property Use
|
90
|
+
#
|
91
|
+
# This web service returns information for a specific property use.
|
92
|
+
# The information includes general data about the property use itself
|
93
|
+
# and its most current operating characteristics information. If the
|
94
|
+
# "value" XML tag is not present, then no value was initially provided
|
95
|
+
# for that operating characteristic. The corresponding property must
|
96
|
+
# already be shared with you.
|
97
|
+
#
|
98
|
+
# @param property_use_id [Integer]
|
99
|
+
# @param klass [nil, Class]
|
100
|
+
# @return [PortfolioManager::Xml::BankBranchType, PortfolioManager::Xml::BarracksType, PortfolioManager::Xml::CollegeUniversityType, PortfolioManager::Xml::ConvenienceStoreWithGasStationType, PortfolioManager::Xml::ConvenienceStoreWithoutGasStationType, PortfolioManager::Xml::CourthouseType, PortfolioManager::Xml::DataCenterType, PortfolioManager::Xml::DistributionCenterType, PortfolioManager::Xml::DrinkingWaterTreatmentAndDistributionType, PortfolioManager::Xml::FinancialOfficeType, PortfolioManager::Xml::FoodSalesType, PortfolioManager::Xml::HospitalType, PortfolioManager::Xml::HotelType, PortfolioManager::Xml::IceCurlingRinkType, PortfolioManager::Xml::IndoorArenaType, PortfolioManager::Xml::K12SchoolType, PortfolioManager::Xml::MedicalOfficeType, PortfolioManager::Xml::MultifamilyHousingType, PortfolioManager::Xml::NonRefrigeratedWarehouseType, PortfolioManager::Xml::OfficeType, PortfolioManager::Xml::OtherStadiumType, PortfolioManager::Xml::ParkingType, PortfolioManager::Xml::RefrigeratedWarehouseType, PortfolioManager::Xml::ResidenceHallDormitoryType, PortfolioManager::Xml::ResidentialCareFacilityType, PortfolioManager::Xml::RetailType, PortfolioManager::Xml::SelfStorageFacilityType, PortfolioManager::Xml::SeniorLivingCommunityType, PortfolioManager::Xml::SingleFamilyHomeType, PortfolioManager::Xml::StadiumClosedType, PortfolioManager::Xml::StadiumOpenType, PortfolioManager::Xml::SupermarketType, PortfolioManager::Xml::SwimmingPoolType, PortfolioManager::Xml::WastewaterTreatmentPlantType, PortfolioManager::Xml::WholesaleClubSupercenterType, PortfolioManager::Xml::WorshipFacilityType, PortfolioManager::Xml::ResponseType]
|
101
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
102
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
103
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/propertyUse/propertyUse/get
|
104
|
+
def get_property_use(property_use_id, klass = nil)
|
105
|
+
request(Net::HTTP::Get, path_for("propertyUse", property_use_id), {}, {}, nil, nil, klass, basic_auth: true)
|
106
|
+
end
|
107
|
+
|
108
|
+
# Get Property Use List
|
109
|
+
#
|
110
|
+
# This web service returns the list of property uses for a specific
|
111
|
+
# property. The property must already be shared with you.
|
112
|
+
#
|
113
|
+
# @param property_id [Integer]
|
114
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
115
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
116
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
117
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/propertyUse/propertyUseList/get
|
118
|
+
def get_property_use_list(property_id)
|
119
|
+
request(Net::HTTP::Get, path_for("property", property_id, "propertyUse", "list"), {}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
|
120
|
+
end
|
121
|
+
|
122
|
+
# Get What Changed Property Use List
|
123
|
+
#
|
124
|
+
# This web service returns a list of property uses that had their name
|
125
|
+
# or use details modified since a user specified date. The list of
|
126
|
+
# property uses returned are account specific. Results are returned in
|
127
|
+
# increments of 1,000 per set. The returned list only shows property
|
128
|
+
# uses that you have permission to view. Actions that trigger a
|
129
|
+
# property use to be included in the returned list may have been
|
130
|
+
# performed by any user with property use access. Changes that result
|
131
|
+
# in a property use being returned are as follows:
|
132
|
+
# - a use detail within the property use is corrected or updated with
|
133
|
+
# a new historical record
|
134
|
+
# - the name of the property use is edited
|
135
|
+
#
|
136
|
+
# @param customer_id [Integer]
|
137
|
+
# @param date [Date]
|
138
|
+
# @param next_page_key [nil, String]
|
139
|
+
# @param previous_page_key [nil, String]
|
140
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
141
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
142
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
143
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/propertyUse/getWhatChanged/get
|
144
|
+
def get_what_changed_property_use_list(customer_id, date, next_page_key = nil, previous_page_key = nil)
|
145
|
+
request(Net::HTTP::Get, path_for("customer", customer_id, "propertyUse", "whatChanged"), {
|
146
|
+
"date" => date.strftime("%Y-%m-%d"),
|
147
|
+
"nextPageKey" => next_page_key,
|
148
|
+
"previousPageKey" => previous_page_key,
|
149
|
+
}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
# Test Environment
|
154
|
+
module Test
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
# Use Details
|
159
|
+
module UseDetails
|
160
|
+
# Live Environment
|
161
|
+
module Live
|
162
|
+
# Edit Use Details
|
163
|
+
#
|
164
|
+
# This web service updates a specific set of use details based on the
|
165
|
+
# information provided in the XML request. The update is performed by
|
166
|
+
# creating a revision history. It returns the unique identifier to the
|
167
|
+
# use details and a link to the corresponding web service to retrieve
|
168
|
+
# it. To specify the use of default values, just omit the "value" XML
|
169
|
+
# tag for that particular use detail information from the XML request
|
170
|
+
# or omit the entire reference to the particular use detail
|
171
|
+
# information from the XML request altogether.
|
172
|
+
#
|
173
|
+
# @param property_use_id [Integer]
|
174
|
+
# @param use_detail [PortfolioManager::Xml::AmountOfLaundryProcessedAnnuallyType, PortfolioManager::Xml::ClearHeightUnitsType, PortfolioManager::Xml::CoolingEquipmentRedundancyType, PortfolioManager::Xml::GrossFloorAreaType, PortfolioManager::Xml::HoursPerDayGuestsOnsiteType, PortfolioManager::Xml::ItEnergyConfigurationType, PortfolioManager::Xml::LengthOfAllOpenClosedRefrigerationUnitsType, PortfolioManager::Xml::LinksType, PortfolioManager::Xml::MonthsInUseType, PortfolioManager::Xml::NumberOfWeekdaysType, PortfolioManager::Xml::NumberOfWeeklyIceResurfacingType, PortfolioManager::Xml::OnsiteLaundryType, PortfolioManager::Xml::OptionalFloorAreaType, PortfolioManager::Xml::OwnedByType, PortfolioManager::Xml::PercentCooledType, PortfolioManager::Xml::PercentHeatedType, PortfolioManager::Xml::PercentOfficeCooledType, PortfolioManager::Xml::PercentOfficeHeatedType, PortfolioManager::Xml::PlantDesignFlowRateType, PortfolioManager::Xml::PoolSizeType, PortfolioManager::Xml::PoolType, PortfolioManager::Xml::ResidentPopulationType, PortfolioManager::Xml::UpsSystemRedundancyType, PortfolioManager::Xml::UseDecimalType, PortfolioManager::Xml::UseIntegerType, PortfolioManager::Xml::UseStringType, PortfolioManager::Xml::UseYesNoType]
|
175
|
+
# @param elename [nil, String]
|
176
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
177
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
178
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
179
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/propertyUse/useDetails/post
|
180
|
+
def edit_use_details(property_use_id, use_detail, elename = nil)
|
181
|
+
request(Net::HTTP::Post, path_for("propertyUse", property_use_id, "useDetails"), {}, {}, use_detail, elename, PortfolioManager::Xml::ResponseType, basic_auth: true)
|
182
|
+
end
|
183
|
+
|
184
|
+
# Edit Use Details - Correction
|
185
|
+
#
|
186
|
+
# This web service updates a specific set of use details based on the
|
187
|
+
# information provided in the XML request. The update is performed as
|
188
|
+
# a correction. It returns the unique identifier to the use details
|
189
|
+
# and a link to the corresponding web service to retrieve it. The
|
190
|
+
# corresponding property must already be shared with you. To specify
|
191
|
+
# the use of default values, just omit the "value" XML tag for that
|
192
|
+
# particular use detail information from the XML request or omit the
|
193
|
+
# entire reference to the particular use detail information from the
|
194
|
+
# XML request altogether.
|
195
|
+
#
|
196
|
+
# @param use_detail_id [Integer]
|
197
|
+
# @param use_detail [PortfolioManager::Xml::AmountOfLaundryProcessedAnnuallyType, PortfolioManager::Xml::ClearHeightUnitsType, PortfolioManager::Xml::CoolingEquipmentRedundancyType, PortfolioManager::Xml::GrossFloorAreaType, PortfolioManager::Xml::HoursPerDayGuestsOnsiteType, PortfolioManager::Xml::ItEnergyConfigurationType, PortfolioManager::Xml::LengthOfAllOpenClosedRefrigerationUnitsType, PortfolioManager::Xml::LinksType, PortfolioManager::Xml::MonthsInUseType, PortfolioManager::Xml::NumberOfWeekdaysType, PortfolioManager::Xml::NumberOfWeeklyIceResurfacingType, PortfolioManager::Xml::OnsiteLaundryType, PortfolioManager::Xml::OptionalFloorAreaType, PortfolioManager::Xml::OwnedByType, PortfolioManager::Xml::PercentCooledType, PortfolioManager::Xml::PercentHeatedType, PortfolioManager::Xml::PercentOfficeCooledType, PortfolioManager::Xml::PercentOfficeHeatedType, PortfolioManager::Xml::PlantDesignFlowRateType, PortfolioManager::Xml::PoolSizeType, PortfolioManager::Xml::PoolType, PortfolioManager::Xml::ResidentPopulationType, PortfolioManager::Xml::UpsSystemRedundancyType, PortfolioManager::Xml::UseDecimalType, PortfolioManager::Xml::UseIntegerType, PortfolioManager::Xml::UseStringType, PortfolioManager::Xml::UseYesNoType]
|
198
|
+
# @param elename [nil, String]
|
199
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
200
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
201
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
202
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/propertyUse/useDetails/put
|
203
|
+
def edit_use_details_correction(use_detail_id, use_detail, elename = nil)
|
204
|
+
request(Net::HTTP::Put, path_for("useDetails", use_detail_id), {}, {}, use_detail, elename, PortfolioManager::Xml::ResponseType, basic_auth: true)
|
205
|
+
end
|
206
|
+
|
207
|
+
# Get ID Hierarchy for Use Detail
|
208
|
+
#
|
209
|
+
# This web service returns the accountId, propertyId, and
|
210
|
+
# propertyUseId that corresponds to a specific use detail record. The
|
211
|
+
# accountId returned is the Property Data Administrator (PDA). The
|
212
|
+
# corresponding property must already be shared with you or you must
|
213
|
+
# have pending share access.
|
214
|
+
#
|
215
|
+
# @param use_detail_id [Integer]
|
216
|
+
# @return [PortfolioManager::Xml::HierarchyType, PortfolioManager::Xml::ResponseType]
|
217
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
218
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
219
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/propertyUse/useDetailsHierarchy/get
|
220
|
+
def get_id_hierarchy_for_use_detail(use_detail_id)
|
221
|
+
request(Net::HTTP::Get, path_for("idHierarchy", "useDetails", use_detail_id), {}, {}, nil, nil, PortfolioManager::Xml::HierarchyType, basic_auth: true)
|
222
|
+
end
|
223
|
+
|
224
|
+
# Get Use Details
|
225
|
+
#
|
226
|
+
# This web service retrieves specific use detail information for a
|
227
|
+
# given use detail. The corresponding property must already be shared
|
228
|
+
# with you.
|
229
|
+
#
|
230
|
+
# @param use_detail_id [Integer]
|
231
|
+
# @param klass [nil, Class]
|
232
|
+
# @return [PortfolioManager::Xml::AmountOfLaundryProcessedAnnuallyType, PortfolioManager::Xml::ClearHeightUnitsType, PortfolioManager::Xml::CoolingEquipmentRedundancyType, PortfolioManager::Xml::GrossFloorAreaType, PortfolioManager::Xml::HoursPerDayGuestsOnsiteType, PortfolioManager::Xml::ItEnergyConfigurationType, PortfolioManager::Xml::LengthOfAllOpenClosedRefrigerationUnitsType, PortfolioManager::Xml::LinksType, PortfolioManager::Xml::MonthsInUseType, PortfolioManager::Xml::NumberOfWeekdaysType, PortfolioManager::Xml::NumberOfWeeklyIceResurfacingType, PortfolioManager::Xml::OnsiteLaundryType, PortfolioManager::Xml::OptionalFloorAreaType, PortfolioManager::Xml::OwnedByType, PortfolioManager::Xml::PercentCooledType, PortfolioManager::Xml::PercentHeatedType, PortfolioManager::Xml::PercentOfficeCooledType, PortfolioManager::Xml::PercentOfficeHeatedType, PortfolioManager::Xml::PlantDesignFlowRateType, PortfolioManager::Xml::PoolSizeType, PortfolioManager::Xml::PoolType, PortfolioManager::Xml::ResidentPopulationType, PortfolioManager::Xml::UpsSystemRedundancyType, PortfolioManager::Xml::UseDecimalType, PortfolioManager::Xml::UseIntegerType, PortfolioManager::Xml::UseStringType, PortfolioManager::Xml::UseYesNoType, PortfolioManager::Xml::ResponseType]
|
233
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
234
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
235
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/propertyUse/useDetails/get
|
236
|
+
def get_use_details(use_detail_id, klass = nil)
|
237
|
+
request(Net::HTTP::Get, path_for("useDetails", use_detail_id), {}, {}, nil, nil, klass, basic_auth: true)
|
238
|
+
end
|
239
|
+
|
240
|
+
# Get Use Details Revision History
|
241
|
+
#
|
242
|
+
# This web service retrieves the use details revision history for a
|
243
|
+
# specific property use. The corresponding property must be already
|
244
|
+
# shared with you.
|
245
|
+
#
|
246
|
+
# @param property_use_id [Integer]
|
247
|
+
# @param current_as_of_start [Date]
|
248
|
+
# @param current_as_of_end [Date]
|
249
|
+
# @return [PortfolioManager::Xml::UseDetails, PortfolioManager::Xml::ResponseType]
|
250
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
251
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
252
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/propertyUse/useDetailsRevisions/get
|
253
|
+
def get_use_details_revision_history(property_use_id, current_as_of_start, current_as_of_end)
|
254
|
+
request(Net::HTTP::Get, path_for("propertyUse", property_use_id, "useDetailsRevisions"), {
|
255
|
+
"currentAsOfStart" => current_as_of_start.strftime("%Y-%m-%d"),
|
256
|
+
"currentAsOfEnd" => current_as_of_end.strftime("%Y-%m-%d"),
|
257
|
+
}, {}, nil, nil, PortfolioManager::Xml::UseDetails, basic_auth: true)
|
258
|
+
end
|
259
|
+
|
260
|
+
# Get What Changed Property Use List (from use detail changes only)
|
261
|
+
#
|
262
|
+
# This web service returns a list of property uses that have had their
|
263
|
+
# use details changed since a user specified date. The list of
|
264
|
+
# property uses returned are account specific. Results are returned in
|
265
|
+
# increments of 1,000 per set. The returned list only shows property
|
266
|
+
# uses that you have permission to view. Actions that trigger a
|
267
|
+
# property use to be included in the returned list may have been
|
268
|
+
# performed by any user with permission to edit the property use
|
269
|
+
# details. A property use is displayed if it's corresponding use
|
270
|
+
# details are corrected, or updated with a new historical record.
|
271
|
+
#
|
272
|
+
# @param customer_id [Integer]
|
273
|
+
# @param date [Date]
|
274
|
+
# @return [PortfolioManager::Xml::ResponseType]
|
275
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
276
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
277
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/propertyUse/useDetailsGetWhatChanged/get
|
278
|
+
def get_what_changed_property_use_list_from_use_detail_changes_only(customer_id, date)
|
279
|
+
request(Net::HTTP::Get, path_for("customer", customer_id, "useDetails", "whatChanged"), {
|
280
|
+
"date" => date.strftime("%Y-%m-%d"),
|
281
|
+
}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
# Test Environment
|
286
|
+
module Test
|
287
|
+
end
|
288
|
+
end
|
289
|
+
|
290
|
+
# All Property Use Services
|
291
|
+
module All
|
292
|
+
# Live Environment
|
293
|
+
module Live
|
294
|
+
include PortfolioManager::Services::PropertyUse::PropertyUse::Live
|
295
|
+
include PortfolioManager::Services::PropertyUse::UseDetails::Live
|
296
|
+
end
|
297
|
+
|
298
|
+
# Test Environment
|
299
|
+
module Test
|
300
|
+
include PortfolioManager::Services::PropertyUse::PropertyUse::Test
|
301
|
+
include PortfolioManager::Services::PropertyUse::UseDetails::Test
|
302
|
+
end
|
303
|
+
end
|
304
|
+
end
|
305
|
+
end
|
306
|
+
end
|
@@ -0,0 +1,208 @@
|
|
1
|
+
require "net/http"
|
2
|
+
|
3
|
+
module PortfolioManager
|
4
|
+
module Services
|
5
|
+
# Reporting Services
|
6
|
+
#
|
7
|
+
# The Reporting Services allows you to retrieve metrics for your properties.
|
8
|
+
#
|
9
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting
|
10
|
+
module Reporting
|
11
|
+
# Reporting
|
12
|
+
module Reporting
|
13
|
+
# Live Environment
|
14
|
+
module Live
|
15
|
+
# Get Design Metrics
|
16
|
+
#
|
17
|
+
# This web service returns a list of metric values for a specific
|
18
|
+
# property design based on a specified measurement system. If the
|
19
|
+
# property contains operational data then an additional set of metric
|
20
|
+
# values based on the property's current period ending date is also
|
21
|
+
# returned. The property must already be shared with you. A full list
|
22
|
+
# of the reporting metrics that are available through this service and
|
23
|
+
# related web services can be found {https://downloads.energystar.gov/bi/portfolio-manager/Custom_Reporting_Metric_Inventory_en_US.xlsx here}.
|
24
|
+
# The list includes the metric name, the appropriate web service call
|
25
|
+
# for the metric, and a glossary link. It can be sorted and filtered
|
26
|
+
# for ease of finding the metrics that you need.
|
27
|
+
#
|
28
|
+
# @note Metrics that are readily available through other web services,
|
29
|
+
# such as {PortfolioManager::Services::Property::Design::Live#get_design GET /property/(propertyId)/design}
|
30
|
+
# are not included in the reporting web services, since they are
|
31
|
+
# already accessible elsewhere.
|
32
|
+
#
|
33
|
+
# @param property_id [Integer]
|
34
|
+
# @param measurement_system [nil, "EPA", "METRIC"]
|
35
|
+
# @return [PortfolioManager::Xml::PropertyMetricsType, PortfolioManager::Xml::ResponseType]
|
36
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
37
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
38
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/designMetrics/get
|
39
|
+
def get_design_metrics(property_id, measurement_system = nil)
|
40
|
+
request(Net::HTTP::Get, path_for("property", property_id, "design", "metrics"), {
|
41
|
+
"measurementSystem" => measurement_system,
|
42
|
+
}, {}, nil, nil, PortfolioManager::Xml::PropertyMetricsType, basic_auth: true)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Get Property Metrics
|
46
|
+
#
|
47
|
+
# This web service returns a list of metric values for a specific
|
48
|
+
# property and period ending date based on the specified set of
|
49
|
+
# metrics and measurement system. The property must already be shared
|
50
|
+
# with you. A full list of the reporting metrics that are available
|
51
|
+
# through this service and related web services can be found {https://downloads.energystar.gov/bi/portfolio-manager/Custom_Reporting_Metric_Inventory_en_US.xlsx here}.
|
52
|
+
# The list includes the metric name, the appropriate web service call
|
53
|
+
# for the metric, and a glossary link. It can be sorted and filtered
|
54
|
+
# for ease of finding the metrics that you need.
|
55
|
+
#
|
56
|
+
# @note Metrics that are readily available through other web services,
|
57
|
+
# such as {PortfolioManager::Services::Property::Property::Live#get_property GET /property/(propertyId)}
|
58
|
+
# and {PortfolioManager::Services::PropertyUse::PropertyUse::Live#get_property_use GET /propertyUse/(propertyUseId)}
|
59
|
+
# are not included in the reporting web services, since they are
|
60
|
+
# already accessible elsewhere.
|
61
|
+
#
|
62
|
+
# @param property_id [Integer]
|
63
|
+
# @param year [Integer]
|
64
|
+
# @param month [Integer]
|
65
|
+
# @param measurement_system [nil, "EPA", "METRIC"]
|
66
|
+
# @param metrics [Array<#to_s>]
|
67
|
+
# @return [PortfolioManager::Xml::PropertyMetricsType, PortfolioManager::Xml::ResponseType]
|
68
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
69
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
70
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/propertyMetrics/get
|
71
|
+
def get_property_metrics(property_id, year, month, measurement_system = nil, metrics = [])
|
72
|
+
request(Net::HTTP::Get, path_for("property", property_id, "metrics"), {
|
73
|
+
"year" => year,
|
74
|
+
"month" => month,
|
75
|
+
"measurementSystem" => measurement_system,
|
76
|
+
}, {
|
77
|
+
"PM-Metrics" => metrics.collect(&:to_s).join(","),
|
78
|
+
}, nil, nil, PortfolioManager::Xml::PropertyMetricsType, basic_auth: true)
|
79
|
+
end
|
80
|
+
|
81
|
+
# Get Property Monthly Metrics
|
82
|
+
#
|
83
|
+
# This web service returns a list of metric values for a specific
|
84
|
+
# property and period ending date based on the specified set of
|
85
|
+
# metrics and measurement system. Each monthly metric will return 12
|
86
|
+
# values (a value for each month). The months returned are all months
|
87
|
+
# captured within the specified annual period ending date. The metrics
|
88
|
+
# will reflect monthly totals of meters that you have access to.
|
89
|
+
#
|
90
|
+
# @param property_id [Integer]
|
91
|
+
# @param year [Integer]
|
92
|
+
# @param month [Integer]
|
93
|
+
# @param measurement_system [nil, "EPA", "METRIC"]
|
94
|
+
# @param metrics [Array<#to_s>]
|
95
|
+
# @return [PortfolioManager::Xml::PropertyMetricsType, PortfolioManager::Xml::ResponseType]
|
96
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
97
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
98
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/propertyMetricsMonthly/get
|
99
|
+
def get_property_monthly_metrics(property_id, year, month, measurement_system = nil, metrics = [])
|
100
|
+
request(Net::HTTP::Get, path_for("property", property_id, "metrics", "monthly"), {
|
101
|
+
"year" => year,
|
102
|
+
"month" => month,
|
103
|
+
"measurementSystem" => measurement_system,
|
104
|
+
}, {
|
105
|
+
"PM-Metrics" => metrics.collect(&:to_s).join(","),
|
106
|
+
}, nil, nil, PortfolioManager::Xml::PropertyMetricsType, basic_auth: true)
|
107
|
+
end
|
108
|
+
|
109
|
+
# Get Property Use Metrics
|
110
|
+
#
|
111
|
+
# This web service returns a list of time-weighted use detail values
|
112
|
+
# for a specific property, period ending date, and measurement system.
|
113
|
+
# The property must already be shared with you. A full list of the
|
114
|
+
# reporting metrics that are available through this service and
|
115
|
+
# related web services can be found {https://downloads.energystar.gov/bi/portfolio-manager/Custom_Reporting_Metric_Inventory_en_US.xlsx here}.
|
116
|
+
# The list includes the metric name, the appropriate web service call
|
117
|
+
# for the metric, and a glossary link. It can be sorted and filtered
|
118
|
+
# for ease of finding the metrics that you need.
|
119
|
+
#
|
120
|
+
# @param property_id [Integer]
|
121
|
+
# @param year [Integer]
|
122
|
+
# @param month [Integer]
|
123
|
+
# @param measurement_system [nil, "EPA", "METRIC"]
|
124
|
+
# @return [PortfolioManager::Xml::PropertyMetricsType, PortfolioManager::Xml::ResponseType]
|
125
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
126
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
127
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/useDetailsMetrics/get
|
128
|
+
def get_property_use_metrics(property_id, year, month, measurement_system = nil)
|
129
|
+
request(Net::HTTP::Get, path_for("property", property_id, "useDetails", "metrics"), {
|
130
|
+
"year" => year,
|
131
|
+
"month" => month,
|
132
|
+
"measurementSystem" => measurement_system,
|
133
|
+
}, {}, nil, nil, PortfolioManager::Xml::PropertyMetricsType, basic_auth: true)
|
134
|
+
end
|
135
|
+
|
136
|
+
# Get Reasons for No Energy Score
|
137
|
+
#
|
138
|
+
# This web service returns a list of reasons that explain why the
|
139
|
+
# specific property cannot receive an ENERGY STAR score for a certain
|
140
|
+
# period ending date. If both the year and month are not provided then
|
141
|
+
# the property's current energy period ending date is used. Please
|
142
|
+
# refer to this {https://downloads.energystar.gov/bi/portfolio-manager/Alerts_Public_Reference_en_US.xlsx Alert Inventory}
|
143
|
+
# for a list of possible reasons you might see in the response. Refer
|
144
|
+
# specifically to the alerts that are denoted "yes" in the N/A
|
145
|
+
# Explanations column; these are the alerts that apply when a metric,
|
146
|
+
# like the ENERGY STAR score, cannot be computed.
|
147
|
+
#
|
148
|
+
# @param property_id [Integer]
|
149
|
+
# @param year [Integer]
|
150
|
+
# @param month [Integer]
|
151
|
+
# @return [PortfolioManager::Xml::AlertsType, PortfolioManager::Xml::ResponseType]
|
152
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
153
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
154
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/reasonsForNoScore/get
|
155
|
+
def get_reasons_for_no_energy_score(property_id, year, month)
|
156
|
+
request(Net::HTTP::Get, path_for("property", property_id, "reasonsForNoScore"), {
|
157
|
+
"year" => year,
|
158
|
+
"month" => month,
|
159
|
+
}, {}, nil, nil, PortfolioManager::Xml::AlertsType, basic_auth: true)
|
160
|
+
end
|
161
|
+
|
162
|
+
# Get Reasons for No Water Score
|
163
|
+
#
|
164
|
+
# This web service returns a list of reasons that explain why the
|
165
|
+
# specific property cannot receive an ENERGY STAR score for a certain
|
166
|
+
# period ending date. If both the year and month are not provided then
|
167
|
+
# the property's current water period ending date is used. Please
|
168
|
+
# refer to this {https://downloads.energystar.gov/bi/portfolio-manager/Alerts_Public_Reference_en_US.xlsx Alert Inventory}
|
169
|
+
# for a list of possible reasons you might see in the response. Refer
|
170
|
+
# specifically to the alerts that are denoted "yes" in the N/A
|
171
|
+
# Explanations column; these are the alerts that apply when a metric,
|
172
|
+
# like the ENERGY STAR score, cannot be computed.
|
173
|
+
#
|
174
|
+
# @param property_id [Integer]
|
175
|
+
# @param year [Integer]
|
176
|
+
# @param month [Integer]
|
177
|
+
# @return [PortfolioManager::Xml::AlertsType, PortfolioManager::Xml::ResponseType]
|
178
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
179
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
180
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/reporting/reasonsForNoWaterScore/get
|
181
|
+
def get_reasons_for_no_water_score(property_id, year, month)
|
182
|
+
request(Net::HTTP::Get, path_for("property", property_id, "reasonsForNoWaterScore"), {
|
183
|
+
"year" => year,
|
184
|
+
"month" => month,
|
185
|
+
}, {}, nil, nil, PortfolioManager::Xml::AlertsType, basic_auth: true)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
# Test Environment
|
190
|
+
module Test
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
# All Reporting Services
|
195
|
+
module All
|
196
|
+
# Live Environment
|
197
|
+
module Live
|
198
|
+
include PortfolioManager::Services::Reporting::Reporting::Live
|
199
|
+
end
|
200
|
+
|
201
|
+
# Test Environment
|
202
|
+
module Test
|
203
|
+
include PortfolioManager::Services::Reporting::Reporting::Test
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require "net/http"
|
2
|
+
|
3
|
+
module PortfolioManager
|
4
|
+
module Services
|
5
|
+
# Target Finder Services
|
6
|
+
#
|
7
|
+
# Target Finder Services allows you to retrieve the estimated annual energy
|
8
|
+
# consumption associated with specific property design characteristics, and
|
9
|
+
# an energy performance goal expressed as either an ENERGY STAR score or %
|
10
|
+
# Better than Median. Conversely, you may also retrieve the ENERGY STAR
|
11
|
+
# score and % Better than Median associated with the estimated annual energy
|
12
|
+
# consumption of a specific property design. These metrics allow you to
|
13
|
+
# estimate how much energy your property would need to consume annually to
|
14
|
+
# reach your design energy goal, or conversely, determine the ENERGY STAR
|
15
|
+
# score that would be associated with your design estimated energy
|
16
|
+
# consumption. Target Finder Services does require user authentication but
|
17
|
+
# the property design information that you submit will not be saved for
|
18
|
+
# later reference. Your results can be returned in the set of units that you
|
19
|
+
# specify.
|
20
|
+
#
|
21
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/targetFinder
|
22
|
+
module TargetFinder
|
23
|
+
# Target Finder
|
24
|
+
module TargetFinder
|
25
|
+
# Live Environment
|
26
|
+
module Live
|
27
|
+
# Target Finder
|
28
|
+
#
|
29
|
+
# This web service allows you to retrieve the estimated annual energy
|
30
|
+
# consumption associated with specific property design
|
31
|
+
# characteristics, and an energy performance goal expressed as either
|
32
|
+
# an ENERGY STAR score or % Better than Median. Conversely, you may
|
33
|
+
# also retrieve the ENERGY STAR score and % Better than Median
|
34
|
+
# associated with the estimated annual energy consumption of a
|
35
|
+
# specific property design. These metrics allow you to estimate how
|
36
|
+
# much energy your property would need to consume annually to reach
|
37
|
+
# your design energy goal, or conversely, determine the ENERGY STAR
|
38
|
+
# score that would be associated with your design estimated energy
|
39
|
+
# consumption. Target Finder Services does require user authentication
|
40
|
+
# but the property design information that you submit will not be
|
41
|
+
# saved for later reference. Your results can be returned in the set
|
42
|
+
# of units that you specify.
|
43
|
+
#
|
44
|
+
# @param target_finder [PortfolioManager::Xml::UnAuthDesignType]
|
45
|
+
# @param measurement_system ["EPA", "METRIC"]
|
46
|
+
# @return [PortfolioManager::Xml::PropertyMetricsList, PortfolioManager::Xml::ResponseType]
|
47
|
+
# @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
|
48
|
+
# @raise [PortfolioManager::HTTPResponseError]
|
49
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api/targetFinder/targetFinder/post
|
50
|
+
def target_finder(target_finder, measurement_system = "EPA")
|
51
|
+
request(Net::HTTP::Get, path_for("targetFinder"), {
|
52
|
+
"measurementSystem" => measurement_system,
|
53
|
+
}, {}, target_finder, "targetFinder", PortfolioManager::Xml::PropertyMetricsList, basic_auth: true)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Test Environment
|
58
|
+
module Test
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# All Target Finder Services
|
63
|
+
module All
|
64
|
+
# Live Environment
|
65
|
+
module Live
|
66
|
+
include PortfolioManager::Services::TargetFinder::TargetFinder::Live
|
67
|
+
end
|
68
|
+
|
69
|
+
# Test Environment
|
70
|
+
module Test
|
71
|
+
include PortfolioManager::Services::TargetFinder::TargetFinder::Test
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module PortfolioManager
|
2
|
+
# Web Services
|
3
|
+
#
|
4
|
+
# For your convenience, EPA has organized web services into the following
|
5
|
+
# major categories. Click on each category to view the list of web services
|
6
|
+
# and their corresponding XML schemas. If you want to download all the
|
7
|
+
# schemas, please click {https://portfoliomanager.energystar.gov/schema/18.0/portfoliomanager-schemas-18.0.zip here}.
|
8
|
+
#
|
9
|
+
# @see https://portfoliomanager.energystar.gov/webservices/home/api
|
10
|
+
module Services
|
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 :Meter, "portfolio_manager/services/meter"
|
16
|
+
autoload :Property, "portfolio_manager/services/property"
|
17
|
+
autoload :PropertyUse, "portfolio_manager/services/property_use"
|
18
|
+
autoload :Reporting, "portfolio_manager/services/reporting"
|
19
|
+
autoload :TargetFinder, "portfolio_manager/services/target_finder"
|
20
|
+
end
|
21
|
+
end
|