Class: Typhoeus::EasyFactory Private
- Inherits:
-
Object
- Object
- Typhoeus::EasyFactory
- Defined in:
- lib/typhoeus/easy_factory.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
This is a Factory for easies to be used in the hydra. Before an easy is ready to be added to a multi the on_complete callback to be set. This is done by this class.
Constant Summary collapse
- RENAMED_OPTIONS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ :auth_method => :httpauth, :connect_timeout => :connecttimeout, :encoding => :accept_encoding, :follow_location => :followlocation, :max_redirects => :maxredirs, :proxy_type => :proxytype, :ssl_cacert => :cainfo, :ssl_capath => :capath, :ssl_cert => :sslcert, :ssl_cert_type => :sslcerttype, :ssl_key => :sslkey, :ssl_key_password => :keypasswd, :ssl_key_type => :sslkeytype, :ssl_version => :sslversion, }
- CHANGED_OPTIONS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ :disable_ssl_host_verification => :ssl_verifyhost, :disable_ssl_peer_verification => :ssl_verifypeer, :proxy_auth_method => :proxyauth, }
- REMOVED_OPTIONS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Set.new([:cache_key_basis, :cache_timeout, :user_agent])
- SANITIZE_IGNORE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Set.new([:method, :cache_ttl, :cache])
- SANITIZE_TIMEOUT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Set.new([:timeout_ms, :connecttimeout_ms])
Instance Attribute Summary collapse
-
#hydra ⇒ Typhoeus::Hydra
readonly
private
Returns the hydra provided.
-
#request ⇒ Typhoeus::Request
readonly
private
Returns the request provided.
Instance Method Summary collapse
-
#easy ⇒ Ethon::Easy
private
Return the easy in question.
-
#get ⇒ Ethon::Easy
private
Fabricated easy.
-
#initialize(request, hydra = nil) ⇒ EasyFactory
constructor
private
Create an easy factory.
Constructor Details
#initialize(request, hydra = nil) ⇒ EasyFactory
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create an easy factory.
58 59 60 61 |
# File 'lib/typhoeus/easy_factory.rb', line 58 def initialize(request, hydra = nil) @request = request @hydra = hydra end |
Instance Attribute Details
#hydra ⇒ Typhoeus::Hydra (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the hydra provided.
49 50 51 |
# File 'lib/typhoeus/easy_factory.rb', line 49 def hydra @hydra end |
#request ⇒ Typhoeus::Request (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the request provided.
44 45 46 |
# File 'lib/typhoeus/easy_factory.rb', line 44 def request @request end |
Instance Method Details
#easy ⇒ Ethon::Easy
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return the easy in question.
69 70 71 |
# File 'lib/typhoeus/easy_factory.rb', line 69 def easy @easy ||= Typhoeus::Pool.get end |
#get ⇒ Ethon::Easy
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Fabricated easy.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/typhoeus/easy_factory.rb', line 79 def get begin read_callback_body = request..delete(:set_read_callback) easy.http_request( request.base_url.to_s, request..fetch(:method, :get), sanitize(request.) ) # this needs to happen after http_request because # ethon will set infilesize to zero if form.empty? set_read_callback(read_callback_body) if !read_callback_body.nil? rescue Ethon::Errors::InvalidOption => e help = provide_help(e..match(/:\s(\w+)/)[1]) raise $!, "#{$!}#{help}", $!.backtrace end set_callback easy end |