Class: HTTP::Session::Client

Inherits:
Object
  • Object
show all
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

Perform::HTTP_OR_HTTPS_RE

Instance Attribute Summary

Attributes included from Perform

#default_options

Instance Method Summary collapse

Methods included from Perform

#close, #httprb_initialize, #httprb_perform

Constructor Details

#initialize(default_options, session) ⇒ Client

Returns a new instance of Client.

Parameters:

  • default_options (Hash)
  • session (Session)


7
8
9
10
# File 'lib/http/session/client.rb', line 7

def initialize(default_options, session)
  httprb_initialize(default_options)
  @session = session
end

Instance Method Details

#request(verb, uri, opts, ctx) ⇒ Response

Make an HTTP request.

Parameters:

  • verb
  • uri
  • opts (Hash)
  • ctx (nil, Context)

Returns:



19
20
21
22
23
24
25
26
27
28
# File 'lib/http/session/client.rb', line 19

def request(verb, uri, opts, ctx)
  opts = default_options.merge(opts)
  opts = _hs_handle_http_request_options_cookies(uri, opts)

  req = _hs_build_request(verb, uri, opts, ctx)
  res = _hs_perform(req, opts)
  _hs_cookies_save(res)

  res
end