diff options
author | Azul <azul@riseup.net> | 2017-09-23 11:07:32 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2017-09-23 16:53:27 +0200 |
commit | 40916407517f4bdb75a295caf29e02d4f403349b (patch) | |
tree | 8219567c0ecdf583fdd916594ec7915ab9eb2f19 /lib/nickserver/couch_db | |
parent | 22c6c80310a8d3d3abbd1006598b4fbaec98ffd0 (diff) |
style: rubocop mostly auto-correct
Diffstat (limited to 'lib/nickserver/couch_db')
-rw-r--r-- | lib/nickserver/couch_db/response.rb | 5 | ||||
-rw-r--r-- | lib/nickserver/couch_db/source.rb | 9 |
2 files changed, 6 insertions, 8 deletions
diff --git a/lib/nickserver/couch_db/response.rb b/lib/nickserver/couch_db/response.rb index fe482a8..eae5cc1 100644 --- a/lib/nickserver/couch_db/response.rb +++ b/lib/nickserver/couch_db/response.rb @@ -3,7 +3,6 @@ require 'json' module Nickserver::CouchDB class Response - def initialize(nick, couch_response = {}) @nick = nick @couch_status = couch_response[:status] @@ -39,7 +38,7 @@ module Nickserver::CouchDB end def key - rows.first["value"] + rows.first['value'] end def ok? @@ -51,7 +50,7 @@ module Nickserver::CouchDB end def rows - json["rows"] + json['rows'] end attr_reader :couch_status, :json, :nick diff --git a/lib/nickserver/couch_db/source.rb b/lib/nickserver/couch_db/source.rb index dd29c2a..b7531e4 100644 --- a/lib/nickserver/couch_db/source.rb +++ b/lib/nickserver/couch_db/source.rb @@ -9,9 +9,8 @@ module Nickserver::CouchDB class Error < StandardError; end class Source < Nickserver::Source - - VIEW = '/_design/Identity/_view/pgp_key_by_email' - UNEXPECTED_RESPONSE_CODES = [401, 500] + VIEW = '/_design/Identity/_view/pgp_key_by_email'.freeze + UNEXPECTED_RESPONSE_CODES = [401, 500].freeze def query(nick) status, body = adapter.get url, query: query_for(nick) @@ -23,7 +22,7 @@ module Nickserver::CouchDB def handle_unexpected_responses(status, body) if UNEXPECTED_RESPONSE_CODES.include? status - raise Error.new("Couch responded with #{status}: #{body}") + raise Error, "Couch responded with #{status}: #{body}" end end @@ -32,7 +31,7 @@ module Nickserver::CouchDB end def query_for(nick) - { reduce: "false", key: "\"#{nick}\"" } + { reduce: 'false', key: "\"#{nick}\"" } end attr_reader :config |