Sha256: 6d59ce990ddb9eafdc3bf641d1c54783453bd819a3250b2501d5ae3f7b5f2a45
Contents?: true
Size: 617 Bytes
Versions: 2
Compression:
Stored size: 617 Bytes
Contents
require 'json' module ExtDirect class API def initialize(app, api_path = "/api", route_path = "/direct", constant_name = "Ext.app.REMOTING_API") @app, @api_path, @route_path, @constant_name = app, api_path, route_path, constant_name end def call(env) if env["PATH_INFO"].match("^#{@api_path}$") response = ExtDirect::Response.new("", 200, {"Content-Type" => "text/javascript"}) response.write("#{@constant_name} = #{ExtDirect::Service::Configuration.generate(@route_path).to_json}") response.finish else @app.call(env) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ext_direct-0.3.0 | lib/ext_direct/api.rb |
ext_direct-0.2.0 | lib/ext_direct/api.rb |