summaryrefslogtreecommitdiff
path: root/lib/tapicero/couch_database_creator.rb
blob: 4d39c1b722c81677dbe7b0f28360a97ba6781705 (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