Class: Saddle::Client
- Inherits:
-
Object
- Object
- Saddle::Client
- Extended by:
- MethodTreeBuilder, Options
- Defined in:
- lib/saddle.rb
Class Attribute Summary collapse
-
.additional_middlewares ⇒ Object
Returns the value of attribute additional_middlewares.
-
.parent_module ⇒ Object
Returns the value of attribute parent_module.
Class Method Summary collapse
-
.create(opt = {}) ⇒ Object
Once your implementation is written, this is the magic you need to create a client instance.
- .inherited(obj) ⇒ Object
Methods included from MethodTreeBuilder
build_node_children, build_root_node, build_tree, endpoints_directory, endpoints_module, implementation_module, knows_root?
Methods included from Options
add_middleware, default_options, host, instrumentation_key, num_retries, path_prefix, port, request_style, stubs, timeout, use_ssl
Class Attribute Details
.additional_middlewares ⇒ Object
Returns the value of attribute additional_middlewares.
20 21 22 |
# File 'lib/saddle.rb', line 20 def additional_middlewares @additional_middlewares end |
.parent_module ⇒ Object
Returns the value of attribute parent_module.
20 21 22 |
# File 'lib/saddle.rb', line 20 def parent_module @parent_module end |
Class Method Details
.create(opt = {}) ⇒ Object
Once your implementation is written, this is the magic you need to create a client instance.
24 25 26 27 28 29 30 31 |
# File 'lib/saddle.rb', line 24 def create(opt={}) self.build_tree( Saddle::Requester.new( self, .merge(opt) ) ) end |
.inherited(obj) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/saddle.rb', line 33 def inherited(obj) # Clone the parent's additional_middlewares obj.additional_middlewares = if defined?(obj.superclass.additional_middlewares) (obj.superclass.additional_middlewares || []).clone else [] end # Add additional client attributes obj.send(:include, Saddle::ClientAttributes) # Store the parent module in case we need it later @parent_module = Module.nesting.last end |