Copyright © 2021 by DeviceAtlas Limited. All rights reserved.
dotMobi
Class to create multiple instances to connect to the Cloud service.
Cloud service.
Headers.
A list of headers from the end user to pass to DeviceAtlas Cloud. These help with detection, especially if a third party browser or a proxy changes the original user-agent.
A list of headers which may contain the original user agent. These headers are sent to cloud server beside ESSENTIAL_HEADERS.
A list of additional headers to send to DeviceAtlas. These are not sent by default. These headers can be used for carrier detection and geoip.
Action to be taken after an end-point responds: If the error controller returns this the fail-over mechanism must try the next end-point
Action to be taken after an end-point responds: If an-endpoint response was fine
Action to be taken after an end-point responds: If the error controller returns this the fail-over mechanism must stop trying the next end-point
Keys of the array returned by #get_device_data()
Device data source
Store the request details: headers and cookie content.
headers
Hash of headers from the request.
cookies
Hash of cookies from the request.
Get the directory path in which the DeviceAtlas CloudApi puts cache files in (device data cache and server fail-over list).
return
String with the cache directory
Get the URL of the latest DeviceAtlas cloud end-point that returned device properties successfully.
There are three cases where this function will return nil: 1) If device properties come from cache. 2) If licence is wrong, expired or exceeded quota. 3) None end-point were reached or could return device properties.
return
String with the used end-point URL.
Get device data from DeviceAtlas Cloud. Once data has been returned from DeviceAtlas Cloud it can be cached locally to speed up subsequent requests. If device data provided by the DeviceAtlas JavaScript library exists in a cookie then cloud data will be merged with the cookie data.
param
Browser headers or boolean value to use a fake UserAgent to test
the API.
return
Hash of properties, source, user-agent and error message if any
happens.
Get the end-point list.
return
Array of hashes with end-point info.
Get a list of cloud end-points and their service latencies.
num_requests
Number of times to send requests to an end-point per test
return
Array of end-point info {{avg:, latencies:, host:, port:},}
Sort servers by availability and latency to save them in cache.
servers
If servers are provided, they are used to be ranked.
return
Boolean value. True if servers could be ranked. Else, False.
Get the current server list.
return
Array of hashes with server details.
Set the server list based on a hash of server details.
server_hash
Array of hashes with server information.