Sha256: 11166e43c8531406a3a19b5f581c8e33c2b551a5f7898cbc890b855721b66c3a

Contents?: true

Size: 873 Bytes

Versions: 3

Compression:

Stored size: 873 Bytes

Contents

class Etcdv3
  class Request

    attr_reader :metacache

    def initialize(hostname, credentials, metadata, metacache)
      @hostname = hostname
      @credentials = credentials
      @metadata = metadata
      @metacache = metacache
    end

    def handle(interface, method, method_args=[])
      interface = resolve_interface(interface)
      interface.send(method, *method_args)
    end

    private

    def resolve_interface(interface)
      self.send(interface)
    end

    def auth
      @auth ||= Etcdv3::Auth.new(@hostname, @credentials, @metadata)
    end

    def kv
      @kv ||= Etcdv3::KV.new(@hostname, @credentials, @metadata)
    end

    def maintenance
      @maintenance ||= Etcdv3::Maintenance.new(@hostname, @credentials, @metadata)
    end

    def lease
      @lease ||= Etcdv3::Lease.new(@hostname, @credentials, @metadata)
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
etcdv3-0.3.2 lib/etcdv3/request.rb
etcdv3-0.3.1 lib/etcdv3/request.rb
etcdv3-0.3.0 lib/etcdv3/request.rb