WURFL InFuze for Ruby is a Ruby module wrapping the WURFL C API and
encapsulating it in an object oriented manner to provide a fast and intuitive
interface. It is released for
linux/macos platforms for ruby versions 1.9
In order for the Module to work it is ESSENTIAL that the
libwurfl library is installed on your system.
libwurfl is provided in your Customer Vault/FileX.
InFuze for Ruby is available as a gem and requires the WURFL InFuze C API
to be installed. If you have not already installed
can be found here. Release notes for each API can be found here. You will
On debian based linux:
$ sudo apt-get install ruby-dev $ sudo apt-get install rubygems
$ sudo yum install ruby-devel $ sudo yum install rubygems
Now install the gem:
$ sudo gem install --no-ri --no-rdoc wurfl-<version>.gem
The Ruby module has been tested with a RubyInstaller
environment on Windows for installation instructions. On Windows, WURFL InFuze libs
Install the gem:
C:\> gem install --no-ri --no-rdoc wurfl-<version>.gem
Note: if you encounter any problem with
RubyInstaller, please verify you correctly
set up the environment variables.
Here is an example to get started using InFuze for Ruby:
require 'wurfl_obj' # create Wurfl object MyWurfl = Wurfl.new("wurfl.zip", patches=, engine_target=:WURFL_ENGINE_TARGET_DEFAULT, cache_provider=:WURFL_CACHE_PROVIDER_DOUBLE_LRU, cache_extra_config="10000,3000") # Define a test User Agent UserAgent = "Mozilla/5.0 (Linux; Android 5.0; SAMSUNG SM-G925 Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/4.0 Chrome/44.0.2403.133 Mobile Safari/537.36" # Lookup a UserAgent string begin dev = MyWurfl.parse_useragent(UserAgent) rescue WurflError => err puts err.errorcode puts err.errormessage end # print deviceid print("deviceid = " + dev.get_device_id() + "\n") # device ID # print device capability print("is_mobile = " + dev.get_capability("is_mobile") + "\n") # capability # print virtual capability print("is_ios = " + dev.get_capability("is_ios") + "\n") # virtual capability # get a set of capabilities print(dev.get_capabilities(["brand_name", "model_name", "is_ios"])) # Get all capabilities print(dev.list_device_capabilities()) # Release the device object to avoid memory leaks dev.release()
Prior to version 1.9 of the API, users could choose between High Accuracy and High Performance engine optimization options. These options had been introduced years ago to manage the behavior of certain web browsers and their tendency to present "always different" User-Agent strings that would baffle strategies to cache similar WURFL queries in memory. As the problem has been solved by browser vendors, the need to adopt this strategy has diminished and ultimately disappeared (i.e. there was no longer much to be gained with the high-performance mode in most circumstances) and ScientiaMobile elected to "remove" this option to simplify configuration and go in the direction of uniform API behavior in different contexts.
When we wrote "remove" in the previous sentence, we were not being totally accurate. Customers who may find themselves in the unlikely situation of having to analyze significant amounts of legacy web traffic, may still enable the old high-performance internal behavior by passing :WURFL_ENGINE_TARGET_FAST_DESKTOP_BROWSER_MATCH to engine_target parameter when creating the WURFL engine. Please note that users with the old HIGH PERFORMANCE target engine will not receive an error. The old behavior will not be triggered, though. The default target (corresponding to the old High Accuracy) will be used instead.
If you want to keep your
wurfl.zip up-to-date with the ScientiaMobile data release schedule, then you might want to use the Updater features,
available in Ruby WURFL as follows :
After creating your WURFL engine, set your personal WURFL Snapshot URL (in the form "https://data.scientiamobile.com/xxxxx/wurfl.zip", with "xxxxx" replaced with your personal access token, located in your license account page):
begin MyWurfl.set_updater_data_url("https://data.scientiamobile.com/<your access token>/wurfl.zip") rescue WurflError => err puts err.errorcode puts err.errormessage end
Optionally, specify which periodicity (DAILY or WEEKLY, default is DAILY) you would like for update checks:
Then start the updater:
begin MyWurfl.updater_start() rescue WurflError => err puts err.errorcode puts err.errormessage end
Updater will run a periodic check for the latest release of the
wurfl.zip file, eventually download it, and update the running engine to the latest version - all during normal application operations.
The internal updater supports also simple file logging, useful to debug network problems and the like:
Please note also:
The WURFL data file and the path where it resides, specified in the WURFL engine construction,
ScientiaMobile does not distribute uncompressed XML data files via updater. This means that, if you plan to use the updater, you
Please note that
set_updater_data_frequency() sets how often the updater
The WURFL InFuze Updater functionality relies on availability and features of the well-known and widely available
curl command-line utility. A check for
curl availability is done in the
2017 ScientiaMobile Incorporated All Rights Reserved.
NOTICE: All information contained herein is, and remains the property of ScientiaMobile Incorporated and its suppliers, if any. The intellectual and technical concepts contained herein are proprietary to ScientiaMobile Incorporated and its suppliers and may be covered by U.S. and Foreign Patents, patents in process, and are protected by trade secret or copyright law. Dissemination of this information or reproduction of this material is strictly forbidden unless prior written permission is obtained from ScientiaMobile Incorporated.
2017 - ScientiaMobile, Inc. All rights reserved. WURFL® is the registered trademark of ScientiaMobile, Inc.