liebert 0.0.3 → 0.0.4

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: c85ef4549047d09be9ec6147c18c699619896cea
4
- data.tar.gz: b0843a4878d0410d7e7fbb0ed0a7487793668de1
3
+ metadata.gz: 566187043e7b30a0ed99717987cdaabfad6e4175
4
+ data.tar.gz: 0be4b98b94e71ba8a3fe07ba0882ea7ec04c2d4a
5
5
  SHA512:
6
- metadata.gz: 1da1ecc3585fc157594bae93f39fd8d0154d78ec7843891bb84c769a1bf678078e1cabda863a7fb7dc17c977838df1c589b2723d9d8a38ec1dc28843dec4732e
7
- data.tar.gz: 5a1ff453ad6af1bcda59570bdc6fb4b3bd17a31b485c694c6ce3d13819fd7f336b264c7133693facc07649a1f6b25a7679436361bb68060eb727c412914abd37
6
+ metadata.gz: f0f4b50d20a420e7e0188903a3ca28f9356434ab643136a04f3164acc8465a884e11b4777daccef6171241f00ddb83a241988c89fa6756335a3f337b1d62c6b2
7
+ data.tar.gz: 60722e7bb97c1d6dd8dff4498cb23fc28300673a05ee06541d3b29cbb533065b09c00ce244448c2e83099b6415e53947221adca31c2bbd69f2d0470101e65d9b
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ env:
5
+ global:
6
+ - secure: Rg4MmfZITTnriM36yOaIC5dskxIZbfIdQ6azaUrasPfIl3Llr5+YlZlFs4GHL7gn2BPPz6qBgnURXDP22Sc8KISighCIdHxunvFLt7TwvwlWYCuDvaUdOGpoZq+KZyUzrHfL6gPZetLZXs1AyzloNMifDozTh0mpjOINDplXSz0=
7
+ - secure: zrGsMmYX+bFA4xdC6uaNQd0IitZuf1q5gLcUUlB+YnnlMJ1e2Ry12tOa4OVy72ih0Q/wHGM/8Zg8SJl1frPuew43EqrYfC9ZuMegcosyEmYqS5jEUx5Xn7gxqhIWFadJq14rU5U0yp1mBnVLL8ugNquM7WRykB3mFtbBMWp5IP8=
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
1
  # Liebert
