class HTTPX::Session

  1. lib/httpx/session.rb
Superclass: Object

Methods

Public Class

  1. new

Public Instance

  1. close
  2. request
  3. wrap

Included modules

  1. Loggable
  2. Chainable

Public Class methods

new (options = {}, &blk)
[show source]
   # File lib/httpx/session.rb
 8 def initialize(options = {}, &blk)
 9   @options = self.class.default_options.merge(options)
10   @responses = {}
11   @persistent = @options.persistent
12   wrap(&blk) if block_given?
13 end

Public Instance methods

close (*args)
[show source]
   # File lib/httpx/session.rb
27 def close(*args)
28   pool.close(*args)
29 end
request (*args, **options)
[show source]
   # File lib/httpx/session.rb
31 def request(*args, **options)
32   requests = build_requests(*args, options)
33   responses = send_requests(*requests, options)
34   return responses.first if responses.size == 1
35 
36   responses
37 end
wrap ()
[show source]
   # File lib/httpx/session.rb
15 def wrap
16   return unless block_given?
17 
18   begin
19     prev_persistent = @persistent
20     @persistent = true
21     yield self
22   ensure
23     @persistent = prev_persistent
24   end
25 end