forest-client 0.0.8 → 0.0.9

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/forest-client.rb +27 -18
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90a20be4c22f75bed4993a231b0a15e45fca7591
4
- data.tar.gz: f5cfd6a1f9948f0825bd65a9bd35e8df3b12c82f
3
+ metadata.gz: 1c864fa62e0fe9a42fd6ed3eb8fce144da47eda6
4
+ data.tar.gz: f0b01c51c1ab4a063bb2340db11a0d7fbc48bfd8
5
5
  SHA512:
6
- metadata.gz: 5f1f587926f51400ae690347c0a0887bfaf9f3260916ae3a8913bf6dcab7fbecde067af13c781149149061961e5089c2ce776d7ce419872fd54fa1893f8b9fd7
7
- data.tar.gz: 1bc693424fe77dfe9401e97e0cdbe0e58ddf71ec4bebe86ed2f41c6875acded1fa9afccacd06ff0935f30b9fc7671873281925a7747c22fa70e3fb738eedcdd8
6
+ metadata.gz: 59eca8d3aa2e335a2d9f568371804069180ff6a24265eab7cfa3fedd9fa43ebecbf7bb95dcfe88c49cb266b5ab5f90c02b37ac96ab405711ee0d72a6c4f705c9
7
+ data.tar.gz: 5c9cd6596debe28fd14d55dc9f4cf0b35ea11f890f5676b26b61e6b6f20a65a5340cc9121597a51331c524dd6ab3b7f9f18fdd5315f5792e610c4f194f246691
data/lib/forest-client.rb CHANGED
@@ -56,26 +56,33 @@ module ForestClient
56
56
 
57
57
  trays = Array.new
58
58
 
59
- p.get_trays.each { |tray|
60
- trays.push({
61
- 'name' => tray[:name],
62
- 'xdim' => tray[:x],
63
- 'ydim' => tray[:y],
64
- 'capacity' => tray[:capacity]})
65
- }
59
+ t = p.get_trays
60
+ if t
61
+ t.each { |tray|
62
+ trays.push({
63
+ 'name' => tray[:name],
64
+ 'xdim' => tray[:x],
65
+ 'ydim' => tray[:y],
66
+ 'capacity' => tray[:capacity]
67
+ })
68
+ }
69
+ end
66
70
 
67
71
  url += '&trays=' + trays.to_s.gsub!('=>', ':')
68
72
 
69
73
  consumables = Array.new
70
74
 
71
- p.get_consumables.each { |cons|
72
- consumables.push({
73
- 'name' => cons[:name],
74
- 'level' => cons[:level],
75
- 'capacity' => cons[:capacity],
76
- 'percentage' => cons[:percentage]
77
- })
78
- }
75
+ c = p.get_consumables
76
+ if c
77
+ c.each { |cons|
78
+ consumables.push({
79
+ 'name' => cons[:name],
80
+ 'level' => cons[:level],
81
+ 'capacity' => cons[:capacity],
82
+ 'percentage' => cons[:percentage]
83
+ })
84
+ }
85
+ end
79
86
 
80
87
  url += '&consumables=' + consumables.to_s.gsub!('=>', ':')
81
88
 
@@ -94,9 +101,11 @@ module ForestClient
94
101
  forest = Forest.new(@org_id)
95
102
 
96
103
  printers = forest.get_printers
97
- printers.each do |printer|
98
- forest.update_printer(printer)
99
- forest.update_status(printer)
104
+ if printers
105
+ printers.each do |printer|
106
+ forest.update_printer(printer)
107
+ forest.update_status(printer)
108
+ end
100
109
  end
101
110
  end
102
111
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Burwell
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-11-15 00:00:00.000000000 Z
14
+ date: 2013-11-22 00:00:00.000000000 Z
15
15
  dependencies: []
16
16
  description: The LAN printer query agent for the Forest printer management system.
17
17
  email: printer.fungineers@gmail.com