blob: fffa76ed6493441a97a1c3979e8dbcd22bca6639 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#
# This class allows querying couch for public keys.
#
require 'nickserver/couch_db/response'
module Nickserver::CouchDB
class Source
VIEW = '/_design/Identity/_view/pgp_key_by_email'
def initialize(adapter)
@adapter = adapter
end
def query(nick)
adapter.get VIEW, query: query_for(nick) do |status, body|
yield Response.new nick, status: status, body: body
end
end
protected
def query_for(nick)
{ reduce: "false", key: "\"#{nick}\"" }
end
def adapter
@adapter
# Nickserver::Adapters::Http.new(config)
end
attr_reader :config
end
end
|