agentry 3.1.2 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -1
  3. data/README.md +97 -75
  4. data/lib/{browser → agentry}/accept_language.rb +2 -2
  5. data/lib/agentry/action_controller.rb +27 -0
  6. data/lib/agentry/agentry.rb +213 -0
  7. data/lib/agentry/aliases.rb +33 -0
  8. data/lib/{browser → agentry}/alipay.rb +1 -1
  9. data/lib/{browser → agentry}/base.rb +3 -3
  10. data/lib/{browser → agentry}/blackberry.rb +1 -1
  11. data/lib/{browser → agentry}/bot/empty_user_agent_matcher.rb +1 -1
  12. data/lib/{browser → agentry}/bot/ip_ranges.rb +3 -3
  13. data/lib/{browser → agentry}/bot/keyword_matcher.rb +1 -1
  14. data/lib/{browser → agentry}/bot/known_bots_matcher.rb +2 -2
  15. data/lib/{browser → agentry}/bot.rb +9 -9
  16. data/lib/agentry/browser_constant.rb +15 -0
  17. data/lib/{browser → agentry}/cache.rb +6 -6
  18. data/lib/{browser → agentry}/chrome.rb +1 -1
  19. data/lib/{browser → agentry}/client_hints.rb +1 -1
  20. data/lib/{browser → agentry}/cloudflare.rb +2 -2
  21. data/lib/{browser → agentry}/detect_version.rb +1 -1
  22. data/lib/{browser → agentry}/detection.rb +1 -1
  23. data/lib/{browser → agentry}/device/android.rb +1 -1
  24. data/lib/{browser → agentry}/device/base.rb +1 -1
  25. data/lib/{browser → agentry}/device/blackberry_playbook.rb +1 -1
  26. data/lib/{browser → agentry}/device/ipad.rb +1 -1
  27. data/lib/{browser → agentry}/device/iphone.rb +1 -1
  28. data/lib/{browser → agentry}/device/ipod_touch.rb +1 -1
  29. data/lib/{browser → agentry}/device/kindle.rb +1 -1
  30. data/lib/{browser → agentry}/device/kindle_fire.rb +1 -1
  31. data/lib/{browser → agentry}/device/playstation3.rb +1 -1
  32. data/lib/{browser → agentry}/device/playstation4.rb +1 -1
  33. data/lib/{browser → agentry}/device/psp.rb +1 -1
  34. data/lib/{browser → agentry}/device/psvita.rb +1 -1
  35. data/lib/{browser → agentry}/device/samsung.rb +2 -2
  36. data/lib/{browser → agentry}/device/surface.rb +1 -1
  37. data/lib/{browser → agentry}/device/switch.rb +1 -1
  38. data/lib/{browser → agentry}/device/tv.rb +1 -1
  39. data/lib/{browser → agentry}/device/unknown.rb +1 -1
  40. data/lib/{browser → agentry}/device/wii.rb +1 -1
  41. data/lib/{browser → agentry}/device/wiiu.rb +1 -1
  42. data/lib/{browser → agentry}/device/xbox_360.rb +1 -1
  43. data/lib/{browser → agentry}/device/xbox_one.rb +1 -1
  44. data/lib/{browser → agentry}/device.rb +1 -1
  45. data/lib/{browser → agentry}/duck_duck_go.rb +1 -1
  46. data/lib/{browser → agentry}/edge.rb +1 -1
  47. data/lib/{browser → agentry}/electron.rb +1 -1
  48. data/lib/{browser → agentry}/epiphany.rb +1 -1
  49. data/lib/{browser → agentry}/facebook.rb +1 -1
  50. data/lib/{browser → agentry}/firefox.rb +1 -1
  51. data/lib/{browser → agentry}/google_search_app.rb +1 -1
  52. data/lib/{browser → agentry}/huawei_browser.rb +1 -1
  53. data/lib/{browser → agentry}/instagram.rb +1 -1
  54. data/lib/{browser → agentry}/internet_explorer.rb +1 -1
  55. data/lib/{browser → agentry}/maxthon.rb +1 -1
  56. data/lib/{browser → agentry}/meta/base.rb +1 -1
  57. data/lib/{browser → agentry}/meta/device.rb +1 -1
  58. data/lib/{browser → agentry}/meta/generic_browser.rb +1 -1
  59. data/lib/{browser → agentry}/meta/id.rb +1 -1
  60. data/lib/{browser → agentry}/meta/ie.rb +1 -1
  61. data/lib/{browser → agentry}/meta/ios.rb +1 -1
  62. data/lib/{browser → agentry}/meta/mobile.rb +1 -1
  63. data/lib/{browser → agentry}/meta/platform.rb +1 -1
  64. data/lib/{browser → agentry}/meta/proxy.rb +1 -1
  65. data/lib/{browser → agentry}/meta/safari.rb +1 -1
  66. data/lib/{browser → agentry}/meta/tablet.rb +1 -1
  67. data/lib/{browser → agentry}/meta/webkit.rb +1 -1
  68. data/lib/{browser → agentry}/micro_messenger.rb +1 -1
  69. data/lib/{browser → agentry}/middleware/context/additions.rb +4 -2
  70. data/lib/agentry/middleware/context/url_methods.rb +17 -0
  71. data/lib/{browser → agentry}/middleware/context.rb +9 -3
  72. data/lib/{browser → agentry}/middleware.rb +2 -2
  73. data/lib/{browser → agentry}/miui_browser.rb +1 -1
  74. data/lib/{browser → agentry}/nokia.rb +1 -1
  75. data/lib/{browser → agentry}/opera.rb +1 -1
  76. data/lib/{browser → agentry}/otter.rb +1 -1
  77. data/lib/{browser → agentry}/phantom_js.rb +1 -1
  78. data/lib/{browser → agentry}/platform/adobe_air.rb +1 -1
  79. data/lib/{browser → agentry}/platform/android.rb +1 -1
  80. data/lib/{browser → agentry}/platform/base.rb +1 -1
  81. data/lib/{browser → agentry}/platform/blackberry.rb +1 -1
  82. data/lib/{browser → agentry}/platform/chrome_os.rb +1 -1
  83. data/lib/{browser → agentry}/platform/firefox_os.rb +1 -1
  84. data/lib/{browser → agentry}/platform/ios.rb +1 -1
  85. data/lib/{browser → agentry}/platform/kai_os.rb +1 -1
  86. data/lib/{browser → agentry}/platform/linux.rb +1 -1
  87. data/lib/{browser → agentry}/platform/mac.rb +1 -1
  88. data/lib/{browser → agentry}/platform/unknown.rb +1 -1
  89. data/lib/{browser → agentry}/platform/windows.rb +1 -1
  90. data/lib/{browser → agentry}/platform/windows_mobile.rb +1 -1
  91. data/lib/{browser → agentry}/platform/windows_phone.rb +1 -1
  92. data/lib/{browser → agentry}/platform.rb +1 -1
  93. data/lib/{browser → agentry}/qq.rb +1 -1
  94. data/lib/agentry/rails.rb +44 -0
  95. data/lib/{browser → agentry}/safari.rb +1 -1
  96. data/lib/{browser → agentry}/samsung_browser.rb +1 -1
  97. data/lib/{browser → agentry}/snapchat.rb +1 -1
  98. data/lib/{browser → agentry}/sougou_browser.rb +1 -1
  99. data/lib/{browser → agentry}/sputnik.rb +1 -1
  100. data/lib/agentry/testing.rb +30 -0
  101. data/lib/{browser → agentry}/uc_browser.rb +1 -1
  102. data/lib/{browser → agentry}/unknown.rb +1 -1
  103. data/lib/{browser → agentry}/version.rb +2 -2
  104. data/lib/{browser → agentry}/weibo.rb +1 -1
  105. data/lib/{browser → agentry}/yandex.rb +1 -1
  106. data/lib/agentry.rb +2 -1
  107. data/lib/browser/aliases.rb +2 -31
  108. data/lib/browser/browser.rb +2 -202
  109. data/lib/browser/rails.rb +3 -22
  110. data/lib/browser/testing.rb +3 -27
  111. data/lib/browser.rb +2 -2
  112. metadata +272 -252
  113. data/lib/browser/action_controller.rb +0 -21
  114. data/lib/browser/middleware/context/url_methods.rb +0 -15
  115. /data/lib/{browser → agentry}/meta.rb +0 -0
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../agentry"
4
+ require "forwardable"
5
+
6
+ module Agentry
7
+ module Aliases
8
+ PLATFORM_ALIASES = %w[
9
+ adobe_air? android? blackberry? chrome_os? firefox_os? ios? ios_app?
10
+ ios_webview? linux? mac? windows10? windows7? windows8? windows8_1?
11
+ windows? windows_mobile? windows_phone? windows_rt?
12
+ windows_touchscreen_desktop? windows_vista? windows_wow64? windows_x64?
13
+ windows_x64_inclusive? windows_xp?
14
+ ].freeze
15
+
16
+ DEVICE_ALIASES = %w[
17
+ blackberry_playbook? console? ipad? iphone? ipod_touch? kindle?
18
+ kindle_fire? mobile? nintendo? nintendo_switch? nintendo_wii?
19
+ nintendo_wiiu? playbook? playstation3? playstation4? playstation?
20
+ playstation_vita? ps3? ps4? psp? psp_vita? silk? surface? tablet? tv?
21
+ vita? wii? wiiu? xbox? xbox_360? xbox_one?
22
+ ].freeze
23
+
24
+ def self.included(target)
25
+ target.class_eval do
26
+ extend Forwardable
27
+
28
+ def_delegators :platform, *PLATFORM_ALIASES
29
+ def_delegators :device, *DEVICE_ALIASES
30
+ end
31
+ end
32
+ end
33
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Alipay < Base
5
5
  def id
