portfoliomanager-rb 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,6 +7,7 @@ module PortfolioManager
7
7
  include PortfolioManager::Services::BasicAccount::All::Live
8
8
  include PortfolioManager::Services::Building::All::Live
9
9
  include PortfolioManager::Services::Connection::All::Live
10
+ include PortfolioManager::Services::HomeEnergyYardstick::All::Live
10
11
  include PortfolioManager::Services::Meter::All::Live
11
12
  include PortfolioManager::Services::Property::All::Live
12
13
  include PortfolioManager::Services::PropertyUse::All::Live
@@ -14,11 +15,12 @@ module PortfolioManager
14
15
  include PortfolioManager::Services::TargetFinder::All::Live
15
16
  end
16
17
 
17
- # Test Environment
18
+ # Test Environment
18
19
  module Test
19
20
  include PortfolioManager::Services::BasicAccount::All::Test
20
21
  include PortfolioManager::Services::Building::All::Test
21
22
  include PortfolioManager::Services::Connection::All::Test
23
+ include PortfolioManager::Services::HomeEnergyYardstick::All::Test
22
24
  include PortfolioManager::Services::Meter::All::Test
23
25
  include PortfolioManager::Services::Property::All::Test
24
26
  include PortfolioManager::Services::PropertyUse::All::Test
@@ -0,0 +1,69 @@
1
+ require "net/http"
2
+
3
+ module PortfolioManager
4
+ module Services
5
+ # Home Energy Yardstick Services
6
+ #
7
+ # Home Energy Yardstick Services allows you to receive a simple assessment
8
+ # of your home's annual energy use compared to similar homes. By providing
9
+ # some information about your home, you can get your home's Home Energy
10
+ # Yardstick score (on a scale of 1 to 100), insights into how much of your
11
+ # home's energy use is related to heating and cooling versus other everyday
12
+ # uses like appliances, lighting, and hot water. You will also be able to
13
+ # receive an estimate of your home's annual carbon emissions. Home Energy
14
+ # Yardstick Services do require user authenication and the home information
15
+ # that you submit will not be saved for later reference.
16
+ #
17
+ # @see https://portfoliomanager.energystar.gov/webservices/home/api/hey
18
+ module HomeEnergyYardstick
19
+ # Home Energy Yardstick
20
+ module HomeEnergyYardstick
21
+ # Live Environment
22
+ module Live
23
+ # Home Energy Yardstick
24
+ #
25
+ # This web service returns a list of performance-based home assessment
26
+ # metrics for a specified home's design characteristics and energy
27
+ # use. Home Energy Yardstick Service does require user authentication
28
+ # but the home design information that you submit will not be saved
29
+ # for later reference.
30
+ #
31
+ # The following meter types are only allowed:
32
+ # - Coal Bituminous
33
+ # - Electric
34
+ # - Fuel Oil No 2
35
+ # - Kerosene
36
+ # - Natural Gas
37
+ # - Propane
38
+ # - Wood
39
+ #
40
+ # @param hey [PortfolioManager::Xml::HeyType]
41
+ # @return [PortfolioManager::Xml::PropertyMetricsType]
42
+ # @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
43
+ # @raise [PortfolioManager::HTTPResponseError]
44
+ # @see https://portfoliomanager.energystar.gov/webservices/home/api/hey/hey/post
45
+ def home_energy_yardstick(hey)
46
+ request(Net::HTTP::Post, path_for("hey"), {}, {}, hey, "hey", PortfolioManager::Xml::PropertyMetricsType, basic_auth: true)
47
+ end
48
+ end
49
+
50
+ # Test Environment
51
+ module Test
52
+ end
53
+ end
54
+
55
+ # Home Energy Yardstick Services
56
+ module All
57
+ # Live Environment
58
+ module Live
59
+ include PortfolioManager::Services::HomeEnergyYardstick::HomeEnergyYardstick::Live
60
+ end
61
+
62
+ # Test Environment
63
+ module Test
64
+ include PortfolioManager::Services::HomeEnergyYardstick::HomeEnergyYardstick::Test
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -143,6 +143,29 @@ module PortfolioManager
143
143
 
