Module: Shine
- Defined in:
- lib/shine.rb
Defined Under Namespace
Modules: JS
Class Method Summary collapse
Class Method Details
.compress_file(filepath, params = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/shine.rb', line 8 def self.compress_file(filepath, params={}) url = compress_url File.open(filepath) do |file| req = Net::HTTP::Post::Multipart.new(url.path, 'file' => UploadIO.new(file, 'text/javascript', filepath)) result = Net::HTTP.start(url.host, url.port) do |http| http.request(req) end result.body end end |
.compress_url ⇒ Object
5 6 7 |
# File 'lib/shine.rb', line 5 def self.compress_url URI.parse('http://shine.magnetised.info/compress') end |