alpha_ess 1.2 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -1
- data/alpha_ess.gemspec +1 -1
- data/lib/alpha_ess.rb +13 -19
- metadata +1 -2
- data/alpha_ess-1.1.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c81cbe7a51a271d210972e96ba79ab88775e6a8021d822572072b056cc0c4b2a
|
4
|
+
data.tar.gz: 53cfca26ba154a13195698cf0068b926229f10080e496c9d91b08298b6cf9dc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b02e6738a07f151c35872be94e15c89a8f50031502d2ac3633eef728361ead1744c48af002f208e90c0215ede33014d9ab3133f2e5a36558b52c892a6ee1cc6a
|
7
|
+
data.tar.gz: 7013a66d7298c9a34b159026131ef02c993d8806dd32465ae950dea78b4f18318041e931af3238d4eb488b20617ea6f917c43d9ea1c002a46b00709d59769170
|
data/README.md
CHANGED
data/alpha_ess.gemspec
CHANGED
data/lib/alpha_ess.rb
CHANGED
@@ -26,26 +26,19 @@ class AlphaEss
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def get_last_power_data()
|
29
|
-
body = {
|
30
|
-
|
31
|
-
|
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
|
|
38
39
|
def get_stics_by_period(beginDay = Time.now.strftime("%Y-%m-%d"), endDay = Time.now.strftime("%Y-%m-%d"))
|
39
|
-
|
40
|
-
|
41
|
-
"endDay" => endDay,
|
42
|
-
"tday" => Time.now.strftime("%Y-%m-%d"),
|
43
|
-
"isOEM" => 0,
|
44
|
-
"SN" => @serial,
|
45
|
-
"noLoading" => true
|
46
|
-
}
|
47
|
-
url = "https://cloud.alphaess.com/api/Power/SticsByPeriod"
|
48
|
-
res = HTTParty.post(url, headers: header(), body: body.to_json)
|
40
|
+
url = "https://cloud.alphaess.com/api/Power/SticsByPeriod?beginDay=#{beginDay}&endDay=#{endDay}&tday=#{tday}&isOEM=0&SN=#{@serial}&noLoading=true"
|
41
|
+
res = HTTParty.get(url, headers: header())
|
49
42
|
res.parsed_response["data"]
|
50
43
|
end
|
51
44
|
|
@@ -102,10 +95,11 @@ class AlphaEss
|
|
102
95
|
"username" => @username,
|
103
96
|
"password" => @password
|
104
97
|
}
|
105
|
-
|
98
|
+
header = {
|
106
99
|
"Accept" => "application/json",
|
107
100
|
"Content-Type" => "application/json;charset=UTF-8"
|
108
|
-
}.update(secure_header_addon())
|
101
|
+
}.update(secure_header_addon())
|
102
|
+
res = HTTParty.post(url, headers: header, body: body.to_json)
|
109
103
|
@token = res.parsed_response["data"]["AccessToken"]
|
110
104
|
@token_valid_to = Time.now.to_i+36000
|
111
105
|
save_token()
|
@@ -115,7 +109,7 @@ class AlphaEss
|
|
115
109
|
# thanks to https://github.com/CharlesGillanders
|
116
110
|
t = Time.now.to_i
|
117
111
|
{
|
118
|
-
"authtimestamp" => t,
|
112
|
+
"authtimestamp" => t.to_s,
|
119
113
|
"authsignature" => "#{AUTHPREFIX}#{Digest::SHA2.new(512).hexdigest("#{AUTHCONSTANT}#{t}")}#{AUTHSUFFIX}"
|
120
114
|
}
|
121
115
|
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:
|
4
|
+
version: 1.2.2
|
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
|