Class: WhoisXMLAPI2::Configuration
- Inherits:
-
Object
- Object
- WhoisXMLAPI2::Configuration
- Defined in:
- lib/whoisxmlapi2/configuration.rb
Constant Summary collapse
- DEFAULT_SERVICE_ENDPOINT =
"https://whoisxmlapi.com/whoisserver/WhoisService?".freeze
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#browser_key ⇒ Object
Returns the value of attribute browser_key.
-
#mock_out_for_testing ⇒ Object
Returns the value of attribute mock_out_for_testing.
-
#secret ⇒ Object
Returns the value of attribute secret.
-
#url ⇒ Object
Returns the value of attribute url.
-
#username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
- #apply_configuration(params) ⇒ Object
-
#initialize(params = {}) ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(params = {}) ⇒ Configuration
Returns a new instance of Configuration.
8 9 10 |
# File 'lib/whoisxmlapi2/configuration.rb', line 8 def initialize(params = {}) apply_configuration(params) end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
3 4 5 |
# File 'lib/whoisxmlapi2/configuration.rb', line 3 def api_key @api_key end |
#browser_key ⇒ Object
Returns the value of attribute browser_key.
3 4 5 |
# File 'lib/whoisxmlapi2/configuration.rb', line 3 def browser_key @browser_key end |
#mock_out_for_testing ⇒ Object
Returns the value of attribute mock_out_for_testing.
3 4 5 |
# File 'lib/whoisxmlapi2/configuration.rb', line 3 def mock_out_for_testing @mock_out_for_testing end |
#secret ⇒ Object
Returns the value of attribute secret.
3 4 5 |
# File 'lib/whoisxmlapi2/configuration.rb', line 3 def secret @secret end |
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'lib/whoisxmlapi2/configuration.rb', line 3 def url @url end |
#username ⇒ Object
Returns the value of attribute username.
3 4 5 |
# File 'lib/whoisxmlapi2/configuration.rb', line 3 def username @username end |
Class Method Details
.set? ⇒ Boolean
13 14 15 16 17 |
# File 'lib/whoisxmlapi2/configuration.rb', line 13 def set? WhoisXMLAPI2.configuration.url && \ WhoisXMLAPI2.configuration.api_key || \ WhoisXMLAPI2.configuration.mock_out_for_testing end |
.set_v1? ⇒ Boolean
19 20 21 22 23 24 25 |
# File 'lib/whoisxmlapi2/configuration.rb', line 19 def set_v1? WhoisXMLAPI2.configuration.url && \ WhoisXMLAPI2.configuration.username && \ WhoisXMLAPI2.configuration.api_key && \ WhoisXMLAPI2.configuration.secret || \ WhoisXMLAPI2.configuration.mock_out_for_testing end |
Instance Method Details
#apply_configuration(params) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/whoisxmlapi2/configuration.rb', line 28 def apply_configuration(params) params[:url] ||= DEFAULT_SERVICE_ENDPOINT @username = params[:username] @api_key = params[:api_key] @secret = params[:secret] @url = params[:url] @browser_key = params[:browser_key] @mock_out_for_testing = params[:mock_out_for_testing] end |