summaryrefslogtreecommitdiff
path: root/lib/tapicero/couch_database_creator.rb
blob: 5a2849b85c6004d9f87ce27635569f0b84f3ec3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require 'couchrest'
require 'json'

module Tapicero
  class CouchDatabaseCreator

    def initialize(host)
      @host = host
      @couch = CouchRest.new(host)
    end

    def create(name, security = {})
      db = @couch.create_db(name)
      puts security.to_json
      puts "-> #{@host}#{name}/_security"
      CouchRest.put "#{@host}#{name}/_security", security
    end
  end
end