Module: HTTPX::Chainable
Instance Method Summary collapse
- #accept(type) ⇒ Object
- #headers(headers) ⇒ Object
- #plugin(*plugins) ⇒ Object (also: #plugins)
- #request(verb, uri, **options) ⇒ Object
- #timeout(**args) ⇒ Object
- #with(options, &blk) ⇒ Object
- #wrap(&blk) ⇒ Object
Instance Method Details
#accept(type) ⇒ Object
23 24 25 |
# File 'lib/httpx/chainable.rb', line 23 def accept(type) headers("accept" => String(type)) end |
#headers(headers) ⇒ Object
19 20 21 |
# File 'lib/httpx/chainable.rb', line 19 def headers(headers) branch(.with_headers(headers)) end |
#plugin(*plugins) ⇒ Object Also known as: plugins
31 32 33 34 35 36 |
# File 'lib/httpx/chainable.rb', line 31 def plugin(*plugins) klass = is_a?(Session) ? self.class : Session klass = Class.new(klass) klass.instance_variable_set(:@default_options, klass..merge()) klass.plugins(plugins).new end |
#request(verb, uri, **options) ⇒ Object
11 12 13 |
# File 'lib/httpx/chainable.rb', line 11 def request(verb, uri, **) branch().request(verb, uri, **) end |
#timeout(**args) ⇒ Object
15 16 17 |
# File 'lib/httpx/chainable.rb', line 15 def timeout(**args) branch(.with_timeout(args)) end |
#with(options, &blk) ⇒ Object
39 40 41 |
# File 'lib/httpx/chainable.rb', line 39 def with(, &blk) branch(.merge(), &blk) end |
#wrap(&blk) ⇒ Object
27 28 29 |
# File 'lib/httpx/chainable.rb', line 27 def wrap(&blk) branch().wrap(&blk) end |