platform_agent 1.0.0 → 1.0.1
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.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/platform_agent.rb +3 -3
- data/platform_agent.gemspec +1 -1
- data/test/platform_agent_test.rb +2 -2
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d74b253a83cbc24d9bf3f56d00f137480b2f348573ad2aefee43168a2d070d9
|
4
|
+
data.tar.gz: 51d3ebb73e993af09dbe54011b2d839d3d4c81a903a2043babb0ebb1f2c9a705
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f787a7d083e66116c9fd29f484081701e663d12c9368768483d58fc39942a8535a62dd094d81da1cc8dd3dde09e0a5e0957cac3eceedca6eefea9d0fd0a7743d
|
7
|
+
data.tar.gz: 5ba2b2327ebf805ea7c1a62f45b0a994fe340367298af59783c269c68ccb50e99e7c40343fc6c7bc8770df32d30b23bfe68841138435574597c63e15c20ed86f
|
data/README.md
CHANGED
@@ -20,7 +20,7 @@ class ApplicationPlatform < PlatformAgent
|
|
20
20
|
|
21
21
|
def windows_app?
|
22
22
|
match?(/Electron/) && match?(/basecamp3/) && match?(/Windows/)
|
23
|
-
end
|
23
|
+
end
|
24
24
|
end
|
25
25
|
|
26
26
|
module SetPlatform
|
@@ -47,8 +47,8 @@ end
|
|
47
47
|
|
48
48
|
## Maintenance Expectations
|
49
49
|
|
50
|
-
This library is an extraction from Basecamp that's been sufficient in almost unaltered form for years. While contributions are always welcome, do not expect a lot of feature evolution beyond the basics.
|
50
|
+
This library is an extraction from Basecamp that's been sufficient in almost unaltered form for years. While contributions are always welcome, do not expect a lot of feature evolution beyond the basics.
|
51
51
|
|
52
52
|
## License
|
53
53
|
|
54
|
-
Platform Agent is released under the [MIT License](https://opensource.org/licenses/MIT).
|
54
|
+
Platform Agent is released under the [MIT License](https://opensource.org/licenses/MIT).
|
data/lib/platform_agent.rb
CHANGED
@@ -5,7 +5,7 @@ class PlatformAgent
|
|
5
5
|
self.user_agent_string = user_agent_string
|
6
6
|
end
|
7
7
|
|
8
|
-
delegate :browser, :version, :product, to: :user_agent
|
8
|
+
delegate :browser, :version, :product, :os, to: :user_agent
|
9
9
|
|
10
10
|
def desktop?
|
11
11
|
!mobile?
|
@@ -89,7 +89,7 @@ class PlatformAgent
|
|
89
89
|
|
90
90
|
def app_version
|
91
91
|
# App user-agent string is parsed into two separate UserAgent instances, it's the last one that contains the right version
|
92
|
-
user_agent.last.version if
|
92
|
+
user_agent.last.version if native_app?
|
93
93
|
end
|
94
94
|
|
95
95
|
def to_s
|
@@ -110,7 +110,7 @@ class PlatformAgent
|
|
110
110
|
attr_accessor :user_agent_string
|
111
111
|
|
112
112
|
def match?(pattern)
|
113
|
-
|
113
|
+
user_agent_string.to_s.match?(pattern)
|
114
114
|
end
|
115
115
|
|
116
116
|
def user_agent
|
data/platform_agent.gemspec
CHANGED
data/test/platform_agent_test.rb
CHANGED
@@ -5,7 +5,7 @@ require 'platform_agent'
|
|
5
5
|
|
6
6
|
class BasecampAgent < PlatformAgent
|
7
7
|
def ios_app?
|
8
|
-
match?
|
8
|
+
match? /BC3 iOS/
|
9
9
|
end
|
10
10
|
|
11
11
|
def android_app?
|
@@ -18,7 +18,7 @@ class BasecampAgent < PlatformAgent
|
|
18
18
|
|
19
19
|
def windows_app?
|
20
20
|
match?(/Electron/) && match?(/basecamp3/) && match?(/Windows/)
|
21
|
-
end
|
21
|
+
end
|
22
22
|
end
|
23
23
|
|
24
24
|
class PlatformAgentTest < ActiveSupport::TestCase
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: platform_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04
|
11
|
+
date: 2019-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -99,8 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
- !ruby/object:Gem::Version
|
100
100
|
version: '0'
|
101
101
|
requirements: []
|
102
|
-
|
103
|
-
rubygems_version: 2.7.3
|
102
|
+
rubygems_version: 3.0.3
|
104
103
|
signing_key:
|
105
104
|
specification_version: 4
|
106
105
|
summary: Parse user agent to deduce the platform.
|