Permalink
Browse files

Minor cleanup.

  • Loading branch information...
1 parent 8fb5fb9 commit 6622bcc09101fe2f37dead6a8dee471473ff2d18 @JEG2 committed Nov 20, 2015
Showing with 7 additions and 10 deletions.
  1. +7 −10 lib/haunted_house.rb
View
@@ -4,33 +4,30 @@
require "haunted_house/device"
-# FIXME: this is dangerous
-OpenSSL::SSL.send(:remove_const, :VERIFY_PEER)
-OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
-
class HauntedHouse
def initialize(address, user, password)
@address = address
@user = user
@password = password
@devices = [ ]
-
+
lookup_devices
end
-
+
def request(url)
open( "#{@address}/rest/#{url}",
- :http_basic_authentication => [@user, @password] ) do |data|
+ :http_basic_authentication => [@user, @password],
+ :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE ) do |data|
yield data if block_given?
end
end
-
+
def device(name)
@devices.find { |device| device.name == name }
end
-
+
private
-
+
def lookup_devices
request("nodes") do |data|
xml = REXML::Document.new(data)

0 comments on commit 6622bcc

Please sign in to comment.