Module: Saddle::Options
- Included in:
- Client
- Defined in:
- lib/saddle/options.rb
Constant Summary collapse
- @@additional_middlewares =
Use this to add additional middleware to the request stack ex: add_middleware(
:klass => MyMiddleware, :args => [arg1, arg2],
) end
[]
Instance Method Summary collapse
- #add_middleware(m) ⇒ Object
-
#default_options ⇒ Object
Construct our default options, based upon the class methods.
-
#host ⇒ Object
The default host for this client.
-
#num_retries ⇒ Object
Default number of retries per request.
-
#port ⇒ Object
The default port for this client.
-
#request_style ⇒ Object
The POST/PUT style for this client options are [:json, :urlencoded].
-
#stubs ⇒ Object
If the Typhoeus adapter is being used, pass stubs to it for testing.
-
#timeout ⇒ Object
Default timeout per request (in seconds).
-
#use_ssl ⇒ Object
Should this client use SSL by default?.
Instance Method Details
#add_middleware(m) ⇒ Object
65 66 67 |
# File 'lib/saddle/options.rb', line 65 def add_middleware m @@additional_middlewares << m end |
#default_options ⇒ Object
Construct our default options, based upon the class methods
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/saddle/options.rb', line 11 def { :host => host, :port => port, :use_ssl => use_ssl, :request_style => request_style, :num_retries => num_retries, :timeout => timeout, :additional_middlewares => @@additional_middlewares, :stubs => stubs, } end |
#host ⇒ Object
The default host for this client
25 26 27 |
# File 'lib/saddle/options.rb', line 25 def host 'localhost' end |
#num_retries ⇒ Object
Default number of retries per request
46 47 48 |
# File 'lib/saddle/options.rb', line 46 def num_retries 3 end |
#port ⇒ Object
The default port for this client
30 31 32 |
# File 'lib/saddle/options.rb', line 30 def port 80 end |
#request_style ⇒ Object
The POST/PUT style for this client options are [:json, :urlencoded]
41 42 43 |
# File 'lib/saddle/options.rb', line 41 def request_style :json end |
#stubs ⇒ Object
If the Typhoeus adapter is being used, pass stubs to it for testing.
70 71 72 |
# File 'lib/saddle/options.rb', line 70 def stubs nil end |
#timeout ⇒ Object
Default timeout per request (in seconds)
51 52 53 |
# File 'lib/saddle/options.rb', line 51 def timeout 30 end |
#use_ssl ⇒ Object
Should this client use SSL by default?
35 36 37 |
# File 'lib/saddle/options.rb', line 35 def use_ssl false end |