Module: Saddle::Options
- Included in:
- Client
- Defined in:
- lib/saddle/options.rb
Instance Method Summary collapse
-
#additional_middlewares ⇒ Object
Override this to add additional middleware to the request stack ex:.
-
#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.
-
#post_style ⇒ Object
The POST/PUT style for this client options are [:json, :urlencoded].
-
#response_style ⇒ Object
How to parse results 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
#additional_middlewares ⇒ Object
Override this to add additional middleware to the request stack ex:
require ‘my_middleware’ def self.default_middleware
[MyMiddleware]
end
71 72 73 |
# File 'lib/saddle/options.rb', line 71 def additional_middlewares [] 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 23 |
# File 'lib/saddle/options.rb', line 11 def { :host => host, :port => port, :use_ssl => use_ssl, :post_style => post_style, :response_style => response_style, :num_retries => num_retries, :timeout => timeout, :additional_middlewares => additional_middlewares, :stubs => stubs, } end |
#host ⇒ Object
The default host for this client
26 27 28 |
# File 'lib/saddle/options.rb', line 26 def host 'localhost' end |
#num_retries ⇒ Object
Default number of retries per request
53 54 55 |
# File 'lib/saddle/options.rb', line 53 def num_retries 3 end |
#port ⇒ Object
The default port for this client
31 32 33 |
# File 'lib/saddle/options.rb', line 31 def port 80 end |
#post_style ⇒ Object
The POST/PUT style for this client options are [:json, :urlencoded]
42 43 44 |
# File 'lib/saddle/options.rb', line 42 def post_style :json end |
#response_style ⇒ Object
How to parse results options are [:json, :urlencoded]
48 49 50 |
# File 'lib/saddle/options.rb', line 48 def response_style :json end |
#stubs ⇒ Object
If the Typhoeus adapter is being used, pass stubs to it for testing.
76 77 78 |
# File 'lib/saddle/options.rb', line 76 def stubs nil end |
#timeout ⇒ Object
Default timeout per request (in seconds)
58 59 60 |
# File 'lib/saddle/options.rb', line 58 def timeout 30 end |
#use_ssl ⇒ Object
Should this client use SSL by default?
36 37 38 |
# File 'lib/saddle/options.rb', line 36 def use_ssl false end |