Class: NicAr::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/nic_ar/client.rb

Overview

NicAr::Client Simple HTTP client for accessing the public nic!alert API. Full API spec. available at api.nicalert.me/docs

©2014 Cristian R. Arroyo <[email protected]>

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token = nil) ⇒ Client

Returns a new instance of Client.



11
12
13
# File 'lib/nic_ar/client.rb', line 11

def initialize(token=nil)
  @token = token
end

Instance Attribute Details

#tokenObject (readonly)

Returns the value of attribute token.



9
10
11
# File 'lib/nic_ar/client.rb', line 9

def token
  @token
end

Instance Method Details

#whois(name = nil) ⇒ Object

:nodoc:



15
16
17
18
19
20
21
# File 'lib/nic_ar/client.rb', line 15

def whois(name=nil)  #:nodoc:
  if name
    request "whois/#{name}" + (@token.nil? || @token.empty?? '' : "?token=#{@token}")
  else
    request "whois"
  end
end