# class Puppet::Indirector::Couch

### Public Class Methods

db() click to toggle source

The CouchRest database instance. One database instance per Puppet runtime should be sufficient.

    # File lib/puppet/indirector/couch.rb, line 6
    def self.db; @db ||= CouchRest.database! Puppet[:couchdb_url] end

new(*args) click to toggle source
Calls superclass method Puppet::Indirector::Terminus.new

    # File lib/puppet/indirector/couch.rb, line 13
    def initialize(*args)
      raise "Couch terminus not supported without couchrest gem" unless Puppet.features.couchdb?
      super
    end

### Public Instance Methods

db() click to toggle source

    # File lib/puppet/indirector/couch.rb, line 7
    def db; self.class.db end

find(request) click to toggle source

    # File lib/puppet/indirector/couch.rb, line 9
    def find(request)
      attributes_of get(request)
    end

save(request) click to toggle source

Create or update the couchdb document with the request’s data hash.

    # File lib/puppet/indirector/couch.rb, line 20
    def save(request)
      raise ArgumentError, "PUT does not accept options" unless request.options.empty?
      update(request) || create(request)
    end