6
6
  :alipay
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Base
5
5
  include DetectVersion
6
6
 
@@ -292,9 +292,9 @@ module Browser
292
292
  actual_bytesize = input.bytesize
293
293
  size_limit =
294
294
  if subject == :user_agent
295
- Browser.user_agent_size_limit
295
+ Agentry.user_agent_size_limit
296
296
  else
297
- Browser.accept_language_size_limit
297
+ Agentry.accept_language_size_limit
298
298
  end
299
299
 
300
300
  return if actual_bytesize < size_limit
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class BlackBerry < Base
5
5
  def id
6
6
  :blackberry
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Bot
5
5
  class EmptyUserAgentMatcher
6
6
  def self.call(ua, _browser)
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "ipaddr"
4
4
 
5
- module Browser
5
+ module Agentry
6
6
  class Bot
7
7
  # The IP ranges crawler owners publish, from bot_ip_ranges.yml (rewritten
8
8
  # weekly by script/sync_ip_ranges.rb) or fetched again by `refresh`.
@@ -162,7 +162,7 @@ module Browser
162
162
 
163
163
  # Prefixes ("66.249.64.0/27"), keyed by owner.
164
164
  def self.prefixes_by_owner
165
- @prefixes_by_owner ||= Browser.load_data("bot_ip_ranges").transform_keys(&:to_sym)
165
+ @prefixes_by_owner ||= Agentry.load_data("bot_ip_ranges").transform_keys(&:to_sym)
166
166
  end
