diff options
author | azul <azul@riseup.net> | 2017-09-23 15:11:20 +0000 |
---|---|---|
committer | azul <azul@riseup.net> | 2017-09-23 15:11:20 +0000 |
commit | fac140a8ff76e98c275194845125d4c97f4ba07b (patch) | |
tree | 08ffafb2c70935892e975704911080b9da84e391 /lib/nickserver/hkp/client.rb | |
parent | 787287318c54b019a12ef79525c9f5b10d93724d (diff) | |
parent | 8ac6bb8492c9a3b9ec5d7b5bf2b35907a1f8c332 (diff) |
Merge branch 'rubocop' into 'master'
Style fixes based on Rubocop
See merge request leap/nickserver!19
Diffstat (limited to 'lib/nickserver/hkp/client.rb')
-rw-r--r-- | lib/nickserver/hkp/client.rb | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/lib/nickserver/hkp/client.rb b/lib/nickserver/hkp/client.rb index d53daad..d632a36 100644 --- a/lib/nickserver/hkp/client.rb +++ b/lib/nickserver/hkp/client.rb @@ -1,18 +1,16 @@ 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 +require 'nickserver/config' + +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 +18,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 +26,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 +35,9 @@ module Nickserver; module Hkp def get(query) # in practice, exact=on seems to have no effect - query = {exact: 'on', options: 'mr'}.merge query - response = adapter.get Config.hkp_url, query: query - return response + query = { exact: 'on', options: 'mr' }.merge query + response = adapter.get Nickserver::Config.hkp_url, query: query + response end end -end; end +end |