ruby-thumbor 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 +4 -4
- data/README.rdoc +2 -2
- data/lib/thumbor/cascade.rb +8 -1
- data/lib/thumbor/crypto_url.rb +9 -3
- data/lib/thumbor/version.rb +1 -1
- data/spec/spec_helper.rb +3 -0
- data/spec/thumbor/cascade_spec.rb +146 -124
- metadata +64 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 893a41411617f13eb886aa0623348b8465367c2f
|
4
|
+
data.tar.gz: 4f987bbd23926f386cc6e360a10156007dafb159
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7534f13bd29cda443f7b9338bf70b411ae6f4ce2802928d5c83e603272a1e3531f88ce4dd369adca224b2d5b59c7a0cbf1889e5d6097c2ea94f42993f242d28
|
7
|
+
data.tar.gz: 3353dcafc369ea2695b3e2883b7b6400bd63f810ead8557018a4ac313c08cb7dafa6fa5f5e1e1b597980d3c5d2ff9494112b53242d1d843b63ebad8712405ef2
|
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
= ruby-thumbor {<img src="https://secure.travis-ci.org/
|
1
|
+
= ruby-thumbor {<img src="https://secure.travis-ci.org/thumbor/ruby-thumbor.png?branch=master" alt="Build Status" />}[http://travis-ci.org/thumbor/ruby-thumbor] {<img src="https://gemnasium.com/thumbor/ruby-thumbor.png" alt="Dependency Status" />}[https://gemnasium.com/thumbor/ruby-thumbor] {<img src="https://badge.fury.io/rb/ruby-thumbor.svg" alt="Gem Version" />}[http://badge.fury.io/rb/ruby-thumbor]
|
2
2
|
|
3
|
-
* http://github.com/
|
3
|
+
* http://github.com/thumbor/ruby-thumbor
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
data/lib/thumbor/cascade.rb
CHANGED
@@ -8,7 +8,14 @@ module Thumbor
|
|
8
8
|
class Cascade
|
9
9
|
attr_accessor :image, :old_crypto, :options, :filters
|
10
10
|
|
11
|
-
@available_options = [
|
11
|
+
@available_options = [
|
12
|
+
:meta, :crop, :center,
|
13
|
+
:original_width, :original_height,
|
14
|
+
:width, :height, :flip,
|
15
|
+
:flop, :halign, :valign,
|
16
|
+
:smart, :fit_in, :adaptive_fit_in,
|
17
|
+
:full_fit_in, :adaptive_full_fit_in,
|
18
|
+
:old, :trim]
|
12
19
|
|
13
20
|
extend Forwardable
|
14
21
|
|
data/lib/thumbor/crypto_url.rb
CHANGED
@@ -160,8 +160,14 @@ module Thumbor
|
|
160
160
|
end
|
161
161
|
end
|
162
162
|
|
163
|
-
|
164
|
-
|
163
|
+
[:fit_in, :adaptive_fit_in, :full_fit_in, :adaptive_full_fit_in].each do |fit|
|
164
|
+
if options[fit]
|
165
|
+
url_parts.push(fit.to_s.gsub('_','-'))
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
if options.include?(:fit_in) or options.include?(:full_fit_in) and not (options.include?(:width) or options.include?(:height))
|
170
|
+
raise ArgumentError, 'When using fit-in or full-fit-in, you must specify width and/or height.'
|
165
171
|
end
|
166
172
|
|
167
173
|
calculate_width_and_height(url_parts, options)
|
@@ -220,7 +226,7 @@ module Thumbor
|
|
220
226
|
if Thumbor.key
|
221
227
|
signature = url_safe_base64(OpenSSL::HMAC.digest('sha1', Thumbor.key, thumbor_path))
|
222
228
|
thumbor_path.insert(0, "/#{signature}/")
|
223
|
-
else
|
229
|
+
else
|
224
230
|
thumbor_path.insert(0, "/unsafe/")
|
225
231
|
end
|
226
232
|
thumbor_path
|
data/lib/thumbor/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -20,7 +20,7 @@ describe Thumbor::Cascade do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should create a new instance passing key and keep it" do
|
23
|
-
subject.computed_key.
|
23
|
+
expect(subject.computed_key).to eq 'my-security-keym'
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -32,7 +32,7 @@ describe Thumbor::Cascade do
|
|
32
32
|
|
33
33
|
it "should return just the image hash if no arguments passed" do
|
34
34
|
url = subject.url_for
|
35
|
-
url.
|
35
|
+
expect(url).to eq image_md5
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should raise if no image passed" do
|
@@ -41,172 +41,194 @@ describe Thumbor::Cascade do
|
|
41
41
|
|
42
42
|
it "should return proper url for width-only" do
|
43
43
|
url = subject.width(300).url_for
|
44
|
-
url.
|
44
|
+
expect(url).to eq '300x0/' << image_md5
|
45
45
|
end
|
46
46
|
|
47
47
|
it "should return proper url for height-only" do
|
48
48
|
url = subject.height(300).url_for
|
49
|
-
url.
|
49
|
+
expect(url).to eq '0x300/' << image_md5
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should return proper url for width and height" do
|
53
53
|
url = subject.width(200).height(300).url_for
|
54
|
-
url.
|
54
|
+
expect(url).to eq '200x300/' << image_md5
|
55
55
|
end
|
56
56
|
|
57
57
|
it "should return proper smart url" do
|
58
58
|
url = subject.width(200).height(300).smart(true).url_for
|
59
|
-
url.
|
59
|
+
expect(url).to eq '200x300/smart/' << image_md5
|
60
60
|
end
|
61
61
|
|
62
62
|
it "should return proper fit-in url" do
|
63
63
|
url = subject.width(200).height(300).fit_in(true).url_for
|
64
|
-
url.
|
64
|
+
expect(url).to eq 'fit-in/200x300/' << image_md5
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should return proper adaptive-fit-in url" do
|
68
|
+
url = subject.width(200).height(300).adaptive_fit_in(true).url_for
|
69
|
+
expect(url).to eq 'adaptive-fit-in/200x300/' << image_md5
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should return proper full-fit-in url" do
|
73
|
+
url = subject.width(200).height(300).full_fit_in(true).url_for
|
74
|
+
expect(url).to eq 'full-fit-in/200x300/' << image_md5
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should return proper adaptive-full-fit-in url" do
|
78
|
+
url = subject.width(200).height(300).adaptive_full_fit_in(true).url_for
|
79
|
+
expect(url).to eq 'adaptive-full-fit-in/200x300/' << image_md5
|
80
|
+
end
|
81
|
+
|
82
|
+
[:fit_in, :full_fit_in].each do |fit|
|
83
|
+
it "should raise error when using #{fit} without width or height" do
|
84
|
+
subject.send(fit, true)
|
85
|
+
expect{subject.url_for}.to raise_error(ArgumentError)
|
86
|
+
end
|
65
87
|
end
|
66
88
|
|
67
89
|
it "should return proper flip url if no width and height" do
|
68
90
|
url = subject.flip(true).url_for
|
69
|
-
url.
|
91
|
+
expect(url).to eq '-0x0/' << image_md5
|
70
92
|
end
|
71
93
|
|
72
94
|
it "should return proper flop url if no width and height" do
|
73
95
|
url = subject.flop(true).url_for
|
74
|
-
url.
|
96
|
+
expect(url).to eq '0x-0/' << image_md5
|
75
97
|
end
|
76
98
|
|
77
99
|
it "should return proper flip-flop url if no width and height" do
|
78
100
|
url = subject.flip(true).flop(true).url_for
|
79
|
-
url.
|
101
|
+
expect(url).to eq '-0x-0/' << image_md5
|
80
102
|
end
|
81
103
|
|
82
104
|
it "should return proper flip url if width" do
|
83
105
|
url = subject.width(300).flip(true).url_for
|
84
|
-
url.
|
106
|
+
expect(url).to eq '-300x0/' << image_md5
|
85
107
|
end
|
86
108
|
|
87
109
|
it "should return proper flop url if height" do
|
88
110
|
url = subject.height(300).flop(true).url_for
|
89
|
-
url.
|
111
|
+
expect(url).to eq '0x-300/' << image_md5
|
90
112
|
end
|
91
113
|
|
92
114
|
it "should return horizontal align" do
|
93
115
|
url = subject.halign(:left).url_for
|
94
|
-
url.
|
116
|
+
expect(url).to eq 'left/' << image_md5
|
95
117
|
end
|
96
118
|
|
97
119
|
it "should not return horizontal align if it is center" do
|
98
120
|
url = subject.halign(:center).url_for
|
99
|
-
url.
|
121
|
+
expect(url).to eq image_md5
|
100
122
|
end
|
101
123
|
|
102
124
|
it "should return vertical align" do
|
103
125
|
url = subject.valign(:top).url_for
|
104
|
-
url.
|
126
|
+
expect(url).to eq 'top/' << image_md5
|
105
127
|
end
|
106
128
|
|
107
129
|
it "should not return vertical align if it is middle" do
|
108
130
|
url = subject.valign(:middle).url_for
|
109
|
-
url.
|
131
|
+
expect(url).to eq image_md5
|
110
132
|
end
|
111
133
|
|
112
134
|
it "should return halign and valign properly" do
|
113
135
|
url = subject.halign(:left).valign(:top).url_for
|
114
|
-
url.
|
136
|
+
expect(url).to eq 'left/top/' << image_md5
|
115
137
|
end
|
116
138
|
|
117
139
|
it "should return meta properly" do
|
118
140
|
url = subject.meta(true).url_for
|
119
|
-
url.
|
141
|
+
expect(url).to eq 'meta/' << image_md5
|
120
142
|
end
|
121
143
|
|
122
144
|
it "should return proper crop url when param is array" do
|
123
145
|
url = subject.crop([10, 20, 30, 40]).url_for
|
124
|
-
url.
|
146
|
+
expect(url).to eq '10x20:30x40/' << image_md5
|
125
147
|
end
|
126
148
|
|
127
149
|
it "should return proper crop url" do
|
128
150
|
url = subject.crop(10, 20, 30, 40).url_for
|
129
|
-
url.
|
151
|
+
expect(url).to eq '10x20:30x40/' << image_md5
|
130
152
|
end
|
131
153
|
|
132
154
|
it "should ignore crop if all zeros" do
|
133
155
|
url = subject.crop(0, 0, 0, 0).url_for
|
134
|
-
url.
|
156
|
+
expect(url).to eq image_md5
|
135
157
|
end
|
136
158
|
|
137
159
|
it "should have smart after halign and valign" do
|
138
160
|
url = subject.halign(:left).valign(:top).smart(true).url_for
|
139
|
-
url.
|
161
|
+
expect(url).to eq 'left/top/smart/' << image_md5
|
140
162
|
end
|
141
163
|
|
142
164
|
it "should have quality filter" do
|
143
165
|
url = subject.quality_filter(20).url_for
|
144
|
-
url.
|
166
|
+
expect(url).to eq 'filters:quality(20)/' << image_md5
|
145
167
|
end
|
146
168
|
|
147
169
|
it "should have brightness filter" do
|
148
170
|
url = subject.brightness_filter(30).url_for
|
149
|
-
url.
|
171
|
+
expect(url).to eq 'filters:brightness(30)/' << image_md5
|
150
172
|
end
|
151
173
|
|
152
174
|
it "should have 2 filters" do
|
153
175
|
url = subject.brightness_filter(30).quality_filter(20).url_for
|
154
|
-
url.
|
176
|
+
expect(url).to eq 'filters:brightness(30):quality(20)/' << image_md5
|
155
177
|
end
|
156
178
|
|
157
179
|
it "should escape url args" do
|
158
180
|
url = subject.watermark_filter('http://my-server.com/image.png', 30).quality_filter(20).url_for
|
159
|
-
url.
|
181
|
+
expect(url).to eq 'filters:watermark(http%3A%2F%2Fmy-server.com%2Fimage.png,30):quality(20)/' << image_md5
|
160
182
|
end
|
161
183
|
|
162
184
|
it "should have trim without params" do
|
163
185
|
url = subject.trim.url_for
|
164
|
-
url.
|
186
|
+
expect(url).to eq 'trim/' << image_md5
|
165
187
|
end
|
166
188
|
|
167
189
|
it "should have trim with direction param" do
|
168
190
|
url = subject.trim('bottom-right').url_for
|
169
|
-
url.
|
191
|
+
expect(url).to eq 'trim:bottom-right/' << image_md5
|
170
192
|
end
|
171
193
|
|
172
194
|
it "should have trim with direction and tolerance param" do
|
173
195
|
url = subject.trim('bottom-right', 15).url_for
|
174
|
-
url.
|
196
|
+
expect(url).to eq 'trim:bottom-right:15/' << image_md5
|
175
197
|
end
|
176
198
|
|
177
199
|
it "should have the right crop when cropping horizontally and given a left center" do
|
178
200
|
url = subject.original_width(100).original_height(100).width(40).height(50).center(0, 50).url_for
|
179
|
-
url.
|
201
|
+
expect(url).to eq '0x0:80x100/40x50/' << image_md5
|
180
202
|
end
|
181
203
|
|
182
204
|
it "should have the right crop when cropping horizontally and given a right center" do
|
183
205
|
url = subject.original_width(100).original_height(100).width(40).height(50).center(100, 50).url_for
|
184
|
-
url.
|
206
|
+
expect(url).to eq '20x0:100x100/40x50/' << image_md5
|
185
207
|
end
|
186
208
|
|
187
209
|
it "should have the right crop when cropping horizontally and given the actual center" do
|
188
210
|
url = subject.original_width(100).original_height(100).width(40).height(50).center(50, 50).url_for
|
189
|
-
url.
|
211
|
+
expect(url).to eq '10x0:90x100/40x50/' << image_md5
|
190
212
|
end
|
191
213
|
|
192
214
|
it "should have the right crop when cropping vertically and given a top center" do
|
193
215
|
url = subject.original_width(100).original_height(100).width(50).height(40).center(50, 0).url_for
|
194
|
-
url.
|
216
|
+
expect(url).to eq '0x0:100x80/50x40/' << image_md5
|
195
217
|
end
|
196
218
|
|
197
219
|
it "should have the right crop when cropping vertically and given a bottom center" do
|
198
220
|
url = subject.original_width(100).original_height(100).width(50).height(40).center(50, 100).url_for
|
199
|
-
url.
|
221
|
+
expect(url).to eq '0x20:100x100/50x40/' << image_md5
|
200
222
|
end
|
201
223
|
|
202
224
|
it "should have the right crop when cropping vertically and given the actual center" do
|
203
225
|
url = subject.original_width(100).original_height(100).width(50).height(40).center(50, 50).url_for
|
204
|
-
url.
|
226
|
+
expect(url).to eq '0x10:100x90/50x40/' << image_md5
|
205
227
|
end
|
206
228
|
|
207
229
|
it "should have the no crop when not necessary" do
|
208
230
|
url = subject.original_width(100).original_height(100).width(50).height(50).center(50, 0).url_for
|
209
|
-
url.
|
231
|
+
expect(url).to eq '50x50/' << image_md5
|
210
232
|
end
|
211
233
|
|
212
234
|
it "should blow up with a bad center" do
|
@@ -215,42 +237,42 @@ describe Thumbor::Cascade do
|
|
215
237
|
|
216
238
|
it "should have no crop with a missing original_height" do
|
217
239
|
url = subject.original_width(100).width(50).height(40).center(50, 0).url_for
|
218
|
-
url.
|
240
|
+
expect(url).to eq '50x40/' << image_md5
|
219
241
|
end
|
220
242
|
|
221
243
|
it "should have no crop with a missing original_width" do
|
222
244
|
url = subject.original_height(100).width(50).height(40).center(50, 0).url_for
|
223
|
-
url.
|
245
|
+
expect(url).to eq '50x40/' << image_md5
|
224
246
|
end
|
225
247
|
|
226
248
|
it "should have no crop with out a width and height" do
|
227
249
|
url = subject.original_width(100).original_height(100).center(50, 50).url_for
|
228
|
-
url.
|
250
|
+
expect(url).to eq image_md5
|
229
251
|
end
|
230
252
|
|
231
253
|
it "should use the original width with a missing width" do
|
232
254
|
url = subject.original_width(100).original_height(100).height(80).center(50, 50).url_for
|
233
|
-
url.
|
255
|
+
expect(url).to eq '0x10:100x90/0x80/' << image_md5
|
234
256
|
end
|
235
257
|
|
236
258
|
it "should use the original height with a missing height" do
|
237
259
|
url = subject.original_width(100).original_height(100).width(80).center(50, 50).url_for
|
238
|
-
url.
|
260
|
+
expect(url).to eq '10x0:90x100/80x0/' << image_md5
|
239
261
|
end
|
240
262
|
|
241
263
|
it "should have the right crop with a negative width" do
|
242
264
|
url = subject.original_width(100).original_height(100).width(-50).height(40).center(50, 50).url_for
|
243
|
-
url.
|
265
|
+
expect(url).to eq '0x10:100x90/-50x40/' << image_md5
|
244
266
|
end
|
245
267
|
|
246
268
|
it "should have the right crop with a negative height" do
|
247
269
|
url = subject.original_width(100).original_height(100).width(50).height(-40).center(50, 50).url_for
|
248
|
-
url.
|
270
|
+
expect(url).to eq '0x10:100x90/50x-40/' << image_md5
|
249
271
|
end
|
250
272
|
|
251
273
|
it "should have the right crop with a negative height and width" do
|
252
274
|
url = subject.original_width(100).original_height(100).width(-50).height(-40).center(50, 50).url_for
|
253
|
-
url.
|
275
|
+
expect(url).to eq '0x10:100x90/-50x-40/' << image_md5
|
254
276
|
end
|
255
277
|
end
|
256
278
|
|
@@ -261,7 +283,7 @@ describe Thumbor::Cascade do
|
|
261
283
|
|
262
284
|
it "should create a new instance passing key and keep it" do
|
263
285
|
url = subject.width(300).height(200).generate
|
264
|
-
url.
|
286
|
+
expect(url).to eq '/TQfyd3H36Z3srcNcLOYiM05YNO8=/300x200/my.domain.com/some/image/url.jpg'
|
265
287
|
end
|
266
288
|
|
267
289
|
it "should be able to change the Thumbor key" do
|
@@ -269,37 +291,37 @@ describe Thumbor::Cascade do
|
|
269
291
|
url1 = thumbor.generate
|
270
292
|
Thumbor.key = 'another-thumbor-key'
|
271
293
|
url2 = thumbor.generate
|
272
|
-
url1.
|
294
|
+
expect(url1).not_to eq url2
|
273
295
|
end
|
274
296
|
|
275
297
|
it "should create a new instance passing key and keep it" do
|
276
298
|
url = subject.width(300).height(200).meta(true).generate
|
277
|
-
url.
|
299
|
+
expect(url).to eq '/YBQEWd3g_WRMnVEG73zfzcr8Zj0=/meta/300x200/my.domain.com/some/image/url.jpg'
|
278
300
|
end
|
279
301
|
|
280
302
|
it "should create a new instance passing key and keep it" do
|
281
303
|
url = subject.width(300).height(200).meta(true).smart(true).generate
|
282
|
-
url.
|
304
|
+
expect(url).to eq '/jP89J0qOWHgPlm_lOA28GtOh5GU=/meta/300x200/smart/my.domain.com/some/image/url.jpg'
|
283
305
|
end
|
284
306
|
|
285
307
|
it "should create a new instance passing key and keep it" do
|
286
308
|
url = subject.width(300).height(200).meta(true).smart(true).fit_in(true).generate
|
287
|
-
url.
|
309
|
+
expect(url).to eq '/zrrOh_TtTs4kiLLEQq1w4bcTYdc=/meta/fit-in/300x200/smart/my.domain.com/some/image/url.jpg'
|
288
310
|
end
|
289
311
|
|
290
312
|
it "should create a new instance passing key and keep it" do
|
291
313
|
url = subject.width(300).height(200).meta(true).smart(true).fit_in(true).flip(true).generate
|
292
|
-
url.
|
314
|
+
expect(url).to eq '/4t1XK1KH43cOb1QJ9tU00-W2_k8=/meta/fit-in/-300x200/smart/my.domain.com/some/image/url.jpg'
|
293
315
|
end
|
294
316
|
|
295
317
|
it "should create a new instance passing key and keep it" do
|
296
318
|
url = subject.width(300).height(200).meta(true).smart(true).fit_in(true).flip(true).flop(true).generate
|
297
|
-
url.
|
319
|
+
expect(url).to eq '/HJnvjZU69PkPOhyZGu-Z3Uc_W_A=/meta/fit-in/-300x-200/smart/my.domain.com/some/image/url.jpg'
|
298
320
|
end
|
299
321
|
|
300
322
|
it "should create a new instance passing key and keep it" do
|
301
323
|
url = subject.quality_filter(20).brightness_filter(10).generate
|
302
|
-
url.
|
324
|
+
expect(url).to eq '/q0DiFg-5-eFZIqyN3lRoCvg2K0s=/filters:quality(20):brightness(10)/my.domain.com/some/image/url.jpg'
|
303
325
|
end
|
304
326
|
end
|
305
327
|
|
@@ -312,7 +334,7 @@ describe Thumbor::Cascade do
|
|
312
334
|
|
313
335
|
it "should create a new instance passing key and keep it" do
|
314
336
|
url = subject.width(300).height(200).generate
|
315
|
-
url.
|
337
|
+
expect(url).to eq '/qkLDiIbvtiks0Up9n5PACtmpOfX6dPXw4vP4kJU-jTfyF6y1GJBJyp7CHYh1H3R2/' << image_url
|
316
338
|
end
|
317
339
|
|
318
340
|
it "should allow thumbor to decrypt it properly" do
|
@@ -322,20 +344,20 @@ describe Thumbor::Cascade do
|
|
322
344
|
|
323
345
|
decrypted = decrypt_in_thumbor(encrypted)
|
324
346
|
|
325
|
-
decrypted["horizontal_flip"].
|
326
|
-
decrypted["vertical_flip"].
|
327
|
-
decrypted["smart"].
|
328
|
-
decrypted["meta"].
|
329
|
-
decrypted["fit_in"].
|
330
|
-
decrypted["crop"]["left"].
|
331
|
-
decrypted["crop"]["top"].
|
332
|
-
decrypted["crop"]["right"].
|
333
|
-
decrypted["crop"]["bottom"].
|
334
|
-
decrypted["valign"].
|
335
|
-
decrypted["halign"].
|
336
|
-
decrypted["image_hash"].
|
337
|
-
decrypted["width"].
|
338
|
-
decrypted["height"].
|
347
|
+
expect(decrypted["horizontal_flip"]).to eq false
|
348
|
+
expect(decrypted["vertical_flip"]).to eq false
|
349
|
+
expect(decrypted["smart"]).to eq false
|
350
|
+
expect(decrypted["meta"]).to eq false
|
351
|
+
expect(decrypted["fit_in"]).to eq false
|
352
|
+
expect(decrypted["crop"]["left"]).to eq 0
|
353
|
+
expect(decrypted["crop"]["top"]).to eq 0
|
354
|
+
expect(decrypted["crop"]["right"]).to eq 0
|
355
|
+
expect(decrypted["crop"]["bottom"]).to eq 0
|
356
|
+
expect(decrypted["valign"]).to eq 'middle'
|
357
|
+
expect(decrypted["halign"]).to eq 'center'
|
358
|
+
expect(decrypted["image_hash"]).to eq image_md5
|
359
|
+
expect(decrypted["width"]).to eq 300
|
360
|
+
expect(decrypted["height"]).to eq 200
|
339
361
|
|
340
362
|
end
|
341
363
|
|
@@ -346,10 +368,10 @@ describe Thumbor::Cascade do
|
|
346
368
|
|
347
369
|
decrypted = decrypt_in_thumbor(encrypted)
|
348
370
|
|
349
|
-
decrypted["meta"].
|
350
|
-
decrypted["image_hash"].
|
351
|
-
decrypted["width"].
|
352
|
-
decrypted["height"].
|
371
|
+
expect(decrypted["meta"]).to eq true
|
372
|
+
expect(decrypted["image_hash"]).to eq image_md5
|
373
|
+
expect(decrypted["width"]).to eq 300
|
374
|
+
expect(decrypted["height"]).to eq 200
|
353
375
|
|
354
376
|
end
|
355
377
|
|
@@ -360,11 +382,11 @@ describe Thumbor::Cascade do
|
|
360
382
|
|
361
383
|
decrypted = decrypt_in_thumbor(encrypted)
|
362
384
|
|
363
|
-
decrypted["meta"].
|
364
|
-
decrypted["smart"].
|
365
|
-
decrypted["image_hash"].
|
366
|
-
decrypted["width"].
|
367
|
-
decrypted["height"].
|
385
|
+
expect(decrypted["meta"]).to eq true
|
386
|
+
expect(decrypted["smart"]).to eq true
|
387
|
+
expect(decrypted["image_hash"]).to eq image_md5
|
388
|
+
expect(decrypted["width"]).to eq 300
|
389
|
+
expect(decrypted["height"]).to eq 200
|
368
390
|
|
369
391
|
end
|
370
392
|
|
@@ -375,10 +397,10 @@ describe Thumbor::Cascade do
|
|
375
397
|
|
376
398
|
decrypted = decrypt_in_thumbor(encrypted)
|
377
399
|
|
378
|
-
decrypted["fit_in"].
|
379
|
-
decrypted["image_hash"].
|
380
|
-
decrypted["width"].
|
381
|
-
decrypted["height"].
|
400
|
+
expect(decrypted["fit_in"]).to eq true
|
401
|
+
expect(decrypted["image_hash"]).to eq image_md5
|
402
|
+
expect(decrypted["width"]).to eq 300
|
403
|
+
expect(decrypted["height"]).to eq 200
|
382
404
|
|
383
405
|
end
|
384
406
|
|
@@ -389,12 +411,12 @@ describe Thumbor::Cascade do
|
|
389
411
|
|
390
412
|
decrypted = decrypt_in_thumbor(encrypted)
|
391
413
|
|
392
|
-
decrypted["meta"].
|
393
|
-
decrypted["smart"].
|
394
|
-
decrypted["image_hash"].
|
395
|
-
decrypted["width"].
|
396
|
-
decrypted["height"].
|
397
|
-
decrypted["
|
414
|
+
expect(decrypted["meta"]).to eq true
|
415
|
+
expect(decrypted["smart"]).to eq true
|
416
|
+
expect(decrypted["image_hash"]).to eq image_md5
|
417
|
+
expect(decrypted["width"]).to eq 300
|
418
|
+
expect(decrypted["height"]).to eq 200
|
419
|
+
expect(decrypted["horizontal_flip"]).to eq true
|
398
420
|
|
399
421
|
end
|
400
422
|
|
@@ -405,13 +427,13 @@ describe Thumbor::Cascade do
|
|
405
427
|
|
406
428
|
decrypted = decrypt_in_thumbor(encrypted)
|
407
429
|
|
408
|
-
decrypted["meta"].
|
409
|
-
decrypted["smart"].
|
410
|
-
decrypted["image_hash"].
|
411
|
-
decrypted["width"].
|
412
|
-
decrypted["height"].
|
413
|
-
decrypted["
|
414
|
-
decrypted["
|
430
|
+
expect(decrypted["meta"]).to eq true
|
431
|
+
expect(decrypted["smart"]).to eq true
|
432
|
+
expect(decrypted["image_hash"]).to eq image_md5
|
433
|
+
expect(decrypted["width"]).to eq 300
|
434
|
+
expect(decrypted["height"]).to eq 200
|
435
|
+
expect(decrypted["horizontal_flip"]).to eq true
|
436
|
+
expect(decrypted["vertical_flip"]).to eq true
|
415
437
|
|
416
438
|
end
|
417
439
|
|
@@ -423,14 +445,14 @@ describe Thumbor::Cascade do
|
|
423
445
|
|
424
446
|
decrypted = decrypt_in_thumbor(encrypted)
|
425
447
|
|
426
|
-
decrypted["meta"].
|
427
|
-
decrypted["smart"].
|
428
|
-
decrypted["image_hash"].
|
429
|
-
decrypted["width"].
|
430
|
-
decrypted["height"].
|
431
|
-
decrypted["
|
432
|
-
decrypted["
|
433
|
-
decrypted["halign"]
|
448
|
+
expect(decrypted["meta"]).to eq true
|
449
|
+
expect(decrypted["smart"]).to eq true
|
450
|
+
expect(decrypted["image_hash"]).to eq image_md5
|
451
|
+
expect(decrypted["width"]).to eq 300
|
452
|
+
expect(decrypted["height"]).to eq 200
|
453
|
+
expect(decrypted["horizontal_flip"]).to eq true
|
454
|
+
expect(decrypted["vertical_flip"]).to eq true
|
455
|
+
expect(decrypted["halign"]).to eq "left"
|
434
456
|
|
435
457
|
end
|
436
458
|
|
@@ -442,15 +464,15 @@ describe Thumbor::Cascade do
|
|
442
464
|
|
443
465
|
decrypted = decrypt_in_thumbor(encrypted)
|
444
466
|
|
445
|
-
decrypted["meta"].
|
446
|
-
decrypted["smart"].
|
447
|
-
decrypted["image_hash"].
|
448
|
-
decrypted["width"].
|
449
|
-
decrypted["height"].
|
450
|
-
decrypted["
|
451
|
-
decrypted["
|
452
|
-
decrypted["halign"]
|
453
|
-
decrypted["valign"]
|
467
|
+
expect(decrypted["meta"]).to eq true
|
468
|
+
expect(decrypted["smart"]).to eq true
|
469
|
+
expect(decrypted["image_hash"]).to eq image_md5
|
470
|
+
expect(decrypted["width"]).to eq 300
|
471
|
+
expect(decrypted["height"]).to eq 200
|
472
|
+
expect(decrypted["horizontal_flip"]).to eq true
|
473
|
+
expect(decrypted["vertical_flip"]).to eq true
|
474
|
+
expect(decrypted["halign"]).to eq "left"
|
475
|
+
expect(decrypted["valign"]).to eq "top"
|
454
476
|
|
455
477
|
end
|
456
478
|
|
@@ -461,19 +483,19 @@ describe Thumbor::Cascade do
|
|
461
483
|
|
462
484
|
decrypted = decrypt_in_thumbor(encrypted)
|
463
485
|
|
464
|
-
decrypted["horizontal_flip"].
|
465
|
-
decrypted["vertical_flip"].
|
466
|
-
decrypted["smart"].
|
467
|
-
decrypted["meta"].
|
468
|
-
decrypted["crop"]["left"].
|
469
|
-
decrypted["crop"]["top"].
|
470
|
-
decrypted["crop"]["right"].
|
471
|
-
decrypted["crop"]["bottom"].
|
472
|
-
decrypted["valign"].
|
473
|
-
decrypted["halign"].
|
474
|
-
decrypted["image_hash"].
|
475
|
-
decrypted["width"].
|
476
|
-
decrypted["height"].
|
486
|
+
expect(decrypted["horizontal_flip"]).to eq false
|
487
|
+
expect(decrypted["vertical_flip"]).to eq false
|
488
|
+
expect(decrypted["smart"]).to eq false
|
489
|
+
expect(decrypted["meta"]).to eq false
|
490
|
+
expect(decrypted["crop"]["left"]).to eq 10
|
491
|
+
expect(decrypted["crop"]["top"]).to eq 20
|
492
|
+
expect(decrypted["crop"]["right"]).to eq 30
|
493
|
+
expect(decrypted["crop"]["bottom"]).to eq 40
|
494
|
+
expect(decrypted["valign"]).to eq 'middle'
|
495
|
+
expect(decrypted["halign"]).to eq 'center'
|
496
|
+
expect(decrypted["image_hash"]).to eq image_md5
|
497
|
+
expect(decrypted["width"]).to eq 300
|
498
|
+
expect(decrypted["height"]).to eq 200
|
477
499
|
|
478
500
|
end
|
479
501
|
|
@@ -484,7 +506,7 @@ describe Thumbor::Cascade do
|
|
484
506
|
|
485
507
|
decrypted = decrypt_in_thumbor(encrypted)
|
486
508
|
|
487
|
-
decrypted["filters"].
|
509
|
+
expect(decrypted["filters"]).to eq "quality(20):brightness(10)"
|
488
510
|
end
|
489
511
|
end
|
490
512
|
end
|
metadata
CHANGED
@@ -1,41 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-thumbor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bernardo Heynemann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - '>='
|
17
|
+
- - ! '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - '>='
|
24
|
+
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: simplecov
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - '>='
|
31
|
+
- - ! '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - '>='
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: guard-rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rb-fsevent
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.9.1
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.9.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: listen
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.3.1
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.3.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
39
95
|
- !ruby/object:Gem::Version
|
40
96
|
version: '0'
|
41
97
|
description: ruby-thumbor is the client to the thumbor imaging service (http://github.com/globocom/thumbor).
|
@@ -65,12 +121,12 @@ require_paths:
|
|
65
121
|
- lib
|
66
122
|
required_ruby_version: !ruby/object:Gem::Requirement
|
67
123
|
requirements:
|
68
|
-
- - '>='
|
124
|
+
- - ! '>='
|
69
125
|
- !ruby/object:Gem::Version
|
70
126
|
version: '0'
|
71
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
128
|
requirements:
|
73
|
-
- - '>='
|
129
|
+
- - ! '>='
|
74
130
|
- !ruby/object:Gem::Version
|
75
131
|
version: '0'
|
76
132
|
requirements: []
|