2
+ [![Build Status](https://travis-ci.org/bswinnerton/liebert.png)](https://travis-ci.org/bswinnerton/liebert)
3
+ [![Code Climate](https://codeclimate.com/github/bswinnerton/liebert.png)](https://codeclimate.com/github/bswinnerton/liebert)
2
4
 
3
5
  Liebert is a gem that allows you to gather metrics from [Liebert](http://www.emersonnetworkpower.com/en-US/Brands/liebert/Pages/default.aspx) based products and display them in a format digestable by [Ganglia](http://ganglia.sourceforge.net/).
4
6
 
@@ -22,12 +24,12 @@ To utilize this gem, simply set the URLs to your liebert products in environment
22
24
 
23
25
  AC Unit:
24
26
  ```
25
- export LIEBERT_AIRCONDITIONER_URI='http://liebertac.mydomain.com/graphic/env.htm'
27
+ export LIEBERT_AIRCONDITIONER_HOSTNAME='liebertac.mydomain.com'
26
28
  ```
27
29
 
28
30
  UPS Unit:
29
31
  ```
30
- export LIEBERT_UPS_URI='http://liebertups.mydomain.com/graphic/smallUps.htm'
32
+ export LIEBERT_UPS_HOSTNAME='liebertups.mydomain.com'
31
33
  ```
32
34
 
33
35
  And then you can run:
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/liebert CHANGED
@@ -2,9 +2,9 @@ require 'liebert'
2
2
 
3
3
  case ARGV[0]
4
4
  when 'ac'
5
- ac = AirConditioner.new(ENV['LIEBERT_AIRCONDITIONER_URI'])
5
+ ac = AirConditioner.new(ENV['LIEBERT_AIRCONDITIONER_HOSTNAME'])
6
6
  pass_arguments(ac)
7
7
  when 'ups'
8
- ups = UPS.new(ENV['LIEBERT_UPS_URI'])
8
+ ups = UPS.new(ENV['LIEBERT_UPS_HOSTNAME'])
9
9
  pass_arguments(ups)
10
10
  end
@@ -6,8 +6,8 @@ class AirConditioner
6
6
 
7
7
  include Scrapable
8
8
 
9
- def initialize(endpoint_uri = nil)
10
- @endpoint_uri = endpoint_uri
9
+ def initialize(hostname = nil)
10
+ @endpoint_uri = "http://#{hostname}/graphic/env.htm" unless hostname.nil?
11
11
  create_getters
12
12
  end
13
13
 
@@ -32,7 +32,7 @@ module Scrapable
32
32
  response = RestClient.get(self.endpoint_uri)
33
33
  @parsed_response = Nokogiri::HTML.parse(response.body)
34
34
  rescue
35
- raise "You forgot to set the URL to your Liebert unit. More information can be found here: https://github.com/bswinnerton/liebert/blob/master/README.md"
35
+ raise "You forgot to set the hostname to your Liebert unit. More information can be found here: https://github.com/bswinnerton/liebert/blob/master/README.md"
36
36
  end
37
37
  end
38
38
  @parsed_response
data/lib/liebert/ups.rb CHANGED
@@ -6,8 +6,8 @@ class UPS
6
6
 
7
7
  include Scrapable
8
8
 
9
- def initialize(endpoint_uri = nil)
10
- @endpoint_uri = endpoint_uri
9
+ def initialize(hostname = nil)
10
+ @endpoint_uri = "http://#{hostname}/graphic/smallUps.htm" unless hostname.nil?
11
11
  create_getters
12
12
  end
13
13
 
@@ -1,3 +1,3 @@
1
1
  module Liebert
2
- VERSION = '0.0.3'
3
- end
2
+ VERSION = '0.0.4'
3
+ end
@@ -4,7 +4,7 @@ vcr_options = { cassette_name: 'airconditioner' }
4
4
 
5
5
  describe AirConditioner, vcr: vcr_options do
6
6
  before :all do
7
- @ac = AirConditioner.new(ENV['LIEBERT_AIRCONDITIONER_URI'])
7
+ @ac = AirConditioner.new(ENV['LIEBERT_AIRCONDITIONER_HOSTNAME'])
8
8
  end
9
9
 
10
10
  it 'responds to temperature' do
@@ -12,10 +12,10 @@ describe AirConditioner, vcr: vcr_options do
12
12
  end
13
13
 
14
14
  it 'responds to humidity' do
15
- expect(@ac.humidity).to eq "Humidity\t47.0"
15
+ expect(@ac.humidity).to eq "Humidity\t43.0"
16
16
  end
17
17
 
18
18
  it 'responds to all' do
19
- expect(@ac.all).to eq "Temperature\t65.0\nHumidity\t47.0\n"
19
+ expect(@ac.all).to eq "Temperature\t65.0\nHumidity\t43.0\n"
20
20
  end
21
21
  end
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: <AIRCONDITIONER_URI>
5
+ uri: http://liebertac1.bobst.nyu.edu/graphic/env.htm
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -121,7 +121,7 @@ http_interactions:
121
121
  deviceInfo.tempSetpt=65;
122
122
  deviceInfo.tempTol=2.0;
123
123
 
124
- deviceInfo.humid=47;
124
+ deviceInfo.humid=43;
125
125
  deviceInfo.humidSetpt=48;
126
126
  deviceInfo.humidTol=5;
127
127
  // -->
@@ -151,7 +151,7 @@ http_interactions:
151
151
  <td class="leftAlignAreaStyle">Stage</td><td class="leftAlignAreaStyle">
152
152
  0 </td></tr><tr>
153
153
  <td class="leftAlignAreaStyle">Capacity&nbsp;</td><td class="leftAlignAreaStyle">
154
- 13 %
154
+ 10 %
155
155
  </td></tr></table></div><div id="HumidityFrame" class="humidityFrame">
156
156
  <table border="1" width="485" height="110">
157
157
  <tr><td>&nbsp;</td></tr></table></div><div id="HumidityArea" class="humidityArea">
@@ -171,5 +171,5 @@ http_interactions:
171
171
  <td class="headerTextStyle" width="250">Active Alarms:</td></tr></table></div>
172
172
  </body></html>
173
173
  http_version:
174
- recorded_at: Thu, 05 Dec 2013 21:26:29 GMT
174
+ recorded_at: Fri, 06 Dec 2013 16:15:19 GMT
175
175
  recorded_with: VCR 2.8.0
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: <UPS_URI>
5
+ uri: http://liebert1.bobst.nyu.edu/graphic/smallUps.htm
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -216,7 +216,7 @@ http_interactions:
216
216
  <td>Volts:</td><td></td><td><script language="JavaScript" type="text/javascript">if(deviceInfo.numInputLines <= 1)document.write("V");</script>
217
217
  </td><td></td><td class="unitColumnStyle"><script language="JavaScript" type="text/javascript">if(deviceInfo.numInputLines >= 3)document.write("V");</script></td></tr><tr id="InputAmps" class="inputAmps">
218
218
  <td>Amps:</td><td>16.4 </td><td class="unitColumnStyle">A</td></tr><tr>
219
- <td>Freq:</td><td>60.1 </td><td class="unitColumnStyle">Hz</td></tr></table></center></td></tr></table></div><div id="Output" class="upsOutputArea">
219
+ <td>Freq:</td><td>60.0 </td><td class="unitColumnStyle">Hz</td></tr></table></center></td></tr></table></div><div id="Output" class="upsOutputArea">
220
220
  <table border="1">
221
221
  <tr><td><center>
222
222
  <a href="../monitor/upsOutput.htm"><b>OUTPUT</b></a><table border="0" width="135" align=center cellspacing="0" cellpadding="1">
@@ -269,5 +269,5 @@ http_interactions:
269
269
 
270
270
  </body></html>
271
271
  http_version:
272
- recorded_at: Thu, 05 Dec 2013 21:26:30 GMT
272
+ recorded_at: Fri, 06 Dec 2013 16:15:19 GMT
273
273
  recorded_with: VCR 2.8.0
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Command Line' do
4
+ it 'should respond when no parameters are passed' do
5
+ command_line = %x( liebert ac )
6
+ expect(command_line).to include "Temperature\t"
7
+ end
8
+
9
+ it 'should respond when parameters are passed' do
10
+ command_line = %x( liebert ups --charge )
11
+ expect(command_line).to include "Charge\t"
12
+ end
13
+ end
data/spec/ups_spec.rb CHANGED
@@ -4,7 +4,7 @@ vcr_options = { cassette_name: 'ups' }
4
4
 
5
5
  describe UPS, vcr: vcr_options do
6
6
  before :all do
7
- @ups = UPS.new(ENV['LIEBERT_UPS_URI'])
7
+ @ups = UPS.new(ENV['LIEBERT_UPS_HOSTNAME'])
8
8
  end
9
9
 
10
10
  it 'responds to input_amps' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: liebert
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooks Swinnerton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-05 00:00:00.000000000 Z
11
+ date: 2013-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -131,6 +131,7 @@ extensions: []
131
131
  extra_rdoc_files: []
132
132
  files:
133
133
  - .gitignore
134
+ - .travis.yml
134
135
  - Gemfile
135
136
  - LICENSE.txt
136
137
  - README.md
@@ -145,6 +146,7 @@ files:
145
146
  - spec/airconditioner_spec.rb
146
147
  - spec/cassettes/airconditioner.yml
147
148
  - spec/cassettes/ups.yml
149
+ - spec/command_line_spec.rb
148
150
  - spec/scrapable_spec.rb
149
151
  - spec/spec_helper.rb
150
152
  - spec/support/vcr.rb
@@ -177,6 +179,7 @@ test_files:
177
179
  - spec/airconditioner_spec.rb
178
180
  - spec/cassettes/airconditioner.yml
179
181
  - spec/cassettes/ups.yml
182
+ - spec/command_line_spec.rb
180
183
  - spec/scrapable_spec.rb
181
184
  - spec/spec_helper.rb
182
185
  - spec/support/vcr.rb