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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 528fc592fedf1fe398ad55786d3db269889228bf
4
- data.tar.gz: f7ba2eb5f0322d7d52deb4cd2fdf1255d16f80f4
3
+ metadata.gz: 8f05663650667c18a7fe0837ee757a815570213d
4
+ data.tar.gz: 731fe066fc785aa4b43cfa013afa2e3acd95c7ba
5
5
  SHA512:
6
- metadata.gz: 4ad56796ba99550b04b2e0e1311deb523d4f4fe7506ec675f8075632f5ff4adb19c25c295990434abb59b4fef080dd310822c47bd5edf6a461e91356627a447b
7
- data.tar.gz: 2e1fa729428300ca442813c69fcf905e8b488f6c738fc2c21d8bd81705c7b7186780cf4083302e1602d2bfc53cffe21b8912e306f033e6656ef16ddc1ca07a04
6
+ metadata.gz: 9fd376729662947ab91e93d387e9c037eca66cfd1fca94bb6e09646ce7bd344ee5512246d8b55023c0fcc9b4de5c390c06b8e054c9f3feca2bb184fb8c0fb73b
7
+ data.tar.gz: 56b98ea5bb75c0f048cd0469c640b8f950104ab78c1357693152868b460752202a161cf5dab735fb14ea0bd7305ec44ec42ab19a7a339446dea08fc5fdf507eb
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.2.1
@@ -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
@@ -24,4 +24,5 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "rspec", "~> 3.0"
25
25
  spec.add_development_dependency "dotenv"
26
26
  spec.add_development_dependency "codeclimate-test-reporter"
27
+ spec.add_development_dependency "pry"
27
28
  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.0
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-28 00:00:00.000000000 Z
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