diff options
author | Azul <azul@riseup.net> | 2016-06-09 12:11:03 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2016-06-09 12:11:03 +0200 |
commit | 56263b6512f60cf055a925f5446f1f504bb65a4d (patch) | |
tree | 2e59de9101c5976bd002f5ffc816f9fd22d0c386 /lib/nickserver/hkp | |
parent | 80d85a0396fb0dbb27ac1b0885d5461ccc0cfbf2 (diff) |
add Hkp::Source with same interface as CouchDB::Source
Diffstat (limited to 'lib/nickserver/hkp')
-rw-r--r-- | lib/nickserver/hkp/fetch_key.rb | 2 | ||||
-rw-r--r-- | lib/nickserver/hkp/source.rb | 20 |
2 files changed, 21 insertions, 1 deletions
diff --git a/lib/nickserver/hkp/fetch_key.rb b/lib/nickserver/hkp/fetch_key.rb index 55eeefa..fe00473 100644 --- a/lib/nickserver/hkp/fetch_key.rb +++ b/lib/nickserver/hkp/fetch_key.rb @@ -53,4 +53,4 @@ module Nickserver; module Hkp end end -end; end
\ No newline at end of file +end; end diff --git a/lib/nickserver/hkp/source.rb b/lib/nickserver/hkp/source.rb new file mode 100644 index 0000000..79333f0 --- /dev/null +++ b/lib/nickserver/hkp/source.rb @@ -0,0 +1,20 @@ +require 'nickserver/hkp/response' +module Nickserver::Hkp + class Source + + def initialize(adapter) + end + + def query(nick) + fetcher.get(nick).callback {|key| + yield Response.new(nick, key) + }.errback {|status, msg| + yield Nickserver::Response.new(status, msg) + } + end + + def fetcher + Nickserver::Hkp::FetchKey.new + end + end +end |