Class: AnyChartProxy
- Inherits:
-
Object
- Object
- AnyChartProxy
- Defined in:
- lib/any_chart_proxy.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#call(env) ⇒ Object
For any Rack apps including Rails 3.*.
Class Method Details
.perform_request(env) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/any_chart_proxy.rb', line 5 def self.perform_request(env) req = Rack::Request.new(env) if req.post? && req.params['file'] && req.params['contentType'] headers = { 'Content-Type' => req.params['contentType'] } headers['Content-Disposition'] = "attachment; filename=\"#{req.params['fileName']}\"" if req.params['fileName'] [200, headers, Base64.encode64(req.params['file'])] else [400, { 'Content-Type' => 'text/html'}, ''] end end |
Instance Method Details
#call(env) ⇒ Object
For any Rack apps including Rails 3.*
17 18 19 |
# File 'lib/any_chart_proxy.rb', line 17 def call(env) self.class.perform_request env end |