Class: HTTP::Session::Client
- Inherits:
-
Object
- Object
- HTTP::Session::Client
- Includes:
- Perform
- Defined in:
- lib/http/session/client.rb,
lib/http/session/client/perform.rb
Defined Under Namespace
Modules: Perform
Constant Summary
Constants included from Perform
Instance Attribute Summary
Attributes included from Perform
Instance Method Summary collapse
-
#initialize(default_options, session) ⇒ Client
constructor
A new instance of Client.
- #request(verb, uri, opts) ⇒ Response
Methods included from Perform
#httprb_initialize, #httprb_perform
Constructor Details
#initialize(default_options, session) ⇒ Client
Returns a new instance of Client.
7 8 9 10 |
# File 'lib/http/session/client.rb', line 7 def initialize(, session) httprb_initialize() @session = session end |
Instance Method Details
#request(verb, uri, opts) ⇒ Response
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/http/session/client.rb', line 16 def request(verb, uri, opts) data = @session.make_http_request_data hist = [] opts = .merge(opts) opts = (opts, data[:cookies]) opts = (opts, hist) req = build_request(verb, uri, opts) res = perform(req, opts) return res unless opts.follow HTTP::Redirector.new(opts.follow).perform(req, res) do |request| request = HTTP::Session::Request.new(request) perform(request, opts) end.tap do |res| res.history = hist end end |