module HTTPX::Chainable

  1. lib/httpx/chainable.rb

Methods

Public Instance

  1. accept
  2. headers
  3. plugin
  4. plugins
  5. request
  6. timeout
  7. with
  8. wrap

Public Instance methods

accept(type)

:nocov:

[show source]
   # File lib/httpx/chainable.rb
29 def accept(type)
30   with(headers: { "accept" => String(type) })
31 end
headers(headers)
[show source]
   # File lib/httpx/chainable.rb
23 def headers(headers)
24   warn ":#{__method__} is deprecated, use :with_headers instead"
25   with(headers: headers)
26 end
plugin(pl, options = nil, &blk)
[show source]
   # File lib/httpx/chainable.rb
37 def plugin(pl, options = nil, &blk)
38   klass = is_a?(Session) ? self.class : Session
39   klass = Class.new(klass)
40   klass.instance_variable_set(:@default_options, klass.default_options.merge(default_options))
41   klass.plugin(pl, options, &blk).new
42 end
plugins(pls)

deprecated :nocov:

[show source]
   # File lib/httpx/chainable.rb
46 def plugins(pls)
47   warn ":#{__method__} is deprecated, use :plugin instead"
48   klass = is_a?(Session) ? self.class : Session
49   klass = Class.new(klass)
50   klass.instance_variable_set(:@default_options, klass.default_options.merge(default_options))
51   klass.plugins(pls).new
52 end
request(*args, **options)
[show source]
   # File lib/httpx/chainable.rb
13 def request(*args, **options)
14   branch(default_options).request(*args, **options)
15 end
timeout(**args)

:nocov:

[show source]
   # File lib/httpx/chainable.rb
18 def timeout(**args)
19   warn ":#{__method__} is deprecated, use :with_timeout instead"
20   with(timeout: args)
21 end
with(options, &blk)

:nocov:

[show source]
   # File lib/httpx/chainable.rb
55 def with(options, &blk)
56   branch(default_options.merge(options), &blk)
57 end
wrap(&blk)
[show source]
   # File lib/httpx/chainable.rb
33 def wrap(&blk)
34   branch(default_options).wrap(&blk)
35 end