Class: DeviceAtlas::Device::Config
- Inherits:
-
Object
- Object
- DeviceAtlas::Device::Config
- Defined in:
- lib/deviceatlas/device/config.rb
Overview
DeviceApi Configurations. To change the default configs of the DeviceAtlas DeviceApi create an instance of this class, set your preferred configs and pass the instance to the constructor of a DeviceApi or DeviceApiWeb.
Instance Attribute Summary collapse
-
#cookie_name ⇒ String
To change the cookie name that the client side properties would be set to.
-
#include_lang_props ⇒ Boolean
To check the Accept-Language header and include properties to the property set for getting client's language and locale preferences set to true.
-
#include_match_info ⇒ Boolean
To include the matched and unmatched parts of the User-Agent to the property set.
-
#include_ua_props ⇒ Boolean
To disable or enable DeviceApi.properties including User-Agent dynamic properties.
-
#max_cache_entries ⇒ Integer
Number of results to be kept in a cache buffer.
-
#return_nil_when_no_properties ⇒ Boolean
The default config value for DeviceApi.properties when there are no properties.
Instance Method Summary collapse
-
#initialize ⇒ DeviceAtlas::Device::Config
constructor
Creates a new instance of Config.
- #is_cache_enabled ⇒ Object
Constructor Details
#initialize ⇒ DeviceAtlas::Device::Config
Creates a new instance of Config
Instance Attribute Details
#cookie_name ⇒ String
To change the cookie name that the client side properties would be set to. If you want the client side properties to be used add the DeviceAtlas client side component (JS lib) to your web-site pages.
#include_lang_props ⇒ Boolean
To check the Accept-Language header and include properties to the property set for getting client's language and locale preferences set to true. If you do not use this properties you can set this config to false to make the detection marginally faster.
#include_match_info ⇒ Boolean
To include the matched and unmatched parts of the User-Agent to the property set.
#include_ua_props ⇒ Boolean
To disable or enable DeviceApi.properties including User-Agent dynamic properties. Some properties cannot be known before runtime and can change from User-Agent to User-Agent. The most common of these are the OS Version and the Browser Version. The DeviceApi is able to dynamically detect these changing properties with a small overhead. If you do not use this properties you can set this config to false to make the detection a little bit faster.
#max_cache_entries ⇒ Integer
Number of results to be kept in a cache buffer. Depending on the frequency and distance factor of your User-Agents or headers passed to the API for detection, increasing the result cache may increase performance by preventing repeated lookups. For a large set of inputs (i.e. an almost unique set of user-agents) set to lower numbers or zero to disable.
#return_nil_when_no_properties ⇒ Boolean
The default config value for DeviceApi.properties when there are no properties.