144
144
  # Test Environment
145
145
  module Test
146
+ # Add Sample Properties
147
+ #
148
+ # This web service creates a set of sample properties in your account
149
+ # from the pool of sample properties defined by EPA and NRCan
150
+ # respectively. The actual number of properties created may differ
151
+ # from the count that you specify due to a sample property containing
152
+ # child properties that will also be created. This web service is only
153
+ # available within the Test environment. You can only create a maximum
154
+ # of 100 sample properties per request and no more than 1000
155
+ # properties may exist in your account to invoke this service.
156
+ #
157
+ # @param country_code [nil, "US", "CA"]
158
+ # @param create_count [nil, Integer]
159
+ # @return [PortfolioManager::Xml::ResponseType]
160
+ # @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
161
+ # @raise [PortfolioManager::HTTPResponseError]
162
+ # @see https://portfoliomanager.energystar.gov/webservices/home/test/api/property/sample-testing/post
163
+ def create_sample_properties(country_code = nil, create_count = nil)
164
+ request(Net::HTTP::Post, path_for("createSampleProperties"), {
165
+ "countryCode" => country_code,
166
+ "createCount" => create_count,
167
+ }, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
168
+ end
146
169
  end
147
170
  end
148
171
 
@@ -26,7 +26,7 @@ module PortfolioManager
26
26
  # request altogether.
27
27
  #
28
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]
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::EvChargingStationType, PortfolioManager::Xml::FinancialOfficeType, PortfolioManager::Xml::FoodSalesType, PortfolioManager::Xml::HospitalType, PortfolioManager::Xml::HotelType, PortfolioManager::Xml::IceCurlingRinkType, PortfolioManager::Xml::IndoorArenaType, PortfolioManager::Xml::K12SchoolType, PortfolioManager::Xml::MailingCenterPostOfficeType, PortfolioManager::Xml::MedicalOfficeType, PortfolioManager::Xml::MultifamilyHousingType, PortfolioManager::Xml::NonRefrigeratedWarehouseType, PortfolioManager::Xml::OfficeType, PortfolioManager::Xml::OtherStadiumType, PortfolioManager::Xml::OtherType, 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::VehicleDealershipType, PortfolioManager::Xml::WastewaterTreatmentPlantType, PortfolioManager::Xml::WholesaleClubSupercenterType, PortfolioManager::Xml::WorshipFacilityType]
30
30
  # @param elename [nil, String]
31
31
  # @return [PortfolioManager::Xml::ResponseType]
32
32
  # @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
@@ -97,7 +97,7 @@ module PortfolioManager
97
97
  #
98
98
  # @param property_use_id [Integer]
99
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]
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::EvChargingStationType, PortfolioManager::Xml::FinancialOfficeType, PortfolioManager::Xml::FoodSalesType, PortfolioManager::Xml::HospitalType, PortfolioManager::Xml::HotelType, PortfolioManager::Xml::IceCurlingRinkType, PortfolioManager::Xml::IndoorArenaType, PortfolioManager::Xml::K12SchoolType, PortfolioManager::Xml::MailingCenterPostOfficeType, PortfolioManager::Xml::MedicalOfficeType, PortfolioManager::Xml::MultifamilyHousingType, PortfolioManager::Xml::NonRefrigeratedWarehouseType, PortfolioManager::Xml::OfficeType, PortfolioManager::Xml::OtherStadiumType, PortfolioManager::Xml::OtherType, 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::VehicleDealershipType, PortfolioManager::Xml::WastewaterTreatmentPlantType, PortfolioManager::Xml::WholesaleClubSupercenterType, PortfolioManager::Xml::WorshipFacilityType, PortfolioManager::Xml::ResponseType]
101
101
  # @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
