alpha_ess 1.2 → 1.2.1

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: 3403efae3e758f4f8ef2593edc6bdf9d268a34367ff99ab93a78cc80d007828f
4
- data.tar.gz: 54233da976a52b1dd3c6a46cdcec89932398f9272eeedc54fc384714d27d3afc
3
+ metadata.gz: fed25ff583048344b8da4a15dcd92510abf9d69d5adec2e0da030bf23478ef35
4
+ data.tar.gz: b2cba2ad069290c82b1e4849ac4c1ce588c19abca72a62fcdf4458033e36f365
5
5
  SHA512:
6
- metadata.gz: 0d985dbad128c6b41adf906cf41d0dfe8ffcbf2fbf9ece3bfa83d20cca55bc4a8168d47daf8db80607bf52c750d2b14450dabc0a2a0a3c3248fa94001b96f0f3
7
- data.tar.gz: 92e0ae0059e060ac6ccb7a6546df84b57b246188b82192768a713c5d81a0a62639f49902f21be0a62a6b26aedb3ed533219c4cb7dd30b0a049a772b3b23fe9f3
6
+ metadata.gz: 86208124094f59312e88bf877c29b946da0fbc0b865a77e3d1948c110d832de8712b3a420d08e499bfc615ab38ab20c41d970825d1194efa01a0c29b22ae6cf5
7
+ data.tar.gz: cf071266cb4443e6f83918a0b936c5f6d269fb20d796578782b064d3d73b13b802ef19a5dad6bdab45edbf2ccea88e83f25488b644c45006abbcf89922d29a09
data/README.md CHANGED
@@ -112,7 +112,6 @@ puts "
112
112
  Batteriebezug / Ladung: #{data["pbat"]}
113
113
  Verbrauch: #{data["pbat"] + data["ppv1"].to_f + netz}
114
114
 
115
-
116
115
  "
117
116
  ```
118
117
 
data/alpha_ess.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'alpha_ess'
3
- spec.version = '1.2'
3
+ spec.version = '1.2.1'
4
4
  spec.date = '2022-10-31'
5
5
  spec.summary = "Alpha Ess API Calls"
6
6
  spec.description = "a Ruby class for Alpha-Ess-API-Calls"
data/lib/alpha_ess.rb CHANGED
@@ -26,12 +26,13 @@ class AlphaEss
26
26
  end
27
27
 
28
28
  def get_last_power_data()
29
- body = {
30
- "sys_sn" => @serial,
31
- "noLoading" => true
32
- }
33
- url = "https://cloud.alphaess.com/api/ESS/GetLastPowerDataBySN"
34
- res = HTTParty.post(url, headers: header(), body: body.to_json)
29
+ #body = {
30
+ # "sys_sn" => @serial,
31
+ # "noLoading" => true
32
+ #}
33
+ url = "https://cloud.alphaess.com/api/ESS/GetLastPowerDataBySN?sys_sn=#{@serial}&noLoading=true"
34
+ #res = HTTParty.post(url, headers: header(), body: body.to_json)
35
+ res = HTTParty.get(url, headers: header())
35
36
  res.parsed_response["data"]
36
37
  end
37
38
 
@@ -102,10 +103,11 @@ class AlphaEss
102
103
  "username" => @username,
103
104
  "password" => @password
104
105
  }
105
- res = HTTParty.post(url, headers: {
106
+ header = {
106
107
  "Accept" => "application/json",
107
108
  "Content-Type" => "application/json;charset=UTF-8"
108
- }.update(secure_header_addon()), body: body.to_json)
109
+ }.update(secure_header_addon())
110
+ res = HTTParty.post(url, headers: header, body: body.to_json)
109
111
  @token = res.parsed_response["data"]["AccessToken"]
110
112
  @token_valid_to = Time.now.to_i+36000
111
113
  save_token()
@@ -115,7 +117,7 @@ class AlphaEss
115
117
  # thanks to https://github.com/CharlesGillanders
116
118
  t = Time.now.to_i
117
119
  {
118
- "authtimestamp" => t,
120
+ "authtimestamp" => t.to_s,
119
121
  "authsignature" => "#{AUTHPREFIX}#{Digest::SHA2.new(512).hexdigest("#{AUTHCONSTANT}#{t}")}#{AUTHSUFFIX}"
120
122
  }
121
123
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alpha_ess
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.2'
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oliver Gaida
@@ -46,7 +46,6 @@ extra_rdoc_files: []
46
46
  files:
47
47
  - LICENSE.md
48
48
  - README.md
49
- - alpha_ess-1.1.gem
50
49
  - alpha_ess.gemspec
51
50
  - images/b965404834760626afe73785811995faa1629d2ab66a53f966443fbf22463a67.png
52
51
  - lib/alpha_ess.rb
data/alpha_ess-1.1.gem DELETED
Binary file