liebert 0.0.5 → 0.0.6
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.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/liebert/scrapable.rb +6 -2
- data/lib/liebert/version.rb +1 -1
- data/spec/scrapable_spec.rb +8 -2
- data/spec/support/vcr.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 268acf0ef9c9ff3310ea45d227dbf9176cb4b62d
|
|
4
|
+
data.tar.gz: 761189f5479a41bba0639bd9104710a129cfa3de
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8e96ca7007293d8a4fefa7d1a29a61d58da2c08cd58c8f105df9a23c603e412b5591503a51727034342915ed7856596329f7c152739dd9d521db4a3efa7bfc47
|
|
7
|
+
data.tar.gz: 3b7eebf2137dff8d7379d4d0fc9ee65a6c6feaf0a065fbbb0bc8239b2ffb1e300c959a5900424d902e6ee18af6fe7dc6b56ab5c69a2613c3f1ca2650204ea482
|
data/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# Liebert
|
|
2
2
|
[](https://travis-ci.org/bswinnerton/liebert)
|
|
3
|
+
[](https://gemnasium.com/bswinnerton/liebert)
|
|
3
4
|
[](https://codeclimate.com/github/bswinnerton/liebert)
|
|
4
5
|
|
|
5
6
|
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/).
|
data/lib/liebert/scrapable.rb
CHANGED
|
@@ -31,8 +31,12 @@ module Scrapable
|
|
|
31
31
|
begin
|
|
32
32
|
response = RestClient.get(self.endpoint_uri)
|
|
33
33
|
@parsed_response = Nokogiri::HTML.parse(response.body)
|
|
34
|
-
rescue
|
|
35
|
-
raise
|
|
34
|
+
rescue ArgumentError
|
|
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
|
+
rescue URI::InvalidURIError
|
|
37
|
+
raise 'You\'ve set an invalid hostname in your environemnt variable'
|
|
38
|
+
rescue SocketError
|
|
39
|
+
raise "Unable to contact liebert unit at #{self.endpoint_uri}"
|
|
36
40
|
end
|
|
37
41
|
end
|
|
38
42
|
@parsed_response
|
data/lib/liebert/version.rb
CHANGED
data/spec/scrapable_spec.rb
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe Scrapable do
|
|
4
|
-
it 'tells the user they forgot to enter a
|
|
4
|
+
it 'tells the user they forgot to enter a hostname' do
|
|
5
5
|
ac = AirConditioner.new
|
|
6
|
-
expect { ac.temperature }.to raise_error
|
|
6
|
+
expect { ac.temperature }.to raise_error(RuntimeError, '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')
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it 'gracefully fails when it cannot contact the liebert unit' do
|
|
10
|
+
liebert_hostname = 'notaliebertunit.bobst.nyu.edu'
|
|
11
|
+
ac = AirConditioner.new(liebert_hostname)
|
|
12
|
+
expect { ac.temperature }.to raise_error(RuntimeError, "Unable to contact liebert unit at #{ac.endpoint_uri}")
|
|
7
13
|
end
|
|
8
14
|
end
|
data/spec/support/vcr.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
VCR.configure do |c|
|
|
2
2
|
c.cassette_library_dir = 'spec/cassettes'
|
|
3
3
|
c.hook_into :webmock
|
|
4
|
+
c.ignore_hosts 'notaliebertunit.bobst.nyu.edu'
|
|
4
5
|
c.filter_sensitive_data('<AIRCONDITIONER_URI>') { ENV['LIEBERT_AIRCONDITIONER_URI'] }
|
|
5
6
|
c.filter_sensitive_data('<UPS_URI>') { ENV['LIEBERT_UPS_URI'] }
|
|
6
7
|
c.configure_rspec_metadata!
|
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.
|
|
4
|
+
version: 0.0.6
|
|
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-
|
|
11
|
+
date: 2013-12-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|