ruby-thumbor 1.1.0 → 1.1.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.
- data/README.rdoc +1 -1
- data/lib/thumbor/crypto_url.rb +10 -6
- data/lib/thumbor/version.rb +1 -1
- data/spec/thumbor/crypto_url_spec.rb +5 -0
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -28,7 +28,7 @@ No dependencies required for regular usage.
|
|
28
28
|
|
29
29
|
require 'ruby-thumbor'
|
30
30
|
|
31
|
-
crypto = Thumbor::CryptoURL.new
|
31
|
+
crypto = Thumbor::CryptoURL.new 'my-security-key'
|
32
32
|
|
33
33
|
url = crypto.generate :width => 200, :height => 300, :image => 'my.server.com/path/to/image.jpg'
|
34
34
|
|
data/lib/thumbor/crypto_url.rb
CHANGED
@@ -129,13 +129,17 @@ module Thumbor
|
|
129
129
|
end
|
130
130
|
|
131
131
|
def generate_new(options)
|
132
|
-
|
133
|
-
url = "#{url_options}/#{options[:image]}"
|
132
|
+
thumbor_path = ""
|
134
133
|
|
135
|
-
|
136
|
-
|
134
|
+
image_options = url_for(options, false)
|
135
|
+
thumbor_path << image_options + '/' unless image_options.empty?
|
137
136
|
|
138
|
-
|
137
|
+
thumbor_path << options[:image]
|
138
|
+
|
139
|
+
signature = url_safe_base64(OpenSSL::HMAC.digest('sha1', Thumbor.key, thumbor_path))
|
140
|
+
thumbor_path.insert(0, "/#{signature}/")
|
141
|
+
|
142
|
+
thumbor_path
|
139
143
|
end
|
140
144
|
|
141
145
|
def generate(options)
|
@@ -143,4 +147,4 @@ module Thumbor
|
|
143
147
|
generate_new(options)
|
144
148
|
end
|
145
149
|
end
|
146
|
-
end
|
150
|
+
end
|
data/lib/thumbor/version.rb
CHANGED
@@ -144,6 +144,11 @@ describe Thumbor::CryptoURL do
|
|
144
144
|
end
|
145
145
|
|
146
146
|
describe '#generate' do
|
147
|
+
it "should generate a proper url when only an image url is specified" do
|
148
|
+
url = subject.generate :image => image_url
|
149
|
+
|
150
|
+
url.should == "/964rCTkAEDtvjy_a572k7kRa0SU=/#{image_url}"
|
151
|
+
end
|
147
152
|
|
148
153
|
it "should create a new instance passing key and keep it" do
|
149
154
|
url = subject.generate :width => 300, :height => 200, :image => image_url
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-thumbor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|