Class: Dovado::Router
- Inherits:
-
Object
- Object
- Dovado::Router
- Includes:
- Celluloid
- Defined in:
- lib/dovado/router.rb,
lib/dovado/router/sms.rb,
lib/dovado/router/info.rb,
lib/dovado/router/traffic.rb,
lib/dovado/router/internet.rb,
lib/dovado/router/services.rb,
lib/dovado/router/info/signal.rb,
lib/dovado/router/sms/message.rb,
lib/dovado/router/sms/messages.rb,
lib/dovado/router/info/operator.rb,
lib/dovado/router/traffic/amount.rb,
lib/dovado/router/info/operator/telia.rb
Overview
A Dovado Router.
Defined Under Namespace
Classes: Info, Internet, Services, Sms, Traffic
Instance Method Summary collapse
-
#info ⇒ Info
Fetch information from the router.
-
#initialize(args = nil) ⇒ Router
constructor
Create a new Router object representing an actual Dovado router on the local network.
-
#internet ⇒ Internet
Get the Internet Connection object.
-
#services ⇒ Services
Fetch services information from the router.
-
#sms ⇒ Sms
Fetch text messages from the router.
-
#traffic ⇒ Traffic
Get the Data Traffic object.
Constructor Details
#initialize(args = nil) ⇒ Router
Create a new Dovado::Router object representing an actual Dovado router on the local network.
The default router options are:
-
Address: 192.168.0.1
-
Port: 6435
-
User: admin
-
Password: password
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/dovado/router.rb', line 22 def initialize(args=nil) @address = '192.168.0.1' # Default address @port = 6435 @user = "admin" # Default username @password = "password" # Default password @connected = false unless args.nil? @address = args[:address] if args.has_key? :address @port = args[:port] if args.has_key? :port @user = args[:user] if args.has_key? :user @password = args[:password] if args.has_key? :password end supervise_client end |
Instance Method Details
#info ⇒ Info
Fetch information from the router.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/dovado/router.rb', line 84 def info Info.setup_supervision! client = Actor[:client] router_info = Actor[:router_info] router_info.update! unless router_info.valid? services router_info rescue ConnectionError => ex Actor[:client].terminate supervise_client supervise_info raise ex end |
#internet ⇒ Internet
Get the Internet Connection object.
66 67 68 69 |
# File 'lib/dovado/router.rb', line 66 def internet Internet.setup_supervision! Actor[:internet] end |
#services ⇒ Services
Fetch services information from the router.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/dovado/router.rb', line 42 def services Services.setup_supervision! client = Actor[:client] router_services = Actor[:router_services] router_services.update! unless router_services.valid? if router_services[:sms] == 'enabled' Sms.setup_supervision! sms.enabled = true end router_services rescue ConnectionError => ex Actor[:client].terminate supervise_client supervise_services raise ex end |
#sms ⇒ Sms
Fetch text messages from the router.
103 104 105 106 |
# File 'lib/dovado/router.rb', line 103 def sms Sms.supervise as: :sms, size: 1 unless Actor[:sms] Actor[:sms] end |
#traffic ⇒ Traffic
Get the Data Traffic object.
75 76 77 78 |
# File 'lib/dovado/router.rb', line 75 def traffic Traffic.setup_supervision! Actor[:traffic] end |