diff options
author | Azul <azul@riseup.net> | 2017-11-04 08:30:08 +0100 |
---|---|---|
committer | Azul <azul@riseup.net> | 2017-11-04 08:30:08 +0100 |
commit | 85a567286cf61a3a8193c339dd0967116d79299c (patch) | |
tree | 6e415b50e29d8c36f84c0d477fe12b3ee2ee1123 /lib/nickserver/hkp | |
parent | ec996134a1f23ee36aff9d3ad2c800af71623207 (diff) |
refactor: turn Hkp::Response into KeyResponserefactor/clarify-response
We now also use it from wkd and it seems like a generally
useful kind of response.
Diffstat (limited to 'lib/nickserver/hkp')
-rw-r--r-- | lib/nickserver/hkp/response.rb | 16 | ||||
-rw-r--r-- | lib/nickserver/hkp/source.rb | 4 |
2 files changed, 2 insertions, 18 deletions
diff --git a/lib/nickserver/hkp/response.rb b/lib/nickserver/hkp/response.rb deleted file mode 100644 index 2cc69d3..0000000 --- a/lib/nickserver/hkp/response.rb +++ /dev/null @@ -1,16 +0,0 @@ -module Nickserver::Hkp - class Response - attr_reader :status, :content - - def initialize(uid, key) - @content = format_response(address: uid, openpgp: key) - @status = 200 - end - - protected - - def format_response(map) - map.to_json - end - end -end diff --git a/lib/nickserver/hkp/source.rb b/lib/nickserver/hkp/source.rb index d7c86a3..fe3c4a5 100644 --- a/lib/nickserver/hkp/source.rb +++ b/lib/nickserver/hkp/source.rb @@ -1,6 +1,6 @@ require 'nickserver/source' require 'nickserver/response' -require 'nickserver/hkp/response' +require 'nickserver/key_response' require 'nickserver/hkp/client' require 'nickserver/hkp/parse_key_info' require 'nickserver/hkp/key_info' @@ -30,7 +30,7 @@ module Nickserver::Hkp def get_key_by_fingerprint(fingerprint, nick = nil) status, response = client.get_key_by_fingerprint fingerprint if status == 200 - Response.new nick, response + Nickserver::KeyResponse.new nick, response else Nickserver::Response.new status, 'HKP Request failed' end |