167
167
 
168
168
  def self.ranges_by_owner
@@ -170,7 +170,7 @@ module Browser
170
170
  end
171
171
 
172
172
  # For long-lived processes: fetches every owner's ranges again and swaps
173
- # them in at once. Raises Browser::Error and keeps the current ranges when
173
+ # them in at once. Raises Agentry::Error and keeps the current ranges when
174
174
  # a source fails.
175
175
  def self.refresh
176
176
  load(fetch)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Bot
5
5
  class KeywordMatcher
6
6
  def self.call(ua, _browser)
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Bot
5
5
  class KnownBotsMatcher
6
6
  def self.call(ua, _browser)
7
- !Browser::Bot.known_bot_rank(ua, lowest: false).nil?
7
+ !Agentry::Bot.known_bot_rank(ua, lowest: false).nil?
8
8
  end
9
9
  end
10
10
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Bot
5
5
  GENERIC_NAME = "Generic Bot"
6
6
  AI_CATEGORIES = %i[ai_agent ai_assistant ai_crawler ai_search].freeze
@@ -17,28 +17,28 @@ module Browser
17
17
  # browser's API. The gem ships its lists as JSON only: load_yaml("bots.yml")
18
18
  # reads data/bots.json.
19
19
  def self.load_yaml(path)
20
- json_path = Browser.root.join("data", path.to_s.sub(/\.yml\z/, ".json"))
20
+ json_path = Agentry.root.join("data", path.to_s.sub(/\.yml\z/, ".json"))
21
21
  return JSON.load_file(json_path) if json_path.file?
22
22
 
23
23
  require "yaml"
24
- YAML.load_file(Browser.root.join(path))
24
+ YAML.load_file(Agentry.root.join(path))
25
25
  end
26
26
 
27
27
  def self.bots
28
- @bots ||= Browser.load_data("bots")
28
+ @bots ||= Agentry.load_data("bots")
29
29
  end
30
30
 
31
31
  def self.bot_exceptions
