Class: Pxgrid::ISE::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/pxgrid.rb

Constant Summary collapse

SERVICE =
"com.cisco.ise.session"

Instance Method Summary collapse

Constructor Details

#initialize(pxgrid_client) ⇒ Session

Returns a new instance of Session.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/pxgrid.rb', line 76

def initialize(pxgrid_client)
  service = pxgrid_client.serviceLookup(SERVICE)["services"].sample
  @nodeName = service["nodeName"]
  @username = pxgrid_client.username
  @password = pxgrid_client.accessSecret(@nodeName)

  @client = Faraday.new(service["properties"]["restBaseUrl"]) do |conn|
    conn.adapter Faraday.default_adapter
    conn.basic_auth @username, @password
    conn.ssl[:verify] = false
    conn.headers["Accept"] = "application/json"
    conn.headers["Content-Type"] = "application/json"
  end
end

Instance Method Details

#getSessions(startTimestamp = "") ⇒ Object



91
92
93
94
95
96
97
98
# File 'lib/pxgrid.rb', line 91

def getSessions(startTimestamp = "")
  if startTimestamp.empty?
    params = {}
  else
    params = {"startTimestamp": startTimestamp}
  end
  return JSON.parse(@client.post("getSessions", params.to_json).body)["sessions"]
end