class Isepick::IseMNT

Public Class Methods

new(mnt_host, mnt_user, mnt_password) click to toggle source
# File lib/isepick.rb, line 9
def initialize(mnt_host, mnt_user, mnt_password)
  @client = Faraday.new("https://#{mnt_host}/admin/API/mnt/") do |conn|
    conn.basic_auth(mnt_user, mnt_password)
    conn.adapter Faraday.default_adapter
    conn.ssl[:verify] = false
    conn.headers["Accept"] = "application/xml"
  end
end

Public Instance Methods

activeSessions(pageSize = 25, page = 1) click to toggle source
# File lib/isepick.rb, line 18
def activeSessions(pageSize = 25, page = 1)
  session_xml = Nokogiri::XML(@client.get("Session/ActiveList", {pageSize: pageSize, page: page}).body)
  return Hash.from_xml(session_xml.to_s)
end
session_filterByIP(ip_addr) click to toggle source
# File lib/isepick.rb, line 29
def session_filterByIP(ip_addr)
  session_xml = Nokogiri::XML(@client.get("Session/EndPointIPAddress/#{ip_addr}").body)
  return Hash.from_xml(session_xml.to_s)
end
session_filterByMAC(mac_addr) click to toggle source
# File lib/isepick.rb, line 23
def session_filterByMAC(mac_addr)
  filter_param = mac_addr.gsub(/[^a-fA-F0-9]/, "").upcase.gsub(/(.{2})(?=.)/, '\1:\2')
  session_xml = Nokogiri::XML(@client.get("Session/MACAddress/#{filter_param}").body)
  return Hash.from_xml(session_xml.to_s)
end