Class: Pubnub::HttpDispatcher

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(httpx_session, keepalive_enabled: true) ⇒ HttpDispatcher

Returns a new instance of HttpDispatcher.



5
6
7
8
# File 'lib/pubnub/http_dispatcher.rb', line 5

def initialize(httpx_session, keepalive_enabled: true)
  @session = httpx_session
  @tcp_keepalive = keepalive_enabled
end

Instance Attribute Details

#tcp_keepaliveObject (readonly)

Returns the value of attribute tcp_keepalive.



3
4
5
# File 'lib/pubnub/http_dispatcher.rb', line 3

def tcp_keepalive
  @tcp_keepalive
end

Instance Method Details

#delete(url, header: {}) ⇒ Object



22
23
24
# File 'lib/pubnub/http_dispatcher.rb', line 22

def delete(url, header: {})
  execute { @session.delete(url, headers: header) }
end

#get(url, header: {}) ⇒ Object



10
11
12
# File 'lib/pubnub/http_dispatcher.rb', line 10

def get(url, header: {})
  execute { @session.get(url, headers: header) }
end

#patch(url, body: '', header: {}) ⇒ Object



18
19
20
# File 'lib/pubnub/http_dispatcher.rb', line 18

def patch(url, body: '', header: {})
  execute { @session.patch(url, headers: header, body: body) }
end

#post(url, body: '', header: {}) ⇒ Object



14
15
16
# File 'lib/pubnub/http_dispatcher.rb', line 14

def post(url, body: '', header: {})
  execute { @session.post(url, headers: header, body: body) }
end

#reset_allObject



26
27
28
# File 'lib/pubnub/http_dispatcher.rb', line 26

def reset_all
  @session.close
end