summaryrefslogtreecommitdiff
path: root/lib/nickserver
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2017-11-04 08:30:08 +0100
committerAzul <azul@riseup.net>2017-11-04 08:30:08 +0100
commit85a567286cf61a3a8193c339dd0967116d79299c (patch)
tree6e415b50e29d8c36f84c0d477fe12b3ee2ee1123 /lib/nickserver
parentec996134a1f23ee36aff9d3ad2c800af71623207 (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')
-rw-r--r--lib/nickserver/hkp/source.rb4
-rw-r--r--lib/nickserver/key_response.rb (renamed from lib/nickserver/hkp/response.rb)4
-rw-r--r--lib/nickserver/wkd/source.rb4
3 files changed, 6 insertions, 6 deletions
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
diff --git a/lib/nickserver/hkp/response.rb b/lib/nickserver/key_response.rb
index 2cc69d3..438dfc3 100644
--- a/lib/nickserver/hkp/response.rb
+++ b/lib/nickserver/key_response.rb
@@ -1,5 +1,5 @@
-module Nickserver::Hkp
- class Response
+module Nickserver
+ class KeyResponse
attr_reader :status, :content
def initialize(uid, key)
diff --git a/lib/nickserver/wkd/source.rb b/lib/nickserver/wkd/source.rb
index 43f0b2e..bf30c94 100644
--- a/lib/nickserver/wkd/source.rb
+++ b/lib/nickserver/wkd/source.rb
@@ -1,7 +1,7 @@
require 'nickserver/source'
require 'nickserver/response'
require 'nickserver/wkd/url'
-require 'nickserver/hkp/response'
+require 'nickserver/key_response'
module Nickserver::Wkd
# Query the web key directory for a given email address
@@ -10,7 +10,7 @@ module Nickserver::Wkd
url = Url.new(email)
status, blob = adapter.get url
if status == 200
- Nickserver::Hkp::Response.new(email.to_s, armor_key(blob))
+ Nickserver::KeyResponse.new(email.to_s, armor_key(blob))
end
end