Class: CommandTower::Clients::ScopedClient::NamespaceHandle
- Inherits:
-
Object
- Object
- CommandTower::Clients::ScopedClient::NamespaceHandle
- Defined in:
- app/services/command_tower/clients/scoped_client.rb
Overview
Fresh endpoint instances bound to this scoped client (not memoized).
Instance Method Summary collapse
-
#initialize(scoped_client:, namespace_proxy:) ⇒ NamespaceHandle
constructor
A new instance of NamespaceHandle.
- #method_missing(name, *args, **attributes, &block) ⇒ Object
- #respond_to_missing?(_name, _include_private = false) ⇒ Boolean
Constructor Details
#initialize(scoped_client:, namespace_proxy:) ⇒ NamespaceHandle
Returns a new instance of NamespaceHandle.
59 60 61 62 |
# File 'app/services/command_tower/clients/scoped_client.rb', line 59 def initialize(scoped_client:, namespace_proxy:) @scoped_client = scoped_client @namespace_proxy = namespace_proxy end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, **attributes, &block) ⇒ Object
64 65 66 67 68 69 70 |
# File 'app/services/command_tower/clients/scoped_client.rb', line 64 def method_missing(name, *args, **attributes, &block) raise ArgumentError, "endpoint invocation does not take a block" if block raise ArgumentError, "endpoint invocation does not take positional args" if args.any? endpoint = @namespace_proxy.build_endpoint(name, client: @scoped_client) endpoint.call(**attributes) end |
Instance Method Details
#respond_to_missing?(_name, _include_private = false) ⇒ Boolean
72 73 74 |
# File 'app/services/command_tower/clients/scoped_client.rb', line 72 def respond_to_missing?(_name, _include_private = false) true end |