Class: Typhoeus::Request
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#proxy ⇒ Object
Returns the value of attribute proxy.
-
#proxy_password ⇒ Object
Returns the value of attribute proxy_password.
-
#proxy_type ⇒ Object
Returns the value of attribute proxy_type.
-
#proxy_username ⇒ Object
Returns the value of attribute proxy_username.
Instance Method Summary collapse
- #call_handlers ⇒ Object
-
#initialize(url, options = {}) ⇒ Request
constructor
A new instance of Request.
- #old_initialize ⇒ Object
- #on_complete(multi = false, &block) ⇒ Object
- #on_complete=(multi = false, proc) ⇒ Object
- #train! ⇒ Object
- #train? ⇒ Boolean
Constructor Details
#initialize(url, options = {}) ⇒ Request
Returns a new instance of Request.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/typhoeus/request.rb', line 27 def initialize( url, = {} ) old_initialize( url, ) @proxy_type = [:proxy_type] @proxy_username = [:proxy_username] @proxy_password = [:proxy_password] @proxy_auth_method = [:proxy_auth_method] @on_complete = [] @handled_response = [] @multiple_callbacks = false @train = false end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
22 23 24 |
# File 'lib/typhoeus/request.rb', line 22 def id @id end |
#proxy ⇒ Object
Returns the value of attribute proxy.
22 23 24 |
# File 'lib/typhoeus/request.rb', line 22 def proxy @proxy end |
#proxy_password ⇒ Object
Returns the value of attribute proxy_password.
22 23 24 |
# File 'lib/typhoeus/request.rb', line 22 def proxy_password @proxy_password end |
#proxy_type ⇒ Object
Returns the value of attribute proxy_type.
22 23 24 |
# File 'lib/typhoeus/request.rb', line 22 def proxy_type @proxy_type end |
#proxy_username ⇒ Object
Returns the value of attribute proxy_username.
22 23 24 |
# File 'lib/typhoeus/request.rb', line 22 def proxy_username @proxy_username end |
Instance Method Details
#call_handlers ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/typhoeus/request.rb', line 66 def call_handlers if @on_complete.is_a? Array @on_complete.each do |callback| @handled_response << callback.call(response) end else @handled_response << @on_complete.call(response) end call_after_complete end |
#old_initialize ⇒ Object
25 |
# File 'lib/typhoeus/request.rb', line 25 alias :old_initialize :initialize |
#on_complete(multi = false, &block) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/typhoeus/request.rb', line 42 def on_complete( multi = false, &block ) # remember user preference for subsequent calls if( multi || @multiple_callbacks ) @multiple_callbacks = true @on_complete << block else @on_complete = block end end |
#on_complete=(multi = false, proc) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/typhoeus/request.rb', line 54 def on_complete=( multi = false, proc ) # remember user preference for subsequent calls if( multi || @multiple_callbacks ) @multiple_callbacks = true @on_complete << proc else @on_complete = proc end end |
#train! ⇒ Object
85 86 87 |
# File 'lib/typhoeus/request.rb', line 85 def train! @train = true end |
#train? ⇒ Boolean
81 82 83 |
# File 'lib/typhoeus/request.rb', line 81 def train? @train end |