biscuit-monitor 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,8 +7,8 @@ module Biscuit
7
7
  class Cinr
8
8
  attr_accessor :level
9
9
 
10
- def initialize(level)
11
- @level = Integer(level)
10
+ def initialize(level=0)
11
+ @level = Integer(level || 0)
12
12
  end
13
13
 
14
14
  def message
@@ -13,7 +13,7 @@ module Biscuit
13
13
  begin
14
14
 
15
15
  ss = SignalStrength.new(@device_ip)
16
- ss.exec
16
+ @response = ss.exec
17
17
 
18
18
  message = ''
19
19
  message << ss.cinr
@@ -40,11 +40,13 @@ module Biscuit
40
40
 
41
41
  write "Cannot find the biscuit. Check your connection. Tail #{LOG_FILE} for details."
42
42
  LOGGER.error(err.inspect)
43
+ LOGGER.debug(@response.inspect)
43
44
 
44
45
  rescue StandardError => err
45
46
 
46
47
  write "There was an error talking to your biscuit. Tail #{LOG_FILE} for details."
47
48
  LOGGER.error(err.inspect)
49
+ LOGGER.debug(@response.inspect)
48
50
 
49
51
  ensure
50
52
 
@@ -7,8 +7,8 @@ module Biscuit
7
7
  class Rssi
8
8
  attr_accessor :level
9
9
 
10
- def initialize(level)
11
- @level = Integer(level)
10
+ def initialize(level=0)
11
+ @level = Integer(level || 0)
12
12
  end
13
13
 
14
14
  def message
@@ -35,7 +35,7 @@ module Biscuit
35
35
 
36
36
  def parse(document)
37
37
  data = {}
38
- hash = MultiJson.decode(document, symbolize_keys: true)
38
+ hash = raw_hash(document)
39
39
  hash.delete(:list)
40
40
  hash.each do |k, v|
41
41
  data[k] = if v.class == String && /^-?\d+$/ =~ v
@@ -57,6 +57,10 @@ module Biscuit
57
57
  data
58
58
  end
59
59
 
60
+ def raw_hash(document)
61
+ @raw ||= MultiJson.decode(document, symbolize_keys: true)
62
+ end
63
+
60
64
  def parse_javascript_to_json(document)
61
65
  document = document.downcase.split.join
62
66
  document.gsub!(/'/, '"')
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Biscuit
4
4
  module Monitor
5
- VERSION = "0.0.3"
5
+ VERSION = "0.0.4"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: biscuit-monitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -169,12 +169,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
169
169
  - - ! '>='
170
170
  - !ruby/object:Gem::Version
171
171
  version: '0'
172
+ segments:
173
+ - 0
174
+ hash: -3092619447487886151
172
175
  required_rubygems_version: !ruby/object:Gem::Requirement
173
176
  none: false
174
177
  requirements:
175
178
  - - ! '>='
176
179
  - !ruby/object:Gem::Version
177
180
  version: '0'
181
+ segments:
182
+ - 0
183
+ hash: -3092619447487886151
178
184
  requirements: []
179
185
  rubyforge_project:
180
186
  rubygems_version: 1.8.24