Class: Domainr::Client

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

Constant Summary collapse

DEFAULT_ENDPOINT =
'https://domainr.p.mashape.com'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



11
12
13
14
15
# File 'lib/domainr/client.rb', line 11

def initialize(options = {})
  @client_id = options.delete(:client_id)
  @mashape_key = options.delete(:mashape_key)
  @endpoint = options.delete(:endpoint) || DEFAULT_ENDPOINT
end

Instance Attribute Details

#client_idObject

Returns the value of attribute client_id.



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

def client_id
  @client_id
end

#endpointObject

Returns the value of attribute endpoint.



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

def endpoint
  @endpoint
end

#mashape_keyObject

Returns the value of attribute mashape_key.



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

def mashape_key
  @mashape_key
end

Instance Method Details

#search(query, options = {}) ⇒ Object



17
18
19
# File 'lib/domainr/client.rb', line 17

def search(query, options = {})
  perform_get_with_objects('/v2/search', options.merge(query: query), 'results', Domainr::Domain)
end

#status(domain, options = {}) ⇒ Object



21
22
23
# File 'lib/domainr/client.rb', line 21

def status(domain, options = {})
  perform_get_with_objects('/v2/status', options.merge(domain: domain), 'status', Domainr::Domain)
end