Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

make compatible to new http-client version

  • Loading branch information...
commit 82085180e1058d69cfc44c01967a44c778506e29 1 parent 3f093a3
@grosser authored
View
2  Gemfile
@@ -2,7 +2,7 @@ source :rubygems
gem 'rake'
gem 'json'
-gem 'httpclient'
+gem 'httpclient', '>=2.2'
group :dev do
gem 'rake'
View
4 Gemfile.lock
@@ -3,7 +3,7 @@ GEM
specs:
diff-lcs (1.1.2)
git (1.2.5)
- httpclient (2.1.5.2)
+ httpclient (2.2.0.1)
jeweler (1.5.2)
bundler (~> 1.0.0)
git (>= 1.2.5)
@@ -23,7 +23,7 @@ PLATFORMS
ruby
DEPENDENCIES
- httpclient
+ httpclient (>= 2.2)
jeweler
json
rake
View
4 lib/smusher/puny_png.rb
@@ -15,7 +15,7 @@ def self.converts_gif_to_png?
def self.optimized_image_data_for(file)
url = 'http://www.punypng.com/api/optimize'
response = HTTPClient.post url, { 'img' => File.new(file), 'key' => api_key}
- response = JSON.parse(response.body.content)
+ response = JSON.parse(response.body)
raise "puny_png: #{response['error']}" if response['error']
image_url = response['optimized_url']
raise "no optimized_url found" unless image_url
@@ -29,4 +29,4 @@ def self.personal_key
key.empty? ? nil : key
end
end
-end
+end
View
4 lib/smusher/smush_it.rb
@@ -12,11 +12,11 @@ def self.optimized_image_data_for(file)
# url = "http://smushit.eperf.vip.ac4.yahoo.com/ysmush.it/ws.php" # used at the new page but does not hande uploads
url = 'http://ws1.adq.ac4.yahoo.com/ysmush.it/ws.php'
response = HTTPClient.post url, { 'files[]' => File.new(file)}
- response = JSON.parse(response.body.content)
+ response = JSON.parse(response.body)
raise "smush.it: #{response['error']}" if response['error']
image_url = response['dest']
raise "no dest path found" unless image_url
open(image_url) { |source| source.read() }
end
end
-end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.