Module: Resto::Request::Option

Included in:
Base
Defined in:
lib/resto/request/option.rb

Instance Method Summary collapse

Instance Method Details

#close_on_empty_response(close_on_empty_response) ⇒ Object

:ssl_attributes



92
93
94
# File 'lib/resto/request/option.rb', line 92

def close_on_empty_response(close_on_empty_response)#
  tap { options.store(:close_on_empty_response, close_on_empty_response) }
end

#open_timeout(time) ⇒ Object

Number of seconds to wait for the connection to open. If the HTTP object cannot open a connection in this many seconds, it raises a TimeoutError exception.



99
100
101
# File 'lib/resto/request/option.rb', line 99

def open_timeout(time)#
  tap { options.store(:open_timeout, time)}
end

#optionsObject



9
10
11
# File 'lib/resto/request/option.rb', line 9

def options
  @options ||= {}
end

#read_timeout(time) ⇒ Object

Number of seconds to wait for one block to be read (via one read(2) call). If the HTTP object cannot read data in this many seconds, it raises a TimeoutError exception.



106
107
108
# File 'lib/resto/request/option.rb', line 106

def read_timeout(time)#
  tap { options.store(:read_timeout, time)}
end

#set_debug_output(output) ⇒ Object

WARNING This method opens a serious security hole. Never use this method in production code.

Sets an output stream for debugging.

Resto.url('www.google.com').set_debug_output($stderr).get


121
122
123
# File 'lib/resto/request/option.rb', line 121

def set_debug_output(output)
  tap { options.store(:set_debug_output, output)}
end

#timeout(timeout) ⇒ Object

Seconds to wait until reading one block (by one read(2) call).



111
112
113
# File 'lib/resto/request/option.rb', line 111

def timeout(timeout) # 1.8.7 1.9??
  tap { options.store(:timeout, timeout)}
end