Class: DeviceAtlas::Device::Tree
- Inherits:
-
Object
- Object
- DeviceAtlas::Device::Tree
- Defined in:
- lib/deviceatlas/device/tree.rb
Overview
This class is used by the main API class and should not be used directly.
Instance Attribute Summary collapse
-
#data_revision ⇒ String
readonly
The device data (JSON file) version.
-
#stock_ua_headers ⇒ Array<String>
readonly
A list of HTTP headers which may contain the original User-Agent.
- #tree ⇒ Hash readonly
Instance Method Summary collapse
-
#data_creation_timestamp ⇒ String
Parse the device data creation (JSON file) timestamp.
-
#data_version ⇒ String
Parse the device data (JSON file) version.
-
#initialize(json, config) ⇒ Tree
constructor
Create a new instance of Tree.
-
#property_name_by_id(property_id) ⇒ String
Get the name of a property from its identifier.
-
#property_names ⇒ Hash<PropertyName>
Get the names of all the possible properties stored in the tree.
-
#property_type_by_id(property_id) ⇒ Char
Get the type of a property from its identifier.
-
#property_value_by_id(value_id) ⇒ String
Get the value of a property from its identifier.
-
#property_value_typed(value_id, byte) ⇒ Object
Convert the value of a property based on its data type.
-
#put_properties(user_agent, stock_user_agents, client_side = nil, properties) ⇒ Object
Get properties from tree walk/ua/client-side.
-
#put_tree_walk_properties(user_agent, stock_user_agents = nil, properties) ⇒ Object
Get properties from tree walk/ua.
- #set_config(config) ⇒ Object
Constructor Details
#initialize(json, config) ⇒ Tree
Create a new instance of Tree.
Instance Attribute Details
#data_revision ⇒ String (readonly)
The device data (JSON file) version.
#stock_ua_headers ⇒ Array<String> (readonly)
A list of HTTP headers which may contain the original User-Agent.
#tree ⇒ Hash (readonly)
Instance Method Details
#data_creation_timestamp ⇒ String
Parse the device data creation (JSON file) timestamp.
#data_version ⇒ String
Parse the device data (JSON file) version.
#property_name_by_id(property_id) ⇒ String
Get the name of a property from its identifier.
#property_names ⇒ Hash<PropertyName>
Get the names of all the possible properties stored in the tree.
#property_type_by_id(property_id) ⇒ Char
Get the type of a property from its identifier.
#property_value_by_id(value_id) ⇒ String
Get the value of a property from its identifier.
#property_value_typed(value_id, byte) ⇒ Object
Convert the value of a property based on its data type.
#put_properties(user_agent, stock_user_agents, client_side = nil, properties) ⇒ Object
Get properties from tree walk/ua/client-side.
#put_tree_walk_properties(user_agent, stock_user_agents = nil, properties) ⇒ Object
Get properties from tree walk/ua.