agents 0.1.0 → 0.1.1
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 +17 -3
- 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: 4cb67fbba1de6d9d25fe57c932494d7da9564237ec56cc58555fe2923a7d93c4
|
4
|
+
data.tar.gz: 40fa474816c93e8811cdd16f73dc96ae96c9de5870ebb64a80a0dcccadb74d8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0aadbc5acdf5913c03c219dc83184d08d7c3678b030dbfe87a71ba619b9e491b824e0ad6c8ebc7b1d272cfd0f7d6d87999f6d9ff8554d818b7ce96772e3d203c
|
7
|
+
data.tar.gz: 1a1f368621c3959b90cbd0fb28d5035184b29557e578250cae32aa7d76cec03536ef6d6aca9a20b16b708b885944c93822ce8eb7b15826695d7ebdae91d6c19e
|
data/Gemfile.lock
CHANGED
data/lib/agents.rb
CHANGED
@@ -3,9 +3,23 @@ require "agents/constants"
|
|
3
3
|
|
4
4
|
module Agents
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
class << self
|
7
|
+
def random_user_agent(*args)
|
8
|
+
args = (args.nil? || args.empty?) ? [:desktop] : args
|
9
|
+
::Agents::Constants::USER_AGENTS.dig(*args&.collect(&:to_sym))&.sample
|
10
|
+
end
|
11
|
+
|
12
|
+
def runs_ios?(user_agent)
|
13
|
+
is_iphone?(user_agent) || is_ipad?(user_agent)
|
14
|
+
end
|
15
|
+
|
16
|
+
def is_iphone?(user_agent)
|
17
|
+
!(user_agent =~ /iphone|cpu\siphone/i).nil?
|
18
|
+
end
|
19
|
+
|
20
|
+
def is_ipad?(user_agent)
|
21
|
+
!(user_agent =~ /ipad/i).nil?
|
22
|
+
end
|
9
23
|
end
|
10
24
|
|
11
25
|
end
|
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.1
|
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-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|