Class: HTTP::Session::Options
- Inherits:
-
Object
- Object
- HTTP::Session::Options
- Defined in:
- lib/http/session/options.rb,
lib/http/session/options/optionable.rb,
lib/http/session/options/cache_option.rb,
lib/http/session/options/cookies_option.rb,
lib/http/session/options/persistent_option.rb
Defined Under Namespace
Modules: Optionable Classes: CacheOption, CookiesOption, PersistentOption
Instance Attribute Summary collapse
-
#cache ⇒ Object
readonly
Returns the value of attribute cache.
-
#cookies ⇒ Object
readonly
Returns the value of attribute cookies.
-
#http ⇒ Object
readonly
Returns the value of attribute http.
-
#persistent ⇒ Object
readonly
Returns the value of attribute persistent.
Instance Method Summary collapse
-
#initialize(options) ⇒ Options
constructor
A new instance of Options.
- #merge(other) ⇒ Options
- #with_cookies(cookies) ⇒ Options
- #with_encoding(encoding) ⇒ Options
- #with_features(features) ⇒ Options
- #with_follow(follow) ⇒ Options
- #with_headers(headers) ⇒ Options
- #with_nodelay(nodelay) ⇒ Options
- #with_proxy(proxy) ⇒ Options
Constructor Details
#initialize(options) ⇒ Options
Returns a new instance of Options.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/http/session/options.rb', line 20 def initialize() @cookies = HTTP::Session::Options::CookiesOption.new(.fetch(:cookies, false)) @cache = HTTP::Session::Options::CacheOption.new(.fetch(:cache, false)) @persistent = HTTP::Session::Options::PersistentOption.new(.fetch(:persistent, false)) @http = HTTP::Options.new( .fetch(:http, {}).slice( :cookies, :encoding, :features, :follow, :headers, :keep_alive_timeout, :nodelay, :proxy, :response, :ssl, :ssl_socket_class, :socket_class, :timeout_class, :timeout_options ) ) end |
Instance Attribute Details
#cache ⇒ Object (readonly)
Returns the value of attribute cache.
9 10 11 |
# File 'lib/http/session/options.rb', line 9 def cache @cache end |
#cookies ⇒ Object (readonly)
Returns the value of attribute cookies.
5 6 7 |
# File 'lib/http/session/options.rb', line 5 def @cookies end |
#http ⇒ Object (readonly)
Returns the value of attribute http.
17 18 19 |
# File 'lib/http/session/options.rb', line 17 def http @http end |
#persistent ⇒ Object (readonly)
Returns the value of attribute persistent.
13 14 15 |
# File 'lib/http/session/options.rb', line 13 def persistent @persistent end |
Instance Method Details
#merge(other) ⇒ Options
45 46 47 |
# File 'lib/http/session/options.rb', line 45 def merge(other) tap { @http = @http.merge(other) } end |
#with_cookies(cookies) ⇒ Options
50 51 52 |
# File 'lib/http/session/options.rb', line 50 def () tap { @http = @http.() } end |
#with_encoding(encoding) ⇒ Options
55 56 57 |
# File 'lib/http/session/options.rb', line 55 def with_encoding(encoding) tap { @http = @http.with_encoding(encoding) } end |
#with_features(features) ⇒ Options
60 61 62 63 |
# File 'lib/http/session/options.rb', line 60 def with_features(features) raise ArgumentError, "feature :auto_inflate is not supported, use :hsf_auto_inflate instead" if features.include?(:auto_inflate) tap { @http = @http.with_features(features) } end |
#with_follow(follow) ⇒ Options
66 67 68 |
# File 'lib/http/session/options.rb', line 66 def with_follow(follow) tap { @http = @http.with_follow(follow) } end |
#with_headers(headers) ⇒ Options
71 72 73 |
# File 'lib/http/session/options.rb', line 71 def with_headers(headers) tap { @http = @http.with_headers(headers) } end |
#with_nodelay(nodelay) ⇒ Options
76 77 78 |
# File 'lib/http/session/options.rb', line 76 def with_nodelay(nodelay) tap { @http = @http.with_nodelay(nodelay) } end |
#with_proxy(proxy) ⇒ Options
81 82 83 |
# File 'lib/http/session/options.rb', line 81 def with_proxy(proxy) tap { @http = @http.with_proxy(proxy) } end |