portfolio_manager 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 177b5b07384c5f9c24b5cb9ef69cb1517af02f1f76d9af1cc74eab9654dfe477
4
- data.tar.gz: 87ae59aa73df92530ae4c6ea1feb139a4e8b964c6a6ca3ad39fc6249cf3acd9f
3
+ metadata.gz: c11e10b4cc1d39ef7786f32cb008592026541cf755281d8cbdccf24158c7241d
4
+ data.tar.gz: 9e85f566088fcd0ef283e4d11a6fbea65c1c15c7ecb705ff7b55cbf0a13e1978
5
5
  SHA512:
6
- metadata.gz: a85026346412c4a627b41518f0b7967e113f7f6679738ff153e8953b3a1c5da587f499c4a5b635d867121d0f0fffc6e0fe9bcbdcf6f5700caf184234da16381d
7
- data.tar.gz: 4ccfa27318accc589869fe8676f749c64a8a59e02f29cf02cb7a5f5e77622c3decb5faf4d3b14721ded9013481a7003a44e2afa49204fdcf96da17f263b66634
6
+ metadata.gz: 174a443420fd097fb6df1aebd5cf6468795619c5afc2f4ebc0bb4e00517490c152d2297d38ff7bac8810a8b15b42b90e5cf1717b6b6522790ab6662e8b7e14bf
7
+ data.tar.gz: 8201b5eb4197ed16def24025a4e5d13599ba46c89234f7ba47911fd6e2e92b08d06c6dbc2808280f931eb51a063d49ac52fdbe3bb3f5f5edb4ca29035bffab62
data/README.md CHANGED
@@ -66,7 +66,14 @@ HTTP | Path | Method | Description
66
66
  ---- | ---- | ------ | -----------
67
67
  GET | /meter/(meterId) | `meter(meter_id)` | Returns information for a specified meter.
68
68
  GET | /property/(propertyId)/meter/list | `meter_list(property_id)` | Returns a list of meters for a specified property.
69
- GET | /meter/(meterId)/consumptionData?page=(page)&startDate=(YYYY-MM-DD)&endDate=(YYYY-MM-DD) | `metrics(property_id, year, month, measurement_system, metric)` | Returns the consumption data for a specified meter in sets of 20.
69
+ GET | /meter/(meterId)/consumptionData?page=(page)&startDate=(YYYY-MM-DD)&endDate=(YYYY-MM-DD) | `consumption_data(meter_id, page: nil, start_date: nil, end_date: nil)` | Returns the consumption data for a specified meter in sets of 120.
70
+
71
+ #### Reporting Services
72
+ https://portfoliomanager.energystar.gov/webservices/home/api/reporting
73
+
74
+ HTTP | Path | Method | Description
75
+ ---- | ---- | ------ | -----------
76
+ GET | /property/(propertyId)/metrics | `property_metrics(property_id, year, month, measurement_system, metric)` | Returns the values for a specified set of metrics and units for a specific property and period ending date. The property must already be shared with you.
70
77
 
71
78
  #### Connection/Share Services
72
79
  https://portfoliomanager.energystar.gov/webservices/home/api/connection
@@ -5,6 +5,7 @@ require 'portfolio_manager/rest/building'
5
5
  require 'portfolio_manager/rest/data_exchange_settings'
6
6
  require 'portfolio_manager/rest/meter'
7
7
  require 'portfolio_manager/rest/property'
8
+ require 'portfolio_manager/rest/reporting'
8
9
  require 'portfolio_manager/rest/customer'
9
10
  require 'portfolio_manager/rest/connection'
10
11
  require 'portfolio_manager/rest/share'
@@ -20,6 +21,7 @@ module PortfolioManager
20
21
  include PortfolioManager::REST::DataExchangeSettings
21
22
  include PortfolioManager::REST::Meter
22
23
  include PortfolioManager::REST::Property
24
+ include PortfolioManager::REST::Reporting
23
25
  include PortfolioManager::REST::Customer
24
26
  include PortfolioManager::REST::Connection
25
27
  include PortfolioManager::REST::Share
@@ -29,16 +29,18 @@ module PortfolioManager
29
29
  perform_get_request("/property/#{property_id}/meter/list")
30
30
  end
31
31
 
32
- def metrics(property_id, year, month, measurement_system, metric)
33
- perform_get_request(
34
- "/property/#{property_id}/metrics",
35
- query: {
36
- year: year, month: month, measurementSystem: measurement_system
37
- },
38
- header: {
39
- 'PM-Metrics' => metric
40
- }
41
- )
32
+ ##
33
+ # This web service retrieves a list of consumption data for a specific
34
+ # meter. The meter must already be shared with you.
35
+ #
36
+ # @see https://portfoliomanager.energystar.gov/webservices/home/api/meter/consumptionData/get
37
+ # page_link template:
38
+ # "/meter/#{meter_id}/consumptionData/?page=#{page}&startDate=#{start_date}&endDate=#{end_date}"
39
+ def consumption_data(meter_id, page: nil, start_date: nil, end_date: nil)
40
+ query_string = URI.encode_www_form({ page: page, startDate: start_date, endDate: end_date }.reject! {|k,v| v.nil?})
41
+ resource_path = "/meter/#{meter_id}/consumptionData"
42
+ link = query_string.empty? ? resource_path : "#{resource_path}?#{query_string}"
43
+ perform_get_request(link)
42
44
  end
43
45
  end
44
46
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'portfolio_manager/rest/utils'
4
+
5
+ module PortfolioManager
6
+ module REST
7
+ module Reporting
8
+ include PortfolioManager::REST::Utils
9
+
10
+ def property_metrics(property_id, year, month, measurement_system, metric)
11
+ perform_get_request(
12
+ "/property/#{property_id}/metrics",
13
+ query: {
14
+ year: year, month: month, measurementSystem: measurement_system
15
+ },
16
+ header: {
17
+ 'PM-Metrics' => metric
18
+ }
19
+ )
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'portfolio_manager/rest/request'
4
- require 'nokogiri'
5
4
 
6
5
  module PortfolioManager
7
6
  module REST
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PortfolioManager
4
- VERSION = '0.4.0'
4
+ VERSION = '0.5.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: portfolio_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Reed
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-14 00:00:00.000000000 Z
11
+ date: 2024-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -134,6 +134,7 @@ files:
134
134
  - lib/portfolio_manager/rest/data_exchange_settings.rb
135
135
  - lib/portfolio_manager/rest/meter.rb
136
136
  - lib/portfolio_manager/rest/property.rb
137
+ - lib/portfolio_manager/rest/reporting.rb
137
138
  - lib/portfolio_manager/rest/request.rb
138
139
  - lib/portfolio_manager/rest/share.rb
139
140
  - lib/portfolio_manager/rest/utils.rb