Module: Aua::Agents::ApiClients

Defined in:
lib/aua/agents/api_clients.rb

Constant Summary collapse

KNOWN_CLIENTS =
%w(facebookexternalhit Wget curl Zend_Http_Client Zendesk Python-httplib2 Python-urllib Ruby PEAR HTTP_Request2 NativeHost Java AppEngine-Google Twisted)
PATTERN_YAHOO_PIPES =
/^Yahoo Pipes ([\d\.]+)$/
PATTERN_GERMAN_SYSTEM_PREFS =
/^Systemeinstellungen/
PATTERN_SYSTEM_UI_SEVER =
/^SystemUIServer/

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extend?(agent) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
8
9
# File 'lib/aua/agents/api_clients.rb', line 4

def self.extend?(agent)
  KNOWN_CLIENTS.include?(agent.app) ||
  agent.raw =~ PATTERN_YAHOO_PIPES ||
  agent.app =~ PATTERN_GERMAN_SYSTEM_PREFS ||
  agent.app =~ PATTERN_SYSTEM_UI_SEVER
end

Instance Method Details

#nameObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/aua/agents/api_clients.rb', line 19

def name
  @name ||= begin
    if raw =~ PATTERN_YAHOO_PIPES
      :YahooPipes
    elsif app == "PEAR" || app == "HTTP_Request2"
      :PearPHPHttpRequest
    elsif app == "NativeHost"
      :CappucinosNativeHost
    elsif app =~ PATTERN_GERMAN_SYSTEM_PREFS
      :SystemPreferences
    elsif app =~ PATTERN_SYSTEM_UI_SEVER
      :SystemUIServer
    elsif app == "Twisted"
      :PythonTwistedPageGetter
    else
      app.to_sym
    end
  end
end

#typeObject



15
16
17
# File 'lib/aua/agents/api_clients.rb', line 15

def type
  :ApiClient
end

#versionObject



39
40
41
42
43
44
45
# File 'lib/aua/agents/api_clients.rb', line 39

def version
  @version ||= begin
    return $1 if raw =~ /^Yahoo Pipes ([\d\.]+)$/
    return comments.first[1] if name == :"AppEngine-Google" && comments.first[1]
    versions.first
  end
end