102
102
  # @raise [PortfolioManager::HTTPResponseError]
103
103
  # @see https://portfoliomanager.energystar.gov/webservices/home/api/propertyUse/propertyUse/get
@@ -287,18 +287,140 @@ module PortfolioManager
287
287
  end
288
288
  end
289
289
 
290
+ # Custom Property Use and Use Details
291
+ module CustomPropertyUseAndUseDetails
292
+ # Live Environment
293
+ module Live
294
+ # Get Custom Property Use
295
+ #
296
+ # This web service returns the custom use detail information for a
297
+ # given property. If at least one custom use detail has not been
298
+ # defined then a 404 is returned. To create a new custom use detail,
299
+ # please {https://portfoliomanager.energystar.gov/webservices/home/api/propertyUse/customUseDetails/post see}. The information includes general data about the custom
300
+ # property use itself and its most current custom characteristics
301
+ # information. The corresponding property must already be shared to
302
+ # you.
303
+ #
304
+ # @param property_id [Integer]
305
+ # @return [PortfolioManager::Xml::CustomUseType]
306
+ # @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
307
+ # @raise [PortfolioManager::HTTPResponseError]
308
+ # @see https://portfoliomanager.energystar.gov/webservices/home/api/propertyUse/customUse/get
309
+ def get_custom_property_use(property_id)
310
+ request(Net::HTTP::Get, path_for("customUse", property_id), {}, {}, nil, nil, PortfolioManager::Xml::CustomUseType, basic_auth: true)
311
+ end
312
+
313
+ # Get Custom Use Details Revision History
314
+ #
315
+ # This web service retrieves the custom use details revision history
316
+ # for a specific property. The corresponding property must be already
317
+ # shared to you.
318
+ #
319
+ # @param property_id [Integer]
320
+ # @param current_as_of_start [Date]
321
+ # @param current_as_of_end [Date]
322
+ # @return [PortfolioManager::Xml::UseDetails]
323
+ # @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
324
+ # @raise [PortfolioManager::HTTPResponseError]
325
+ # @see https://portfoliomanager.energystar.gov/webservices/home/api/propertyUse/customUseDetailsRevisions/get
326
+ def get_custom_use_details_revision_history(property_id, current_as_of_start, current_as_of_end)
327
+ request(Net::HTTP::Get, path_for("customUse", property_id, "detailRevisions"), {
328
+ "currentAsOfStart" => current_as_of_start.strftime("%Y-%m-%d"),
329
+ "currentAsOfEnd" => current_as_of_end.strftime("%Y-%m-%d"),
330
+ }, {}, nil, nil, PortfolioManager::Xml::UseDetails, basic_auth: true)
331
+ end
332
+
333
+ # Edit Custom Use Detail - Revision
334
+ #
335
+ # This web service updates a specific custom use detail based on the
336
+ # information provided in the XML request. The update is performed by
337
+ # creating a revision history. It returns the unique identifier to the
338
+ # custom use detail and a link to the corresponding web service to
339
+ # retrieve it. The corresponding property must already be shared to
340
+ # you.
341
+ #
342
+ # A maximum of 2 custom use details can be created for a property. To
343
+ # learn more, please reference this {https://energystar.my.site.com/PortfolioManager/s/article/How-do-I-create-custom-use-details FAQ}.
344
+ #
345
+ # @param property_id [Integer]
346
+ # @param custom_use_details [PortfolioManager::Xml::CustomUseDetailsType]
347
+ # @param elename [nil, String]
348
+ # @return [PortfolioManager::Xml::ResponseType]
349
+ # @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
350
+ # @raise [PortfolioManager::HTTPResponseError]
351
+ # @see https://portfoliomanager.energystar.gov/webservices/home/api/propertyUse/customUseDetails/post
352
+ def edit_custom_use_detail_revision(property_id, custom_use_details, elename = nil)
353
+ request(Net::HTTP::Post, path_for("customUse", property_id, "details"), {}, {}, custom_use_details, elename, PortfolioManager::Xml::ResponseType, basic_auth: true)
354
+ end
355
+
356
+ # Get Custom Use Detail
357
+ #
358
+ # This web service retrieves specific use detail information for a
359
+ # given custom use detail. The corresponding property must already be
360
+ # shared with you.
361
+ #
362
+ # @param details_id [Integer]
363
+ # @return [PortfolioManager::Xml::CustomUseDetailsType]
364
+ # @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
365
+ # @raise [PortfolioManager::HTTPResponseError]
366
+ # @see https://portfoliomanager.energystar.gov/webservices/home/api/propertyUse/customUseDetails/get
367
+ def get_custom_use_detail(details_id)
368
+ request(Net::HTTP::Get, path_for("customUse", "details", details_id), {}, {}, nil, nil, PortfolioManager::Xml::CustomUseDetailsType, basic_auth: true)
369
+ end
370
+
371
+ # Edit Custom Use Details - Correction
372
+ #
373
+ # This web service updates a specific custom use detail based on the
374
+ # information provided in the XML request. The update is performed as
375
+ # a correction. It returns the unique identifier to the custom use
376
+ # detail and a link to the corresponding web service to retrieve it.
377
+ # The corresponding property must already be shared to you.
378
+ #
379
+ # @param details_id [Integer]
380
+ # @param custom_use_details [PortfolioManager::Xml::CustomUseDetailsType]
381
+ # @param elename [nil, String]
382
+ # @return [PortfolioManager::Xml::ResponseType]
383
+ # @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
384
+ # @raise [PortfolioManager::HTTPResponseError]
385
+ # @see https://portfoliomanager.energystar.gov/webservices/home/api/propertyUse/customUseDetails/put
386
+ def edit_custom_use_details_correction(details_id, custom_use_details, elename = nil)
387
+ request(Net::HTTP::Put, path_for("customUse", "details", details_id), {}, {}, custom_use_details, elename, PortfolioManager::Xml::ResponseType, basic_auth: true)
388
+ end
389
+
390
+ # Delete Custom Use Detail
391
+ #
392
+ # This web service deletes a specific custom use detail. The
393
+ # corresponding property must already be shared to you.
394
+ #
395
+ # @param details_id [Integer]
396
+ # @return [PortfolioManager::Xml::ResponseType]
397
+ # @raise [PortfolioManager::HTTPBasicCredentialsNotFoundError]
398
+ # @raise [PortfolioManager::HTTPResponseError]
399
+ # @see https://portfoliomanager.energystar.gov/webservices/home/api/propertyUse/customUseDetails/delete
400
+ def delete_custom_use_detail(details_id)
401
+ request(Net::HTTP::Delete, path_for("customUse", "details", detail_id), {}, {}, nil, nil, PortfolioManager::Xml::ResponseType, basic_auth: true)
402
+ end
403
+ end
404
+
405
+ # Test Environment
406
+ module Test
407
+ end
408
+ end
409
+
290
410
  # All Property Use Services
291
411
  module All
292
412
  # Live Environment
293
413
  module Live
294
414
  include PortfolioManager::Services::PropertyUse::PropertyUse::Live
295
415
  include PortfolioManager::Services::PropertyUse::UseDetails::Live
416
+ include PortfolioManager::Services::PropertyUse::CustomPropertyUseAndUseDetails::Live
296
417
  end
297
418
 
298
419
  # Test Environment
299
420
  module Test
300
421
  include PortfolioManager::Services::PropertyUse::PropertyUse::Test
301
422
  include PortfolioManager::Services::PropertyUse::UseDetails::Test
423
+ include PortfolioManager::Services::PropertyUse::CustomPropertyUseAndUseDetails::Test
302
424
  end
303
425
  end
304
426
  end