diff options
author | Azul <azul@riseup.net> | 2016-09-12 11:42:02 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2016-09-12 11:42:02 +0200 |
commit | ce09dd9c21d79e2260f9436e41f9970b42935b27 (patch) | |
tree | f620f8bf3d7386d8a5a48b1feb0a18c58269c128 /lib/nickserver/nicknym | |
parent | f18d698d09afda894a568de79c5770704a0c9de7 (diff) |
[wip] nicknym source query implemented
Also changed Nickserver::Response to not include the status code.
This may be okay for error responses but in most cases we want to
have a parsable message and not some status code prepended to it.
Diffstat (limited to 'lib/nickserver/nicknym')
-rw-r--r-- | lib/nickserver/nicknym/source.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/nickserver/nicknym/source.rb b/lib/nickserver/nicknym/source.rb index 1be0c2a..3957cdd 100644 --- a/lib/nickserver/nicknym/source.rb +++ b/lib/nickserver/nicknym/source.rb @@ -1,14 +1,26 @@ require 'nickserver/source' +require 'nickserver/response' module Nickserver module Nicknym class Source < Nickserver::Source def available_for?(domain) - status, _body = adapter.get "https://#{domain}/provider.json" + status, _body = get "#{domain}/provider.json" status == 200 end + def query(email) + status, body = get "nicknym.#{email.domain}", address: email.to_s + return Nickserver::Response.new(status, body) + end + + protected + + def get(*args) + args[0] = "https://#{args.first}" + adapter.get *args + end end end end |