url_tokenizer 1.2.1 → 1.3.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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/url_tokenizer/fastly.rb +3 -10
- data/lib/url_tokenizer/fastly_query_string.rb +21 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc1c6093170ce607d703963d8d6d76227c35a634
|
4
|
+
data.tar.gz: 39c39fc1ae56dd9fe286e3db59bd588cf90365c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c4157d89ab23ece8988f0c3dfcb94b24a60c98d41863fadd532c211ffc9984e04ebdea0f95671ecccad82e6bbdc557b21d0baa1f9ede2a28b65a91c293ff9e5
|
7
|
+
data.tar.gz: c356ff40f9e68a677e64bffd4481bb4eefeaaef67cf8d322bcfe0611ba31bd068b98ee586030ca801bdb0177f9ab73be9abd50b783bdb31c619915e46e9c1e34
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.3.0
|
data/lib/url_tokenizer/fastly.rb
CHANGED
@@ -7,28 +7,21 @@ module UrlTokenizer
|
|
7
7
|
def call(input_url, **options)
|
8
8
|
options = global_options.merge options
|
9
9
|
uri = URI.parse input_url
|
10
|
-
path =
|
11
|
-
|
10
|
+
path = uri.path
|
12
11
|
return if path.empty? || path == '/'
|
13
12
|
|
14
13
|
expiration = expiration_date(options[:expires_in])
|
15
|
-
dir = File.dirname(path)
|
16
14
|
|
17
|
-
token = digest [
|
15
|
+
token = digest [path, expiration].compact.join
|
18
16
|
token = [expiration, token].compact.join '_'
|
19
17
|
|
20
|
-
uri.
|
18
|
+
uri.query = build_query token: token
|
21
19
|
uri.to_s
|
22
20
|
end
|
23
21
|
|
24
22
|
private
|
25
|
-
|
26
23
|
def digest(string_to_sign)
|
27
24
|
OpenSSL::HMAC.hexdigest('sha1', key, string_to_sign)
|
28
25
|
end
|
29
|
-
|
30
|
-
def remove_old_token(path)
|
31
|
-
path.sub(/\d{10,}_\w{40}\/?/, '')
|
32
|
-
end
|
33
26
|
end
|
34
27
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_relative 'fastly'
|
2
|
+
|
3
|
+
module UrlTokenizer
|
4
|
+
class FastlyQueryString < Fastly
|
5
|
+
def call(input_url, **options)
|
6
|
+
options = global_options.merge options
|
7
|
+
uri = URI.parse input_url
|
8
|
+
path = uri.path
|
9
|
+
return if path.empty? || path == '/'
|
10
|
+
|
11
|
+
expiration = expiration_date(options[:expires_in])
|
12
|
+
dir = File.dirname(path)
|
13
|
+
|
14
|
+
token = digest [dir, expiration].compact.join
|
15
|
+
token = [expiration, token].compact.join '_'
|
16
|
+
|
17
|
+
uri.query = build_query token: token
|
18
|
+
uri.to_s
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: url_tokenizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Paramonov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: facets
|
@@ -129,6 +129,7 @@ files:
|
|
129
129
|
- lib/url_tokenizer.rb
|
130
130
|
- lib/url_tokenizer/cdn77.rb
|
131
131
|
- lib/url_tokenizer/fastly.rb
|
132
|
+
- lib/url_tokenizer/fastly_query_string.rb
|
132
133
|
- lib/url_tokenizer/limelight.rb
|
133
134
|
- lib/url_tokenizer/provider.rb
|
134
135
|
- lib/url_tokenizer/wowza.rb
|
@@ -153,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
154
|
version: '0'
|
154
155
|
requirements: []
|
155
156
|
rubyforge_project:
|
156
|
-
rubygems_version: 2.
|
157
|
+
rubygems_version: 2.6.10
|
157
158
|
signing_key:
|
158
159
|
specification_version: 4
|
159
160
|
summary: Tokenize url by variety of providers.
|