Class: BinProxy::ProxyBaseItem

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
lib/binproxy/proxy_event.rb

Direct Known Subclasses

ProxyEvent, ProxyMessage

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logger

log

Constructor Details

#initializeProxyBaseItem

Returns a new instance of ProxyBaseItem.



15
16
17
# File 'lib/binproxy/proxy_event.rb', line 15

def initialize
  @time = Time.now
end

Instance Attribute Details

#destObject

Returns the value of attribute dest.



5
6
7
# File 'lib/binproxy/proxy_event.rb', line 5

def dest
  @dest
end

#dispositionObject

Returns the value of attribute disposition.



4
5
6
# File 'lib/binproxy/proxy_event.rb', line 4

def disposition
  @disposition
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/binproxy/proxy_event.rb', line 4

def id
  @id
end

#sessionObject

Returns the value of attribute session.



4
5
6
# File 'lib/binproxy/proxy_event.rb', line 4

def session
  @session
end

#srcObject

Returns the value of attribute src.



5
6
7
# File 'lib/binproxy/proxy_event.rb', line 5

def src
  @src
end

#timeObject (readonly)

Returns the value of attribute time.



5
6
7
# File 'lib/binproxy/proxy_event.rb', line 5

def time
  @time
end

Instance Method Details

#headersObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/binproxy/proxy_event.rb', line 19

def headers
  {
    message_id: @id,
    session_id: @session && @session.id,
    src: @src,
    dest: @dest,
    time: @time.to_i,
    disposition: @disposition,
  }
end

#to_hashObject



30
31
32
# File 'lib/binproxy/proxy_event.rb', line 30

def to_hash
  { head: headers }
end