ruby-thumbor 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
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 :key => 'my-security-key'
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
 
@@ -129,13 +129,17 @@ module Thumbor
129
129
  end
130
130
 
131
131
  def generate_new(options)
132
- url_options = url_for(options, false)
133
- url = "#{url_options}/#{options[:image]}"
132
+ thumbor_path = ""
134
133
 
135
- signature = OpenSSL::HMAC.digest('sha1', Thumbor.key, url)
136
- signature = url_safe_base64(signature)
134
+ image_options = url_for(options, false)
135
+ thumbor_path << image_options + '/' unless image_options.empty?
137
136
 
138
- "/#{signature}/#{url}"
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
@@ -1,3 +1,3 @@
1
1
  module Thumbor
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
@@ -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.0
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-10-16 00:00:00.000000000 Z
12
+ date: 2012-11-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec