senec 0.23.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@ module Senec
8
8
 
9
9
  CLIENT_ID = 'endcustomer-app-frontend'.freeze
10
10
  REDIRECT_URI = 'senec-app-auth://keycloak.prod'.freeze
11
- SCOPE = 'roles meinsenec'.freeze
11
+ SCOPE = 'roles profile meinsenec'.freeze
12
12
 
13
13
  SYSTEMS_HOST = 'https://senec-app-systems-proxy.prod.senec.dev'.freeze
14
14
  MEASUREMENTS_HOST = 'https://senec-app-measurements-proxy.prod.senec.dev'.freeze
@@ -57,23 +57,39 @@ module Senec
57
57
  end
58
58
 
59
59
  def systems
60
- get "#{SYSTEMS_HOST}/v1/systems"
60
+ get "#{SYSTEMS_HOST}/systems/api/v1"
61
61
  end
62
62
 
63
63
  def system_details(system_id)
64
- get "#{SYSTEMS_HOST}/systems/#{system_id}/details"
64
+ get "#{SYSTEMS_HOST}/systems/api/v1/#{system_id}/details"
65
65
  end
66
66
 
67
67
  def dashboard(system_id)
68
- get "#{MEASUREMENTS_HOST}/v1/systems/#{system_id}/dashboard"
68
+ get "#{MEASUREMENTS_HOST}/measurements/api/v1/systems/#{system_id}/dashboard"
69
69
  end
70
70
 
71
71
  def wallbox(system_id, wallbox_id)
72
- get "#{WALLBOX_HOST}/v1/systems/#{system_id}/wallboxes/#{wallbox_id}"
72
+ get "#{WALLBOX_HOST}/wallbox/api/v1/systems/#{system_id}/wallboxes/#{wallbox_id}"
73
73
  end
74
74
 
75
75
  def wallbox_search(system_id)
76
- post "#{WALLBOX_HOST}/v1/systems/wallboxes/search", { systemIds: [system_id] }
76
+ post "#{WALLBOX_HOST}/wallbox/api/v1/systems/wallboxes/search", { systemIds: [system_id] }
77
+ end
78
+
79
+ def measurements(system_id, resolution:, from:, to:)
80
+ params = URI.encode_www_form(
81
+ resolution:,
82
+ from: from.strftime('%Y-%m-%dT%H:%M:%SZ'),
83
+ to: to.strftime('%Y-%m-%dT%H:%M:%SZ'),
84
+ )
85
+
86
+ get "#{MEASUREMENTS_HOST}/measurements/api/v1/systems/#{system_id}/measurements?#{params}"
87
+ end
88
+
89
+ def data_availability(system_id, timezone:)
90
+ params = URI.encode_www_form(timezone:)
91
+
92
+ get "#{MEASUREMENTS_HOST}/measurements/api/v1/systems/#{system_id}/data-availability/timespan?#{params}"
77
93
  end
78
94
 
79
95
  private
@@ -213,10 +229,10 @@ module Senec
213
229
  response = oauth_token.get(url)
214
230
  JSON.parse(response.body)
215
231
  rescue StandardError => e
216
- # :nocov:
232
+ # simplecov:disable
217
233
  warn "API error: #{e.message}"
218
234
  nil
219
- # :nocov:
235
+ # simplecov:enable
220
236
  end
221
237
 
222
238
  def post(url, data)
@@ -230,10 +246,10 @@ module Senec
230
246
 
231
247
  JSON.parse(response.body)
232
248
  rescue StandardError => e
233
- # :nocov:
249
+ # simplecov:disable
234
250
  warn "API error: #{e.message}"
235
251
  nil
236
- # :nocov:
252
+ # simplecov:enable
237
253
  end
238
254
 
239
255
  def http_request(method, url, data: nil)
@@ -261,9 +277,9 @@ module Senec
261
277
  def openid_config
262
278
  @openid_config ||= JSON.parse(http_request(:get, CONFIG_URL).body)
263
279
  rescue StandardError => e
264
- # :nocov:
280
+ # simplecov:disable
265
281
  raise "Failed to load OpenID configuration: #{e.message}"
266
- # :nocov:
282
+ # simplecov:enable
267
283
  end
268
284
 
269
285
  def cookies
data/lib/senec/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Senec
2
- VERSION = '0.23.0'.freeze
2
+ VERSION = '0.24.0'.freeze
3
3
  end
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: senec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.0
4
+ version: 0.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Georg Ledermann
@@ -96,6 +96,7 @@ files:
96
96
  - ".ruby-lsp/.gitignore"
97
97
  - ".ruby-lsp/Gemfile"
98
98
  - ".ruby-lsp/Gemfile.lock"
99
+ - ".ruby-lsp/freshness_hash"
99
100
  - ".ruby-lsp/last_updated"
100
101
  - ".ruby-lsp/main_lockfile_hash"
101
102
  - ".vscode/settings.json"
@@ -104,6 +105,7 @@ files:
104
105
  - README.md
105
106
  - Rakefile
106
107
  - coverage/.last_run.json
108
+ - coverage/.report_stamp
107
109
  - coverage/.resultset.json
108
110
  - coverage/.resultset.json.lock
109
111
  - coverage/assets/0.13.2/DataTables-1.10.20/images/sort_asc.png
@@ -166,6 +168,7 @@ files:
166
168
  - pkg/senec-0.21.0.gem
167
169
  - pkg/senec-0.22.0.gem
168
170
  - pkg/senec-0.22.1.gem
171
+ - pkg/senec-0.23.0.gem
169
172
  - pkg/senec-0.3.0.gem
170
173
  - pkg/senec-0.4.0.gem
171
174
  - pkg/senec-0.5.0.gem
@@ -199,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
202
  - !ruby/object:Gem::Version
200
203
  version: '0'
201
204
  requirements: []
202
- rubygems_version: 4.0.7
205
+ rubygems_version: 4.0.19
203
206
  specification_version: 4
204
207
  summary: Unofficial Ruby Client for SENEC Home
205
208
  test_files: []