blob: 7c3ad956d209078c48f807cd95b2c2ab95fe09e0 (
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
|
#
# This class allows querying couch for public keys.
#
require 'nickserver/source'
require 'nickserver/couch_db/response'
require 'nickserver/config'
module Nickserver::CouchDB
class Source < Nickserver::Source
VIEW = '/_design/Identity/_view/pgp_key_by_email'
def query(nick)
status, body = adapter.get url, query: query_for(nick)
Response.new(nick, status: status, body: body)
end
protected
def url
Nickserver::Config.couch_url + VIEW
end
def query_for(nick)
{ reduce: "false", key: "\"#{nick}\"" }
end
attr_reader :config
end
end
|