Module: YandexDetector

Defined in:
lib/yandex_detector.rb,
lib/yandex_detector/net.rb,
lib/yandex_detector/config.rb,
lib/yandex_detector/logger.rb,
lib/yandex_detector/parser.rb,
lib/yandex_detector/result.rb,
lib/yandex_detector/version.rb,
lib/yandex_detector/result/stats.rb,
lib/yandex_detector/result/headers.rb,
lib/yandex_detector/result/properties.rb

Overview

Author:

Defined Under Namespace

Modules: Headers, Properties, Stats Classes: Config, Net, Parser, Result

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.detect(headers, timeout = 2) ⇒ YandexDetector::Result

Performs detectoin by API service call via network if at least one of needed headers specified.

Parameters:

  • headers (Hash)

    string-keyed hash of HTTP headers: ‘profile’, ‘wap-profile’, ‘x-wap-profile’, ‘user-agent’, ‘x-operamini-phone-ua’.

  • timeout (Integer, nil) (defaults to: 2)

    timeout to API service call in seconds

Returns:



12
13
14
# File 'lib/yandex_detector.rb', line 12

def self.detect(headers, timeout = 2)
  YandexDetector::Result.new headers, timeout
end