32
- @bot_exceptions ||= Browser.load_data("bot_exceptions")
32
+ @bot_exceptions ||= Agentry.load_data("bot_exceptions")
33
33
  end
34
34
 
35
35
  def self.search_engines
36
- @search_engines ||= Browser.load_data("search_engines")
36
+ @search_engines ||= Agentry.load_data("search_engines")
37
37
  end
38
38
 
39
39
  def self.category_by_keyword
40
40
  @category_by_keyword ||=
41
- Browser.load_data("bot_categories").each_with_object({}) do |(category, keywords), category_by_keyword|
41
+ Agentry.load_data("bot_categories").each_with_object({}) do |(category, keywords), category_by_keyword|
42
42
  keywords.each { |keyword| category_by_keyword[keyword] = category.to_sym }
43
43
  end
44
44
  end
@@ -119,7 +119,7 @@ module Browser
119
119
  def self.why?(ua)
120
120
  ua = ua.scrub unless ua.valid_encoding?
121
121
  ua = ua.downcase.strip
122
- browser = Browser.new(ua)
122
+ browser = Agentry.new(ua)
123
123
  matchers.find { |matcher| matcher.call(ua, browser) }
124
124
  end
125
125
 
@@ -214,7 +214,7 @@ module Browser
214
214
  end
215
215
 
216
216
  private def browser
217
- @browser ||= Browser.new(ua)
217
+ @browser ||= Agentry.new(ua)
218
218
  end
219
219
 
