class Mobi::Mtld::Da::Device::Tree

Copyright
Author

Constants

API_ID
KEY_CHILDREN

tree key - has children

KEY_COMPILED_REGEX

tree key - list of compiled regexes

KEY_DATA

tree key - property data

KEY_DEVICE_ID

device-id property name

KEY_HEADERS

tree key - user-agent header names {“h”:{“sl”:}}

KEY_MAIN

tree key - tree main branch

KEY_MASKED

tree key - masked properties

KEY_META

tree key - {DATA-META-DATA}

KEY_META_REVISION

tree key - tree revision

KEY_META_TIMESTAMP

tree key - tree create time-stamp

KEY_META_VERSION

tree key - tree structure version

KEY_PROPERTY_NAMES

tree key - property names [property-name,]

KEY_REGEX

tree key - list of regexes [regex(String),]

KEY_UA_STOCK_HEADERS

tree key - stock user-agent header names {“h”:{“sl”:}}

KEY_VALUES

tree key - property values [property-value,]

MAP_INITIAL_CAPACITY

for MAP optimization, set to average number properties

MIN_JSON_VERSION

Attributes

data_revision[R]
properties[R]
stock_ua_headers[R]

A list of http-headers which may contain the original user-agent. if the tree does not contain KEY_UA_STOCK_HEADERS then this list will be used

tree[R]

Public Class Methods

new(json, config) click to toggle source

Load the JSON tree into a Hash.

Public Instance Methods

data_creation_timestamp() click to toggle source

Get data file creation timestamp

data_version() click to toggle source

Get data file version

property_name_by_id(property_id) click to toggle source
property_names() click to toggle source

Get the list of all available property names from the tree (not contains client side props)

property_value_by_id(value_id) click to toggle source
put_properties(user_agent, stock_user_agents, client_side_properties = nil) click to toggle source

Get properties from tree walk/ua/client-side and put them in the tree.properties

user_agent

user-agent string (from the original User-Agent header) to be

used for detecting ua-props

stock_user_agents

list of candidate user-agent strings to be used for

tree walk

client_side_properties

optional client side properties

put_tree_walk_properties(user_agent, stock_user_agents = nil) click to toggle source

Get properties from tree walk/ua and put them in the tree.properties

if !stock_user_agents.nil?

- iterate over stockUserAgents
  for each item: tree-walk and stop iteration if result has deviceId
- use userAgent for detecting the ua-props

if stock_user_agents.nil?

- use userAgent for tree walk
- use userAgent for detecting the ua-props
user_agent

user-agent string (from the original User-Agent header)

stock_user_agents

list of candidate user-agent strings to be used for

tree walk