Class: Opensaz::HTTPMiscel

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

Instance Method Summary collapse

Constructor Details

#initialize(xml_str) ⇒ HTTPMiscel

Returns a new instance of HTTPMiscel.



5
6
7
# File 'lib/opensaz/http_miscel.rb', line 5

def initialize(xml_str)
  @xml = Nokogiri::XML(xml_str)
end

Instance Method Details

#flagsObject



34
35
36
37
38
39
40
# File 'lib/opensaz/http_miscel.rb', line 34

def flags
  flags_hash = {}
  @xml.xpath("/Session/SessionFlags/SessionFlag").each do |node|
    flags_hash.store(symbolize_it(node.attribute("N").text), node.attribute("V").text)
  end
  flags_hash
end

#timersObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/opensaz/http_miscel.rb', line 9

def timers
  timers_hash = {}
  @xml.xpath("/Session/SessionTimers").each do |node|
    timers_hash = {
      client_connected: node.attribute("ClientConnected").text,
      client_begin_request: node.attribute("ClientBeginRequest").text,
      got_request_headers: node.attribute("GotRequestHeaders").text,
      client_done_request: node.attribute("ClientDoneRequest").text,
      gateway_time: node.attribute("GatewayTime").text,
      dns_time: node.attribute("DNSTime").text,
      tcp_connect_time: node.attribute("TCPConnectTime").text,
      https_handshake_time: node.attribute("HTTPSHandshakeTime").text,
      server_connected: node.attribute("ServerConnected").text,
      fiddler_begin_request: node.attribute("FiddlerBeginRequest").text,
      server_got_request: node.attribute("ServerGotRequest").text,
      server_begin_response: node.attribute("ServerBeginResponse").text,
      got_response_headers: node.attribute("GotResponseHeaders").text,
      server_done_response: node.attribute("ServerDoneResponse").text,
      client_begin_response: node.attribute("ClientBeginResponse").text,
      client_done_response: node.attribute("ClientDoneResponse").text
    }
  end
  timers_hash
end