class RubyMas
Public Class Methods
new(hash)
click to toggle source
# File lib/rubymas.rb, line 4 def initialize(hash) @connection = hash end
Public Instance Methods
inventory_report()
click to toggle source
# File lib/rubymas.rb, line 21 def inventory_report connect run_report telnet.cmd("HP_DUMP3") telnet.cmd("p") telnet.cmd("fil") telnet.cmd("/usr/common") telnet.cmd("invdump.csv") telnet.cmd("3") telnet.cmd("") telnet.cmd("Y") telnet.cmd("") telnet.cmd("") telnet.cmd("") finish end
test_connect()
click to toggle source
# File lib/rubymas.rb, line 8 def test_connect telnet.cmd(@connection[:user]) {|c| print c} telnet.cmd(@connection[:password]) {|c| print c} telnet.close end
workorder_report()
click to toggle source
# File lib/rubymas.rb, line 14 def workorder_report connect run_report telnet.cmd("WOH_DUMP") finish end
Private Instance Methods
connect()
click to toggle source
# File lib/rubymas.rb, line 46 def connect telnet.login(@connection[:user], @connection[:password]) telnet.cmd("") telnet.cmd(@connection[:mas_user]) telnet.cmd(@connection[:mas_pass]) telnet.cmd("") telnet.cmd("") end
finish()
click to toggle source
# File lib/rubymas.rb, line 58 def finish telnet.cmd("") telnet.cmd("*END") end
quick_sleep()
click to toggle source
# File lib/rubymas.rb, line 63 def quick_sleep sleep(1.0/24.0) end
run_report()
click to toggle source
# File lib/rubymas.rb, line 54 def run_report telnet.cmd("7") telnet.cmd("2") end
telnet()
click to toggle source
# File lib/rubymas.rb, line 39 def telnet @telnet ||= Net::Telnet::new("Host" => @connection[:host], "Timeout" => 5, "Prompt" => //, "Waittime" => 1 ) end