Class: BlogRPC::RackApp
- Inherits:
-
Object
- Object
- BlogRPC::RackApp
- Defined in:
- lib/blogrpc/rack_app.rb
Overview
An embeddable Rack handler for RPC servers
Instance Attribute Summary collapse
-
#blog_url ⇒ Object
The root URL of the blog.
-
#handlers ⇒ Object
All the XML-RPC handlers that can respond to the request, if it so happens that you have more than one.
-
#rpc_endpoint_url ⇒ Object
The URL of the blog API endpoint (like /backend.rpc).
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(blog_handler) ⇒ RackApp
constructor
A new instance of RackApp.
Constructor Details
#initialize(blog_handler) ⇒ RackApp
Returns a new instance of RackApp.
16 17 18 |
# File 'lib/blogrpc/rack_app.rb', line 16 def initialize(blog_handler) @handlers = [blog_handler] end |
Instance Attribute Details
#blog_url ⇒ Object
The root URL of the blog
7 8 9 |
# File 'lib/blogrpc/rack_app.rb', line 7 def blog_url @blog_url end |
#handlers ⇒ Object
All the XML-RPC handlers that can respond to the request, if it so happens that you have more than one
14 15 16 |
# File 'lib/blogrpc/rack_app.rb', line 14 def handlers @handlers end |
#rpc_endpoint_url ⇒ Object
The URL of the blog API endpoint (like /backend.rpc)
10 11 12 |
# File 'lib/blogrpc/rack_app.rb', line 10 def rpc_endpoint_url @rpc_endpoint_url end |
Instance Method Details
#call(env) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/blogrpc/rack_app.rb', line 20 def call(env) @env = env req = Rack::Request.new(env) # If the request is a GET return the autodiscovery RSD fragment if req.get? return endpoint_xml else return post_request end end |