diff options
Diffstat (limited to 'lib/nickserver/nicknym/source.rb')
-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 |