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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f05663650667c18a7fe0837ee757a815570213d
4
- data.tar.gz: 731fe066fc785aa4b43cfa013afa2e3acd95c7ba
3
+ metadata.gz: dc1c6093170ce607d703963d8d6d76227c35a634
4
+ data.tar.gz: 39c39fc1ae56dd9fe286e3db59bd588cf90365c7
5
5
  SHA512:
6
- metadata.gz: 9fd376729662947ab91e93d387e9c037eca66cfd1fca94bb6e09646ce7bd344ee5512246d8b55023c0fcc9b4de5c390c06b8e054c9f3feca2bb184fb8c0fb73b
7
- data.tar.gz: 56b98ea5bb75c0f048cd0469c640b8f950104ab78c1357693152868b460752202a161cf5dab735fb14ea0bd7305ec44ec42ab19a7a339446dea08fc5fdf507eb
6
+ metadata.gz: 3c4157d89ab23ece8988f0c3dfcb94b24a60c98d41863fadd532c211ffc9984e04ebdea0f95671ecccad82e6bbdc557b21d0baa1f9ede2a28b65a91c293ff9e5
7
+ data.tar.gz: c356ff40f9e68a677e64bffd4481bb4eefeaaef67cf8d322bcfe0611ba31bd068b98ee586030ca801bdb0177f9ab73be9abd50b783bdb31c619915e46e9c1e34
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.1
1
+ 1.3.0
@@ -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 = remove_old_token(uri.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 [dir, expiration].compact.join
15
+ token = digest [path, expiration].compact.join
18
16
  token = [expiration, token].compact.join '_'
19
17
 
20
- uri.path = ['/', token, path].join
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.2.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-03-29 00:00:00.000000000 Z
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.4.5
157
+ rubygems_version: 2.6.10
157
158
  signing_key:
158
159
  specification_version: 4
159
160
  summary: Tokenize url by variety of providers.