Class: TinyPNG::Client
- Inherits:
-
Object
- Object
- TinyPNG::Client
- Includes:
- HTTParty
- Defined in:
- lib/tinypng/client.rb
Instance Method Summary collapse
Instance Method Details
#shrink(image) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/tinypng/client.rb', line 11 def shrink image begin response = self.class.post('/shrink', body: image).parsed_response rescue => e raise Exception.new("Network error: #{e}") end if response['code'] raise Exception.new("#{response['code']}: #{response['message']}") else Image.new(response) end end |