Module: Saddle::Options
- Included in:
- Client
- Defined in:
- lib/saddle/options.rb
Instance Method Summary collapse
-
#add_middleware(m) ⇒ Object
Use this to add additional middleware to the request stack ex: add_middleware({ :klass => MyMiddleware, :args => [arg1, arg2], }) end.
-
#default_options ⇒ Object
Construct our default options, based upon the class methods.
-
#host ⇒ Object
The default host for this client.
-
#instrumentation_key ⇒ Object
If you want to set up an ActiveSupport::Notification, give your client an instrumentation key to monitor.
-
#num_retries ⇒ Object
Default number of retries per request.
-
#path_prefix ⇒ Object
A string prefix to prepend to paths as they are build (ie, ‘v1’).
-
#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
Use this to add additional middleware to the request stack ex: add_middleware(
:klass => MyMiddleware,
:args => [arg1, arg2],
) end
75 76 77 |
# File 'lib/saddle/options.rb', line 75 def add_middleware m self.additional_middlewares << m end |
#default_options ⇒ Object
Construct our default options, based upon the class methods
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/saddle/options.rb', line 8 def { :host => host, :port => port, :path_prefix => path_prefix, :use_ssl => use_ssl, :request_style => request_style, :num_retries => num_retries, :timeout => timeout, :additional_middlewares => self.additional_middlewares, :stubs => stubs, } end |
#host ⇒ Object
The default host for this client
23 24 25 |
# File 'lib/saddle/options.rb', line 23 def host 'localhost' end |
#instrumentation_key ⇒ Object
If you want to set up an ActiveSupport::Notification, give your client
an instrumentation key to monitor.
60 61 62 |
# File 'lib/saddle/options.rb', line 60 def instrumentation_key nil end |
#num_retries ⇒ Object
Default number of retries per request
49 50 51 |
# File 'lib/saddle/options.rb', line 49 def num_retries 3 end |
#path_prefix ⇒ Object
A string prefix to prepend to paths as they are build (ie, ‘v1’)
33 34 35 |
# File 'lib/saddle/options.rb', line 33 def path_prefix nil end |
#port ⇒ Object
The default port for this client
28 29 30 |
# File 'lib/saddle/options.rb', line 28 def port nil end |
#request_style ⇒ Object
The POST/PUT style for this client options are [:json, :urlencoded]
44 45 46 |
# File 'lib/saddle/options.rb', line 44 def request_style :json end |
#stubs ⇒ Object
If the Typhoeus adapter is being used, pass stubs to it for testing.
80 81 82 |
# File 'lib/saddle/options.rb', line 80 def stubs nil end |
#timeout ⇒ Object
Default timeout per request (in seconds)
54 55 56 |
# File 'lib/saddle/options.rb', line 54 def timeout 30 end |
#use_ssl ⇒ Object
Should this client use SSL by default?
38 39 40 |
# File 'lib/saddle/options.rb', line 38 def use_ssl false end |