class Domainsbot
Constants
- BASE_URI
Public Class Methods
api_key()
click to toggle source
# File lib/domainsbot.rb, line 29 def self.api_key; @@api_key; end
api_key=(key)
click to toggle source
Set the API key to be used for all requests
Attributes¶ ↑
-
key
- StringDomainsbot
API Key
Examples¶ ↑
Domainsbot.api_key = "MYAPIKEY"
# File lib/domainsbot.rb, line 25 def self.api_key=(key) @@api_key = key end
suggest(options={q: '', pageSize: 25, tlds: 'com,org,net', format: 'json'})
click to toggle source
Attributes¶ ↑
-
options
- Hash query parameters
Examples¶ ↑
Domainsbot.suggest({q: 'example.com', pageSize: 2, tlds: 'com,org,net'})
# File lib/domainsbot.rb, line 41 def self.suggest(options={q: '', pageSize: 25, tlds: 'com,org,net', format: 'json'}) options['auth-token'] = @@api_key options[:json] = 'json' uri = build_uri('/spinner', options) response = Net::HTTP.get_response(uri) return JSON.parse(response.body) end