ondotori-ruby-client 1.1.0 → 1.2.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.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -1
- data/Gemfile +1 -1
- data/README.md +8 -0
- data/example/get_current_temp.rb +1 -3
- data/lib/ondotori/version.rb +1 -1
- data/lib/ondotori/webapi/api/errors.rb +3 -3
- data/lib/ondotori/webapi/api/params.rb +21 -0
- data/lib/ondotori/webapi/client.rb +5 -0
- data/lib/ondotori/webapi/httpwebaccess.rb +1 -3
- data/lib/ondotori/webapi/webaccess.rb +1 -1
- data/ondotori-ruby-client.gemspec +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e2b5691b375a55fc06352a122ce7a460bb8c3c2dc24762b426e42408e4cb4ce
|
4
|
+
data.tar.gz: 6c35ca3b21b11fb29a30ca4ce43baa38ec06ab08514b4cdc67391ff555c9d13b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5d1a863aa4f7eb4fcb5b7ed30b42177c47c37b959e8554dfbbfbd03a8610f598ac255897a03ee3f803579b6651b5460e3fc39b986864a94cf46f9d1bb2aa2e4
|
7
|
+
data.tar.gz: 545a1ff4496317c78eb4c520f8ded98dbe83ca4b7e62329a8dd4311fd08b8cc2d0f6846ba7c4f65429d49fd09dc065678ded5f50f7922c313b083c0cd84afc5d
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -93,6 +93,14 @@ response = client.data_rtr500(base: "BaseUnit Serial", remote: "Device Serial",
|
|
93
93
|
|
94
94
|
data_range parameter is optional.
|
95
95
|
|
96
|
+
#### Get Alert log
|
97
|
+
|
98
|
+
To get alert log, do the following.
|
99
|
+
|
100
|
+
```ruby
|
101
|
+
response = client.alert_log(base: "BaseUnit Serial", remote: "RemoteUnit Serial")
|
102
|
+
```
|
103
|
+
|
96
104
|
#### Error Handling
|
97
105
|
|
98
106
|
Ondotori Errors
|
data/example/get_current_temp.rb
CHANGED
@@ -22,9 +22,7 @@ def load_params
|
|
22
22
|
wss_access_info["login-pass"] = load_info["login-pass"]
|
23
23
|
return wss_access_info
|
24
24
|
end
|
25
|
-
rescue SystemCallError => e
|
26
|
-
puts %(class=[#{e.class}] message=[#{e.message}])
|
27
|
-
rescue IOError => e
|
25
|
+
rescue SystemCallError, IOError => e
|
28
26
|
puts %(class=[#{e.class}] message=[#{e.message}])
|
29
27
|
end
|
30
28
|
|
data/lib/ondotori/version.rb
CHANGED
@@ -8,7 +8,7 @@ module Ondotori
|
|
8
8
|
attr_reader :code
|
9
9
|
|
10
10
|
def initialize(message, code = nil)
|
11
|
-
super
|
11
|
+
super(message)
|
12
12
|
@code = code
|
13
13
|
end
|
14
14
|
end
|
@@ -17,7 +17,7 @@ module Ondotori
|
|
17
17
|
attr_reader :ratelimit
|
18
18
|
|
19
19
|
def initialize(message, code, ratelimit)
|
20
|
-
super
|
20
|
+
super(message, code)
|
21
21
|
@ratelimit = ratelimit
|
22
22
|
end
|
23
23
|
end
|
@@ -30,7 +30,7 @@ module Ondotori
|
|
30
30
|
attr_reader :detail
|
31
31
|
|
32
32
|
def initialize(message, detail, code = nil)
|
33
|
-
super
|
33
|
+
super(message, code)
|
34
34
|
@detail = detail
|
35
35
|
end
|
36
36
|
end
|
@@ -127,6 +127,27 @@ module Ondotori
|
|
127
127
|
params
|
128
128
|
end
|
129
129
|
end
|
130
|
+
|
131
|
+
class AlertLogParams < ParamsBase
|
132
|
+
def initialize(param, base: "", remote: "")
|
133
|
+
super(param)
|
134
|
+
if base.empty? || remote.empty?
|
135
|
+
raise Ondotori::WebAPI::Api::Errors::InvaildParameter.new(
|
136
|
+
"alert-log need both the baseunit serial and remote unit serial.", 9990
|
137
|
+
)
|
138
|
+
end
|
139
|
+
@base_serial = base
|
140
|
+
@remote_serial = remote
|
141
|
+
end
|
142
|
+
|
143
|
+
def to_ondotori_param
|
144
|
+
params = super
|
145
|
+
params["base-serial"] = @base_serial
|
146
|
+
params["remote-serial"] = @remote_serial
|
147
|
+
|
148
|
+
params
|
149
|
+
end
|
150
|
+
end
|
130
151
|
end
|
131
152
|
end
|
132
153
|
end
|
@@ -41,6 +41,11 @@ module Ondotori
|
|
41
41
|
access_server(param, "#{base_uri}data-rtr500")
|
42
42
|
end
|
43
43
|
|
44
|
+
def alert_log(base: "", remote: "")
|
45
|
+
param = Api::AlertLogParams.new(@param, base: base, remote: remote)
|
46
|
+
access_server(param, "#{base_uri}alert")
|
47
|
+
end
|
48
|
+
|
44
49
|
def base_uri
|
45
50
|
return @uri unless @uri.empty?
|
46
51
|
|
@@ -18,9 +18,7 @@ module Ondotori
|
|
18
18
|
|
19
19
|
response = http.request_post(web_uri.path, params.to_json, make_headers)
|
20
20
|
case response
|
21
|
-
when Net::HTTPSuccess
|
22
|
-
response
|
23
|
-
when Net::HTTPClientError, Net::HTTPServerError
|
21
|
+
when Net::HTTPSuccess, Net::HTTPClientError, Net::HTTPServerError
|
24
22
|
response
|
25
23
|
else
|
26
24
|
# response.value raises Exception...
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ondotori-ruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kazuya Hatano
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: You can use this gem to get the recorded data from T&D WebStorage Service
|
14
14
|
API.
|
@@ -50,6 +50,7 @@ metadata:
|
|
50
50
|
homepage_uri: https://github.com/k28/ondotori-ruby-client
|
51
51
|
source_code_uri: https://github.com/k28/ondotori-ruby-client
|
52
52
|
changelog_uri: https://github.com/k28/ondotori-ruby-client/blob/main/CHANGELOG.md
|
53
|
+
rubygems_mfa_required: 'true'
|
53
54
|
post_install_message:
|
54
55
|
rdoc_options: []
|
55
56
|
require_paths:
|
@@ -65,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
66
|
- !ruby/object:Gem::Version
|
66
67
|
version: '0'
|
67
68
|
requirements: []
|
68
|
-
rubygems_version: 3.0.3
|
69
|
+
rubygems_version: 3.0.3.1
|
69
70
|
signing_key:
|
70
71
|
specification_version: 4
|
71
72
|
summary: T&D WebStorage API Client
|