Sha256: 90212ab2a797e773641b4c76310ffe38266c0b59e1929fc93a194c38a22a9b54

Contents?: true

Size: 863 Bytes

Versions: 3

Compression:

Stored size: 863 Bytes

Contents

class Etcd
  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 ||= Etcd::Auth.new(@hostname, @credentials, @metadata)
    end

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

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

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

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
etcdv3-0.2.0 lib/etcdv3/request.rb
etcdv3-0.1.5 lib/etcdv3/request.rb
etcdv3-0.1.4 lib/etcdv3/request.rb