Class: Etcdv3::Connection
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/connection.rb
Constant Summary collapse
- NAMESPACE_HANDLERS =
{ kv: Etcdv3::Namespace::KV, watch: Etcdv3::Namespace::Watch, lock: Etcdv3::Namespace::Lock, }
- HANDLERS =
{ auth: Etcdv3::Auth, kv: Etcdv3::KV, maintenance: Etcdv3::Maintenance, lease: Etcdv3::Lease, watch: Etcdv3::Watch, lock: Etcdv3::Lock, }
Instance Attribute Summary collapse
-
#credentials ⇒ Object
readonly
Returns the value of attribute credentials.
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#handlers ⇒ Object
readonly
Returns the value of attribute handlers.
-
#hostname ⇒ Object
readonly
Returns the value of attribute hostname.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
Instance Method Summary collapse
- #call(stub, method, method_args = []) ⇒ Object
-
#initialize(url, timeout, namespace, metadata = {}) ⇒ Connection
constructor
A new instance of Connection.
- #refresh_metadata(metadata) ⇒ Object
Constructor Details
#initialize(url, timeout, namespace, metadata = {}) ⇒ Connection
Returns a new instance of Connection.
21 22 23 24 25 26 27 28 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/connection.rb', line 21 def initialize(url, timeout, namespace, ={}) @endpoint = URI(url) @hostname = "#{@endpoint.hostname}:#{@endpoint.port}" @namespace = namespace @credentials = resolve_credentials @timeout = timeout @handlers = handler_map() end |
Instance Attribute Details
#credentials ⇒ Object (readonly)
Returns the value of attribute credentials.
19 20 21 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/connection.rb', line 19 def credentials @credentials end |
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
19 20 21 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/connection.rb', line 19 def endpoint @endpoint end |
#handlers ⇒ Object (readonly)
Returns the value of attribute handlers.
19 20 21 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/connection.rb', line 19 def handlers @handlers end |
#hostname ⇒ Object (readonly)
Returns the value of attribute hostname.
19 20 21 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/connection.rb', line 19 def hostname @hostname end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
19 20 21 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/connection.rb', line 19 def namespace @namespace end |
Instance Method Details
#call(stub, method, method_args = []) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/connection.rb', line 30 def call(stub, method, method_args=[]) *method_args, method_kwargs = method_args if method_args.last.class == Hash if method_kwargs.nil? @handlers.fetch(stub).send(method, *method_args) else @handlers.fetch(stub).send(method, *method_args, **method_kwargs) end end |
#refresh_metadata(metadata) ⇒ Object
40 41 42 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/connection.rb', line 40 def () @handlers = handler_map() end |