Class: GoogleChartSsl
- Inherits:
-
Object
- Object
- GoogleChartSsl
- Defined in:
- lib/google_chart_ssl.rb,
lib/google_chart_ssl/version.rb
Constant Summary collapse
- Google =
Net::HTTP.new('chart.apis.google.com', 80)
- VERSION =
"0.0.4"
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ GoogleChartSsl
constructor
A new instance of GoogleChartSsl.
Constructor Details
#initialize(app, options = {}) ⇒ GoogleChartSsl
Returns a new instance of GoogleChartSsl.
5 6 7 |
# File 'lib/google_chart_ssl.rb', line 5 def initialize(app, = {}) @app, @options = app, end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/google_chart_ssl.rb', line 11 def call(env) @req = Rack::Request.new(env) if @req.path =~ %r[/google_chart(\.png)?\z] path = '/chart?' + @req.query_string resp = Google.request(Net::HTTP::Get.new(path)) headers = { 'Content-Length' => resp.content_length.to_s, 'Content-Type' => resp.content_type, } [resp.code, headers, [resp.body]] else @app.call(env) end end |