220
220
  private :ua
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Loaded only by the browser/* require paths kept for 4.x: `require "agentry"` alone defines no Browser. Fires at
4
+ # boot, so only RUBYOPT=-W:deprecated shows it.
5
+ require_relative "agentry"
6
+
7
+ if Gem.loaded_specs.key?("browser")
8
+ raise LoadError, "agentry's browser/* require paths define Browser, which the browser gem defines too: " \
9
+ "Agentry 4 cannot share a bundle with the browser gem, remove it (or the gem that needs it) from the Gemfile"
10
+ end
11
+
12
+ Browser = Agentry
13
+
14
+ Agentry.deprecate("require \"browser\" (or browser/*) and the Browser constant are deprecated and go away in 5.0: " \
15
+ "require \"agentry\" and call Agentry")
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  # The detections of the last user agents and the parsed Accept-Language
5
5
  # headers, shared by the threads of a process. Reads take no lock: under the
6
6
  # GVL a Hash read is atomic, and a thread that misses detects again. Writes
@@ -20,7 +20,7 @@ module Browser
20
20
  end
21
21
 
22
22
  def self.detection(ua)
23
- return Detection.new(ua) if Browser.cache_size.zero?
23
+ return Detection.new(ua) if Agentry.cache_size.zero?
24
24
 
25
25
  cached_detection(ua) || @mutex.synchronize do
26
26
  ua = -ua
@@ -30,7 +30,7 @@ module Browser
30
30
 
31
31
  # A copy each time: callers may change the array they get.
32
32
  def self.accept_language(header)
33
- return AcceptLanguage.parse(header) if Browser.cache_size.zero?
33
+ return AcceptLanguage.parse(header) if Agentry.cache_size.zero?
34
34
 
35
35
  languages = @languages_by_header[header]
36
36
  return languages.dup if languages
@@ -64,7 +64,7 @@ module Browser
64
64
  # The bot list holds hundreds of entries: compared by identity and size,
65
65
  # like Bot.keywords_pattern, not entry by entry on every request.
66
66
  def self.lists_unchanged?
67
- @browser_matchers == Browser.matchers &&
67
+ @browser_matchers == Agentry.matchers &&
68
68
  @platform_matchers == Platform.matchers &&
69
69
  @device_matchers == Device.matchers &&
70
70
  @bot_matchers == Bot.matchers &&
@@ -73,7 +73,7 @@ module Browser
73
73
  end
74
74
 
75
75
  def self.remember_lists
76
- @browser_matchers = Browser.matchers.dup
76
+ @browser_matchers = Agentry.matchers.dup
77
77
  @platform_matchers = Platform.matchers.dup
78
78
  @device_matchers = Device.matchers.dup
79
79
  @bot_matchers = Bot.matchers.dup
@@ -88,7 +88,7 @@ module Browser
88
88
  end
89
89
 
90
90
  def self.store(value_by_key, key, value)
91
- value_by_key.clear if value_by_key.size >= Browser.cache_size
91
+ value_by_key.clear if value_by_key.size >= Agentry.cache_size
92
92
  value_by_key[key] = value
93
93
  end
94
94
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Chrome < Base
5
5
  def id
6
6
  :chrome
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  # The User-Agent Client Hints of Chromium browsers, read from a Rack env.
5
5
  # Safari and Firefox send none: every answer is then nil.
6
6
  class ClientHints
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  # What Cloudflare knows of the request, from the headers a Transform Rule
5
5
  # sets (docs/guide.html#cloudflare) and its own CF-IPCountry. Each site names
6
- # its headers in its rule: Browser::Cloudflare.header_names= changes them.
6
+ # its headers in its rule: Agentry::Cloudflare.header_names= changes them.
7
7
  class Cloudflare
8
8
  # Cloudflare's values are a few bytes: a longer one, or invalid UTF-8, is forged, and ignored.
9
9
  HEADER_SIZE_LIMIT_BYTES = 128
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  module DetectVersion
5
5
  # Gem::Version.new and Gem::Version#release keep every version they build in class variables, for the life of
6
6
  # the process: a version read from a header must not reach them, or each new one an attacker sends stays.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  # What a user agent is detected as, shared by every browser built from it
5
5
  # while it stays in the cache. Each answer is computed on first use.
6
6
  class Detection
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Device
5
5
  class Android < Base
6
6
  def id
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Device
5
5
  class Base
6
6
  attr_reader :ua
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Device
5
5
  class BlackBerryPlaybook < Base
6
6
  def id
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Device
5
5
  class Ipad < Base
6
6
  def id
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Device
5
5
  class Iphone < Base
6
6
  def id
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Device
5
5
  class IpodTouch < Base
6
6
  def id
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Device
5
5
  class Kindle < Base
6
6
  def id
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Device
5
5
  class KindleFire < Base
6
6
  def id
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Device
5
5
  class PlayStation3 < Base
6
6
  def id
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Device
5
5
  class PlayStation4 < Base
6
6
  def id
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Device
5
5
  class PSP < Base
6
6
  def id
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Device
5
5
  class PSVita < Base
6
6
  def id
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Device
5
5
  class Samsung < Base
6
6
  REGEX = /\(Linux.*?; Android.*?; (SAMSUNG )?(SM-[A-Z0-9]+).*?\)/i
7
7
 
8
8
  def self.names
9
- @names ||= Browser.load_data("samsung")
9
+ @names ||= Agentry.load_data("samsung")
10
10
  end
11
11
 
12
12
  def id
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Device
5
5
  class Surface < Base
6
6
  def id
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Device
5
5
  class Switch < Base
6
6
  def id
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Device
5
5
  class TV < Base
6
6
  def id
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Device
5
5
  class Unknown < Base
6
6
  def id
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Device
5
5
  class Wii < Base
6
6
  def id
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Device
5
5
  class WiiU < Base
6
6
  def id
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Device
5
5
  class Xbox360 < Base
6
6
  def id
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Device
5
5
  class XboxOne < Base
6
6
  def id
@@ -22,7 +22,7 @@ require_relative "device/xbox_one"
22
22
  require_relative "device/xbox_360"
23
23
  require_relative "device/samsung"
24
24
 
25
- module Browser
25
+ module Agentry
26
26
  class Device
27
27
  attr_reader :ua
28
28
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class DuckDuckGo < Base
5
5
  def id
6
6
  :duckduckgo
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Edge < InternetExplorer
5
5
  def id
6
6
  :edge
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Electron < Base
5
5
  def id
6
6
  :electron
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Epiphany < Base
5
5
  def id
6
6
  :epiphany
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Facebook < Base
5
5
  def id
6
6
  :facebook
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Firefox < Base
5
5
  def id
6
6
  :firefox
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class GoogleSearchApp < Chrome
5
5
  def id
6
6
  :google_search_app
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class HuaweiBrowser < Base
5
5
  def id
6
6
  :huawei_browser
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Instagram < Base
5
5
  def id
6
6
  :instagram
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class InternetExplorer < Base
5
5
  # https://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx#TriToken
6
6
  TRIDENT_MAPPING = {
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  class Maxthon < Base
5
5
  def id
6
6
  :maxthon
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  module Meta
5
5
  def self.rules
6
6
  @rules ||= [
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  module Meta
5
5
  class Device < Base
6
6
  def meta
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  module Meta
5
5
  class GenericBrowser < Base
6
6
  def meta
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Browser
3
+ module Agentry
4
4
  module Meta
5
5
  class Id < Base
6
6
  def meta