Class: Biscuit::Monitor::SignalStrength

Inherits:
Object
  • Object
show all
Defined in:
lib/biscuit-monitor/signal_strength.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(device_ip) ⇒ SignalStrength

Returns a new instance of SignalStrength.



11
12
13
# File 'lib/biscuit-monitor/signal_strength.rb', line 11

def initialize(device_ip)
  @device_ip = device_ip
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



9
10
11
# File 'lib/biscuit-monitor/signal_strength.rb', line 9

def response
  @response
end

Instance Method Details

#cinrObject



20
21
22
# File 'lib/biscuit-monitor/signal_strength.rb', line 20

def cinr
  Cinr.new(@response[:cinr]).message
end

#execObject



15
16
17
18
# File 'lib/biscuit-monitor/signal_strength.rb', line 15

def exec
  @response = parse(parse_javascript_to_json(Net::HTTP.get(device_uri)))[:data]
  @response.merge!(captured_on: Time.now.utc)
end

#rssiObject



24
25
26
# File 'lib/biscuit-monitor/signal_strength.rb', line 24

def rssi
  Rssi.new(@response[:rssi]).message
end