httpthumbnailer-client 0.0.3 → 0.1.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.
- data/Gemfile +1 -1
- data/Gemfile.lock +6 -2
- data/VERSION +1 -1
- data/httpthumbnailer-client.gemspec +5 -5
- data/lib/httpthumbnailer-client.rb +12 -1
- data/spec/httpthumbnailer-client_spec.rb +10 -1
- metadata +7 -7
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -3,6 +3,7 @@ GEM
|
|
3
3
|
specs:
|
4
4
|
builder (3.0.0)
|
5
5
|
cgi_multipart_eof_fix (2.5.0)
|
6
|
+
cli (1.1.0)
|
6
7
|
cucumber (1.1.3)
|
7
8
|
builder (>= 2.1.2)
|
8
9
|
diff-lcs (>= 1.1.2)
|
@@ -19,10 +20,12 @@ GEM
|
|
19
20
|
git (1.2.5)
|
20
21
|
haml (3.1.4)
|
21
22
|
httpclient (2.2.3)
|
22
|
-
httpthumbnailer (0.0
|
23
|
+
httpthumbnailer (0.1.0)
|
24
|
+
cli (~> 1.1.0)
|
23
25
|
haml (~> 3)
|
24
26
|
mongrel (>= 1.1.5)
|
25
27
|
rmagick (~> 2)
|
28
|
+
ruby-ip (~> 0.9)
|
26
29
|
sinatra (>= 1.2.6)
|
27
30
|
jeweler (1.6.4)
|
28
31
|
bundler (~> 1.0)
|
@@ -49,6 +52,7 @@ GEM
|
|
49
52
|
rspec-expectations (2.3.0)
|
50
53
|
diff-lcs (~> 1.1.2)
|
51
54
|
rspec-mocks (2.3.0)
|
55
|
+
ruby-ip (0.9.1)
|
52
56
|
sinatra (1.3.1)
|
53
57
|
rack (~> 1.3, >= 1.3.4)
|
54
58
|
rack-protection (~> 1.1, >= 1.1.2)
|
@@ -64,7 +68,7 @@ DEPENDENCIES
|
|
64
68
|
cucumber
|
65
69
|
daemon (~> 1)
|
66
70
|
httpclient (>= 2.2.1)
|
67
|
-
httpthumbnailer (~> 0.0
|
71
|
+
httpthumbnailer (~> 0.1.0)
|
68
72
|
jeweler (~> 1.6.4)
|
69
73
|
rcov
|
70
74
|
rdoc (~> 3.9)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "httpthumbnailer-client"
|
8
|
-
s.version = "0.0
|
8
|
+
s.version = "0.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jakub Pastuszek"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2012-01-04"
|
13
13
|
s.description = "Thumbnails images using httpthumbniler server"
|
14
14
|
s.email = "jpastuszek@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -55,7 +55,7 @@ Gem::Specification.new do |s|
|
|
55
55
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
56
56
|
s.add_development_dependency(%q<rdoc>, ["~> 3.9"])
|
57
57
|
s.add_development_dependency(%q<daemon>, ["~> 1"])
|
58
|
-
s.add_development_dependency(%q<httpthumbnailer>, ["~> 0.0
|
58
|
+
s.add_development_dependency(%q<httpthumbnailer>, ["~> 0.1.0"])
|
59
59
|
else
|
60
60
|
s.add_dependency(%q<httpclient>, [">= 2.2.1"])
|
61
61
|
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
@@ -65,7 +65,7 @@ Gem::Specification.new do |s|
|
|
65
65
|
s.add_dependency(%q<rcov>, [">= 0"])
|
66
66
|
s.add_dependency(%q<rdoc>, ["~> 3.9"])
|
67
67
|
s.add_dependency(%q<daemon>, ["~> 1"])
|
68
|
-
s.add_dependency(%q<httpthumbnailer>, ["~> 0.0
|
68
|
+
s.add_dependency(%q<httpthumbnailer>, ["~> 0.1.0"])
|
69
69
|
end
|
70
70
|
else
|
71
71
|
s.add_dependency(%q<httpclient>, [">= 2.2.1"])
|
@@ -76,7 +76,7 @@ Gem::Specification.new do |s|
|
|
76
76
|
s.add_dependency(%q<rcov>, [">= 0"])
|
77
77
|
s.add_dependency(%q<rdoc>, ["~> 3.9"])
|
78
78
|
s.add_dependency(%q<daemon>, ["~> 1"])
|
79
|
-
s.add_dependency(%q<httpthumbnailer>, ["~> 0.0
|
79
|
+
s.add_dependency(%q<httpthumbnailer>, ["~> 0.1.0"])
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
@@ -54,6 +54,10 @@ class HTTPThumbnailerClient
|
|
54
54
|
attr_reader :mime_type, :data
|
55
55
|
end
|
56
56
|
|
57
|
+
module ThumbnailsInputMimeTypeMeta
|
58
|
+
attr_accessor :input_mime_type
|
59
|
+
end
|
60
|
+
|
57
61
|
class ThumbnailingError
|
58
62
|
def initialize(msg)
|
59
63
|
@message = msg
|
@@ -83,7 +87,7 @@ class HTTPThumbnailerClient
|
|
83
87
|
raise RemoteServerError, response.body.delete("\r")
|
84
88
|
end
|
85
89
|
when /^multipart\/mixed/
|
86
|
-
MultipartResponse.new(content_type, response.body).parts.map do |part|
|
90
|
+
thumbnails = MultipartResponse.new(content_type, response.body).parts.map do |part|
|
87
91
|
part_content_type = part.header['Content-Type']
|
88
92
|
|
89
93
|
case part_content_type
|
@@ -95,6 +99,13 @@ class HTTPThumbnailerClient
|
|
95
99
|
raise UnknownResponseType, part_content_type
|
96
100
|
end
|
97
101
|
end
|
102
|
+
|
103
|
+
unless response.header['X-Input-Image-Content-Type'].empty?
|
104
|
+
thumbnails.extend(ThumbnailsInputMimeTypeMeta)
|
105
|
+
thumbnails.input_mime_type = response.header['X-Input-Image-Content-Type'].first
|
106
|
+
end
|
107
|
+
|
108
|
+
return thumbnails
|
98
109
|
else
|
99
110
|
raise UnknownResponseType, content_type
|
100
111
|
end
|
@@ -57,6 +57,15 @@ describe HTTPThumbnailerClient do
|
|
57
57
|
i.height.should == 4
|
58
58
|
end
|
59
59
|
|
60
|
+
describe "meta data" do
|
61
|
+
it "should provide input image mime type" do
|
62
|
+
thumbs = HTTPThumbnailerClient.new('http://localhost:3100').thumbnail((spec_dir + 'test.jpg').read) do
|
63
|
+
thumbnail 'crop', 6, 3, 'JPEG'
|
64
|
+
end
|
65
|
+
thumbs.input_mime_type.should == 'image/jpeg'
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
60
69
|
it "should raise HTTPThumbnailerClient::UnsupportedMediaTypeError error on unsupported media type" do
|
61
70
|
lambda {
|
62
71
|
HTTPThumbnailerClient.new('http://localhost:3100').thumbnail((spec_dir + 'test.txt').read) do
|
@@ -70,7 +79,7 @@ describe HTTPThumbnailerClient do
|
|
70
79
|
lambda {
|
71
80
|
HTTPThumbnailerClient.new('http://localhost:3100').thumbnail((spec_dir + 'test-large.jpg').read) do
|
72
81
|
thumbnail 'crop', 6, 3, 'JPEG'
|
73
|
-
thumbnail 'crop',
|
82
|
+
thumbnail 'crop', 7000, 7000, 'PNG'
|
74
83
|
end
|
75
84
|
}.should raise_error HTTPThumbnailerClient::ImageTooLargeError
|
76
85
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: httpthumbnailer-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.3
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jakub Pastuszek
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-01-04 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
type: :runtime
|
@@ -145,12 +145,12 @@ dependencies:
|
|
145
145
|
requirements:
|
146
146
|
- - ~>
|
147
147
|
- !ruby/object:Gem::Version
|
148
|
-
hash:
|
148
|
+
hash: 27
|
149
149
|
segments:
|
150
150
|
- 0
|
151
|
+
- 1
|
151
152
|
- 0
|
152
|
-
|
153
|
-
version: 0.0.7
|
153
|
+
version: 0.1.0
|
154
154
|
prerelease: false
|
155
155
|
name: httpthumbnailer
|
156
156
|
version_requirements: *id009
|