summaryrefslogtreecommitdiff
path: root/lib/nickserver/hkp/client.rb
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2017-09-23 11:07:32 +0200
committerAzul <azul@riseup.net>2017-09-23 16:53:27 +0200
commit40916407517f4bdb75a295caf29e02d4f403349b (patch)
tree8219567c0ecdf583fdd916594ec7915ab9eb2f19 /lib/nickserver/hkp/client.rb
parent22c6c80310a8d3d3abbd1006598b4fbaec98ffd0 (diff)
style: rubocop mostly auto-correct
Diffstat (limited to 'lib/nickserver/hkp/client.rb')
-rw-r--r--lib/nickserver/hkp/client.rb31
1 files changed, 14 insertions, 17 deletions
diff --git a/lib/nickserver/hkp/client.rb b/lib/nickserver/hkp/client.rb
index d53daad..3dbb1de 100644
--- a/lib/nickserver/hkp/client.rb
+++ b/lib/nickserver/hkp/client.rb
@@ -1,18 +1,15 @@
require 'nickserver/hkp'
-#
-# Client for the HKP protocol.
-#
-# This is not a complete implementation - only the parts we need.
-# Instantiate with an adapter that will take care of the http requests.
-#
-# For each request we yield http_status and the response content just
-# like the adapter does.
-
-
-module Nickserver; module Hkp
+module Nickserver::Hkp
+ #
+ # Client for the HKP protocol.
+ #
+ # This is not a complete implementation - only the parts we need.
+ # Instantiate with an adapter that will take care of the http requests.
+ #
+ # For each request we yield http_status and the response content just
+ # like the adapter does.
class Client
-
def initialize(adapter)
@adapter = adapter
end
@@ -20,7 +17,7 @@ module Nickserver; module Hkp
#
# used to fetch an array of KeyInfo objects that match the given email
#
- def get_key_infos_by_email(email, &block)
+ def get_key_infos_by_email(email)
get op: 'vindex', search: email.to_s, fingerprint: 'on'
end
@@ -28,7 +25,7 @@ module Nickserver; module Hkp
# fetches ascii armored OpenPGP public key from the keyserver
#
def get_key_by_fingerprint(fingerprint)
- get op: 'get', search: "0x" + fingerprint
+ get op: 'get', search: '0x' + fingerprint
end
protected
@@ -37,9 +34,9 @@ module Nickserver; module Hkp
def get(query)
# in practice, exact=on seems to have no effect
- query = {exact: 'on', options: 'mr'}.merge query
+ query = { exact: 'on', options: 'mr' }.merge query
response = adapter.get Config.hkp_url, query: query
- return response
+ response
end
end
-end; end
+end