keenetic 0.1.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 +7 -0
- data/README.md +83 -0
- data/lib/keenetic/client.rb +361 -0
- data/lib/keenetic/configuration.rb +27 -0
- data/lib/keenetic/errors.rb +19 -0
- data/lib/keenetic/resources/base.rb +76 -0
- data/lib/keenetic/resources/devices.rb +309 -0
- data/lib/keenetic/resources/dhcp.rb +195 -0
- data/lib/keenetic/resources/internet.rb +169 -0
- data/lib/keenetic/resources/logs.rb +330 -0
- data/lib/keenetic/resources/network.rb +251 -0
- data/lib/keenetic/resources/policies.rb +171 -0
- data/lib/keenetic/resources/ports.rb +115 -0
- data/lib/keenetic/resources/routing.rb +200 -0
- data/lib/keenetic/resources/system.rb +267 -0
- data/lib/keenetic/resources/wifi.rb +376 -0
- data/lib/keenetic/version.rb +4 -0
- data/lib/keenetic.rb +99 -0
- metadata +89 -0
data/lib/keenetic.rb
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
require_relative 'keenetic/version'
|
|
2
|
+
require_relative 'keenetic/errors'
|
|
3
|
+
require_relative 'keenetic/configuration'
|
|
4
|
+
require_relative 'keenetic/client'
|
|
5
|
+
require_relative 'keenetic/resources/base'
|
|
6
|
+
require_relative 'keenetic/resources/devices'
|
|
7
|
+
require_relative 'keenetic/resources/system'
|
|
8
|
+
require_relative 'keenetic/resources/network'
|
|
9
|
+
require_relative 'keenetic/resources/wifi'
|
|
10
|
+
require_relative 'keenetic/resources/internet'
|
|
11
|
+
require_relative 'keenetic/resources/ports'
|
|
12
|
+
require_relative 'keenetic/resources/policies'
|
|
13
|
+
require_relative 'keenetic/resources/dhcp'
|
|
14
|
+
require_relative 'keenetic/resources/routing'
|
|
15
|
+
require_relative 'keenetic/resources/logs'
|
|
16
|
+
|
|
17
|
+
# Keenetic Router API Client
|
|
18
|
+
#
|
|
19
|
+
# A Ruby client for interacting with Keenetic router's REST API.
|
|
20
|
+
# Supports authentication, device management, system monitoring, and network interfaces.
|
|
21
|
+
#
|
|
22
|
+
# == Configuration
|
|
23
|
+
#
|
|
24
|
+
# Keenetic.configure do |config|
|
|
25
|
+
# config.host = '192.168.1.1'
|
|
26
|
+
# config.login = 'admin'
|
|
27
|
+
# config.password = 'your_password'
|
|
28
|
+
# config.timeout = 30 # optional, default: 30
|
|
29
|
+
# config.logger = Logger.new($stdout) # optional
|
|
30
|
+
# end
|
|
31
|
+
#
|
|
32
|
+
# == Usage
|
|
33
|
+
#
|
|
34
|
+
# client = Keenetic.client
|
|
35
|
+
#
|
|
36
|
+
# # Devices
|
|
37
|
+
# client.devices.all # List all devices
|
|
38
|
+
# client.devices.active # Only connected devices
|
|
39
|
+
# client.devices.find(mac: 'AA:BB:...') # Find by MAC
|
|
40
|
+
# client.devices.update(mac: 'AA:BB:...', name: 'My Phone')
|
|
41
|
+
#
|
|
42
|
+
# # System
|
|
43
|
+
# client.system.resources # CPU, memory, uptime
|
|
44
|
+
# client.system.info # Model, firmware version
|
|
45
|
+
#
|
|
46
|
+
# # Network
|
|
47
|
+
# client.network.interfaces # All network interfaces
|
|
48
|
+
#
|
|
49
|
+
# # WiFi
|
|
50
|
+
# client.wifi.access_points # WiFi networks
|
|
51
|
+
# client.wifi.clients # Connected WiFi clients
|
|
52
|
+
#
|
|
53
|
+
# # Internet
|
|
54
|
+
# client.internet.status # Internet connection status
|
|
55
|
+
# client.internet.speed # Current WAN speed stats
|
|
56
|
+
#
|
|
57
|
+
# # Ports
|
|
58
|
+
# client.ports.all # Physical port statuses
|
|
59
|
+
#
|
|
60
|
+
# == Error Handling
|
|
61
|
+
#
|
|
62
|
+
# begin
|
|
63
|
+
# client.devices.all
|
|
64
|
+
# rescue Keenetic::AuthenticationError => e
|
|
65
|
+
# # Invalid credentials
|
|
66
|
+
# rescue Keenetic::ConnectionError => e
|
|
67
|
+
# # Router unreachable
|
|
68
|
+
# rescue Keenetic::TimeoutError => e
|
|
69
|
+
# # Request timed out
|
|
70
|
+
# rescue Keenetic::NotFoundError => e
|
|
71
|
+
# # Resource not found
|
|
72
|
+
# rescue Keenetic::ApiError => e
|
|
73
|
+
# # Other API errors (e.status_code, e.response_body)
|
|
74
|
+
# end
|
|
75
|
+
#
|
|
76
|
+
module Keenetic
|
|
77
|
+
class << self
|
|
78
|
+
attr_writer :configuration
|
|
79
|
+
|
|
80
|
+
def configuration
|
|
81
|
+
@configuration ||= Configuration.new
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def configure
|
|
85
|
+
yield(configuration) if block_given?
|
|
86
|
+
configuration
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def reset_configuration!
|
|
90
|
+
@configuration = Configuration.new
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Convenience method to create a new client with current configuration
|
|
94
|
+
def client
|
|
95
|
+
Client.new(configuration)
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
metadata
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: keenetic
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Anton
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-02-01 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: logger
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: typhoeus
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '1.4'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '1.4'
|
|
41
|
+
description: A Ruby client for interacting with Keenetic router REST API. Supports
|
|
42
|
+
authentication, device management, system monitoring, and network interfaces.
|
|
43
|
+
email:
|
|
44
|
+
executables: []
|
|
45
|
+
extensions: []
|
|
46
|
+
extra_rdoc_files: []
|
|
47
|
+
files:
|
|
48
|
+
- README.md
|
|
49
|
+
- lib/keenetic.rb
|
|
50
|
+
- lib/keenetic/client.rb
|
|
51
|
+
- lib/keenetic/configuration.rb
|
|
52
|
+
- lib/keenetic/errors.rb
|
|
53
|
+
- lib/keenetic/resources/base.rb
|
|
54
|
+
- lib/keenetic/resources/devices.rb
|
|
55
|
+
- lib/keenetic/resources/dhcp.rb
|
|
56
|
+
- lib/keenetic/resources/internet.rb
|
|
57
|
+
- lib/keenetic/resources/logs.rb
|
|
58
|
+
- lib/keenetic/resources/network.rb
|
|
59
|
+
- lib/keenetic/resources/policies.rb
|
|
60
|
+
- lib/keenetic/resources/ports.rb
|
|
61
|
+
- lib/keenetic/resources/routing.rb
|
|
62
|
+
- lib/keenetic/resources/system.rb
|
|
63
|
+
- lib/keenetic/resources/wifi.rb
|
|
64
|
+
- lib/keenetic/version.rb
|
|
65
|
+
homepage: https://github.com/example/keenetic
|
|
66
|
+
licenses:
|
|
67
|
+
- MIT
|
|
68
|
+
metadata:
|
|
69
|
+
rubygems_mfa_required: 'true'
|
|
70
|
+
post_install_message:
|
|
71
|
+
rdoc_options: []
|
|
72
|
+
require_paths:
|
|
73
|
+
- lib
|
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
75
|
+
requirements:
|
|
76
|
+
- - ">="
|
|
77
|
+
- !ruby/object:Gem::Version
|
|
78
|
+
version: 3.0.0
|
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
|
+
requirements:
|
|
81
|
+
- - ">="
|
|
82
|
+
- !ruby/object:Gem::Version
|
|
83
|
+
version: '0'
|
|
84
|
+
requirements: []
|
|
85
|
+
rubygems_version: 3.5.16
|
|
86
|
+
signing_key:
|
|
87
|
+
specification_version: 4
|
|
88
|
+
summary: Ruby client for Keenetic router API
|
|
89
|
+
test_files: []
|