agents 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/agents.rb +9 -1
- data/lib/agents/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f1fab8b478330155e8019dca067a0da7050fac2cebdcd94874367724a379c9f
|
4
|
+
data.tar.gz: d7327fc4d025dd05e36591bb87d6e58e08999bba15768bed577327399fc05988
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e40adcf9b236ed3b83ff15f8f9210ca971ec1ba7c99b61b672a2aaef65cf698e837b01065e6b1bc70635fac92d6bac4807981419f3fde16e47a9ae58b0e8c6ce
|
7
|
+
data.tar.gz: 85190edca6fa3c81ec970a35d46176e36da7444b4eb4412d6da1ce671241d1bf91839042aa5678db8033906ffeebe45960d2248cbbd8235b08290e18d2a8a553
|
data/Gemfile.lock
CHANGED
data/lib/agents.rb
CHANGED
@@ -6,7 +6,15 @@ module Agents
|
|
6
6
|
class << self
|
7
7
|
def random_user_agent(*args)
|
8
8
|
args = (args.nil? || args.empty?) ? [:desktop] : args
|
9
|
-
|
9
|
+
|
10
|
+
case args.first
|
11
|
+
when :phone, :mobile
|
12
|
+
(::Agents::Constants::USER_AGENTS[:phones][:iphone] | ::Agents::Constants::USER_AGENTS[:phones][:android])&.sample
|
13
|
+
when :tablet
|
14
|
+
(::Agents::Constants::USER_AGENTS[:tablets][:ipad] | ::Agents::Constants::USER_AGENTS[:tablets][:android])&.sample
|
15
|
+
else
|
16
|
+
::Agents::Constants::USER_AGENTS.dig(*args&.collect(&:to_sym))&.sample
|
17
|
+
end
|
10
18
|
end
|
11
19
|
|
12
20
|
def runs_ios?(user_agent)
|
data/lib/agents/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: agents
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|