Class: DetectLanguage::Configuration
- Inherits:
-
Object
- Object
- DetectLanguage::Configuration
- Defined in:
- lib/detect_language/configuration.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
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.
-
#api_version ⇒ Object
The API version you are using (defaults to 0.2).
-
#host ⇒ Object
The host to connect to (defaults to ws.detectlanguage.com).
-
#http_open_timeout ⇒ Object
The HTTP open timeout in seconds.
-
#http_read_timeout ⇒ Object
The HTTP read timeout in seconds.
-
#port ⇒ Object
The port on which your DetectLanguage server runs (defaults to 443 for secure connections, 80 for insecure connections).
-
#proxy_host ⇒ Object
The hostname of your proxy server (if using a proxy).
-
#proxy_pass ⇒ Object
The password to use when logging into your proxy server (if using a proxy).
-
#proxy_port ⇒ Object
The port of your proxy server (if using a proxy).
-
#proxy_user ⇒ Object
The username to use when logging into your proxy server (if using a proxy).
-
#secure ⇒ Object
(also: #secure?)
true
for https connections,false
for http connections. -
#user_agent ⇒ Object
HTTP request user agent (defaults to ‘Detect Language API ruby gem’).
Instance Method Summary collapse
-
#[](option) ⇒ Object
Allows config options to be read like a hash.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #protocol ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
43 44 45 46 47 48 |
# File 'lib/detect_language/configuration.rb', line 43 def initialize @api_key = nil @api_version = "0.2" @host = "ws.detectlanguage.com" @user_agent = "Detect Language API ruby gem" end |
Instance Attribute Details
#api_key ⇒ Object
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.
5 6 7 |
# File 'lib/detect_language/configuration.rb', line 5 def api_key @api_key end |
#api_version ⇒ Object
The API version you are using (defaults to 0.2).
8 9 10 |
# File 'lib/detect_language/configuration.rb', line 8 def api_version @api_version end |
#host ⇒ Object
The host to connect to (defaults to ws.detectlanguage.com).
14 15 16 |
# File 'lib/detect_language/configuration.rb', line 14 def host @host end |
#http_open_timeout ⇒ Object
The HTTP open timeout in seconds.
24 25 26 |
# File 'lib/detect_language/configuration.rb', line 24 def http_open_timeout @http_open_timeout end |
#http_read_timeout ⇒ Object
The HTTP read timeout in seconds.
27 28 29 |
# File 'lib/detect_language/configuration.rb', line 27 def http_read_timeout @http_read_timeout end |
#port ⇒ Object
The port on which your DetectLanguage server runs (defaults to 443 for secure connections, 80 for insecure connections).
18 19 20 |
# File 'lib/detect_language/configuration.rb', line 18 def port @port end |
#proxy_host ⇒ Object
The hostname of your proxy server (if using a proxy).
30 31 32 |
# File 'lib/detect_language/configuration.rb', line 30 def proxy_host @proxy_host end |
#proxy_pass ⇒ Object
The password to use when logging into your proxy server (if using a proxy).
39 40 41 |
# File 'lib/detect_language/configuration.rb', line 39 def proxy_pass @proxy_pass end |
#proxy_port ⇒ Object
The port of your proxy server (if using a proxy).
33 34 35 |
# File 'lib/detect_language/configuration.rb', line 33 def proxy_port @proxy_port end |
#proxy_user ⇒ Object
The username to use when logging into your proxy server (if using a proxy).
36 37 38 |
# File 'lib/detect_language/configuration.rb', line 36 def proxy_user @proxy_user end |
#secure ⇒ Object Also known as: secure?
true
for https connections, false
for http connections.
21 22 23 |
# File 'lib/detect_language/configuration.rb', line 21 def secure @secure end |
#user_agent ⇒ Object
HTTP request user agent (defaults to ‘Detect Language API ruby gem’).
11 12 13 |
# File 'lib/detect_language/configuration.rb', line 11 def user_agent @user_agent end |
Instance Method Details
#[](option) ⇒ Object
Allows config options to be read like a hash
65 66 67 |
# File 'lib/detect_language/configuration.rb', line 65 def [](option) send(option) end |
#protocol ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/detect_language/configuration.rb', line 50 def protocol if secure? 'https' else 'http' end end |