SNMPDevice 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0a348531172447e34751b9a23c3160752c6d73b
4
- data.tar.gz: 3e4bce513fffd6e23a80bc41ffaf2b22bc6647cd
3
+ metadata.gz: b15d73addd0c6eca5dcdddfd25e5ffc86e56b50a
4
+ data.tar.gz: 52114385cb7cc05d1e60f52d8f51ba83921d9095
5
5
  SHA512:
6
- metadata.gz: e635557861a7c774233cd4e13c02ede57d479010608264bc0dd30a0ca101b285f4a44ba75a086c4d89e9518842912f5b10b1a51bea9683f284d9cb7353ce7c4e
7
- data.tar.gz: 7eddc4050694c6b49aeb45a89ffac1cde9b9d3594ec9d1734d88fa85d80a55494dea054fd6d2ec4adf35d044df037b4d15545fbc90d04ff063e8b0a3f61a981a
6
+ metadata.gz: 79eb0c4b3ae1e5db0bdd799e58aa1b2baa782481fd5560ff0a4109283c28c7cc7def5336c324a88f02a2a571bee2469f052a918e2364aa53eaa95be167f73224
7
+ data.tar.gz: bf24728232ab2d5bbaa73335622bf96ff51010ccf9053ae2205dcd8faeb124dbaa23b9f296f49325ff0e6b7ceb9504663ede0949ef991cd159f72a67924b49ad
data/README.md CHANGED
@@ -22,7 +22,7 @@ Or install it yourself as:
22
22
  include SNMPDevice
23
23
 
24
24
  printer_a = Device.new('10.247.1.20')
25
- printer_a.load_config({'toner' => {:name_of_toner => '1.2.3.4.5.6.7.351.2', :toner_level => '1.2.3.4.5.6.7.351.3'}})
25
+ printer_a.set_config({'toner' => {:name_of_toner => '1.2.3.4.5.6.7.351.2', :toner_level => '1.2.3.4.5.6.7.351.3'}})
26
26
  printer_a.toner_info # => [["name_of_toner","toner_level"], ["Yellow", "50"], ["Cyan", "100"], ["Magenta". "10"], ["Black", "0"]]
27
27
 
28
28
  Depending on the values in the hash or YAML config, you can call something like `paper_info` or `toner_info`. It uses Ruby's `method_missing` function to define names dynamically depending on the configuration values. The results of a function such as `toner_info` can then be used as needed in other ways, such as turning to `JSON` and outputting to Javascript to create a web application capable of monitoring various devices.
@@ -18,7 +18,6 @@ module SNMPDevice
18
18
  private
19
19
  attr_accessor :snmp_object
20
20
  def method_missing(symbol, *args)
21
- require_config
22
21
  if symbol.id2name.end_with?('_info') and @config.has_key?(symbol.id2name.split('_info')[0])
23
22
  snmp_lookup(symbol.id2name.split('_info')[0])
24
23
  else
@@ -29,6 +28,7 @@ module SNMPDevice
29
28
  @snmp_object = SNMP::Manager.new(:host => ip_address)
30
29
  end
31
30
  def snmp_lookup(name)
31
+ require_config
32
32
  lookup_table = Array.new
33
33
  output = [[]]
34
34
  @config[name].each do |n|
@@ -1,3 +1,3 @@
1
1
  module SNMPDevice
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: SNMPDevice
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Smock