class DetectLanguage::Configuration
Attributes
The API key for your project, found on your homepage after you login into detectlanguage.com website Defaults to 'demo', which has a limited number of requests.
The API version you are using (defaults to 0.2).
The host to connect to (defaults to ws.detectlanguage.com).
The HTTP open timeout in seconds.
The HTTP read timeout in seconds.
The port on which your DetectLanguage
server runs (defaults to 443 for secure connections, 80 for insecure connections).
The hostname of your proxy server (if using a proxy).
The password to use when logging into your proxy server (if using a proxy).
The port of your proxy server (if using a proxy).
The username to use when logging into your proxy server (if using a proxy).
true
for https connections, false
for http connections.
true
for https connections, false
for http connections.
HTTP request user agent (defaults to 'Detect Language API ruby gem').
Public Class Methods
# File lib/detect_language/configuration.rb, line 43 def initialize @api_key = nil @api_version = "0.2" @host = "ws.detectlanguage.com" @user_agent = "detectlanguage-ruby/#{VERSION}" end
Public Instance Methods
Allows config options to be read like a hash
@param [Symbol] option Key for a given attribute
# File lib/detect_language/configuration.rb, line 65 def [](option) send(option) end
# File lib/detect_language/configuration.rb, line 50 def protocol if secure? 'https' else 'http' end end
Private Instance Methods
Determines what port should we use for sending requests. @return [Fixnum] Returns 443 if you've set secure to true in your configuration, and 80 otherwise.
# File lib/detect_language/configuration.rb, line 74 def default_port if secure? 443 else 80 end end