url_tokenizer 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/url_tokenizer/fastly.rb +7 -1
- data/url_tokenizer.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f05663650667c18a7fe0837ee757a815570213d
|
4
|
+
data.tar.gz: 731fe066fc785aa4b43cfa013afa2e3acd95c7ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fd376729662947ab91e93d387e9c037eca66cfd1fca94bb6e09646ce7bd344ee5512246d8b55023c0fcc9b4de5c390c06b8e054c9f3feca2bb184fb8c0fb73b
|
7
|
+
data.tar.gz: 56b98ea5bb75c0f048cd0469c640b8f950104ab78c1357693152868b460752202a161cf5dab735fb14ea0bd7305ec44ec42ab19a7a339446dea08fc5fdf507eb
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.1
|
data/lib/url_tokenizer/fastly.rb
CHANGED
@@ -7,7 +7,8 @@ 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 = uri.path
|
10
|
+
path = remove_old_token(uri.path)
|
11
|
+
|
11
12
|
return if path.empty? || path == '/'
|
12
13
|
|
13
14
|
expiration = expiration_date(options[:expires_in])
|
@@ -21,8 +22,13 @@ module UrlTokenizer
|
|
21
22
|
end
|
22
23
|
|
23
24
|
private
|
25
|
+
|
24
26
|
def digest(string_to_sign)
|
25
27
|
OpenSSL::HMAC.hexdigest('sha1', key, string_to_sign)
|
26
28
|
end
|
29
|
+
|
30
|
+
def remove_old_token(path)
|
31
|
+
path.sub(/\d{10,}_\w{40}\/?/, '')
|
32
|
+
end
|
27
33
|
end
|
28
34
|
end
|
data/url_tokenizer.gemspec
CHANGED
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.2.
|
4
|
+
version: 1.2.1
|
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-03-
|
11
|
+
date: 2017-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: facets
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
description: Tokenize url by variety of providers.
|
98
112
|
email:
|
99
113
|
- alexander.n.paramonov@gmail.com
|