Class: Pingback::Server
- Inherits:
-
Object
- Object
- Pingback::Server
- Defined in:
- lib/pingback/server.rb
Overview
This class is intended to be used to handle pingback requests. It conforms to the rack interface. How a pingback request should be registered has to be defined in a Proc which must be supplied to the constructor.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(request_handler) ⇒ Server
constructor
A new instance of Server.
Constructor Details
#initialize(request_handler) ⇒ Server
A new instance of Server.
15 16 17 18 |
# File 'lib/pingback/server.rb', line 15 def initialize(request_handler) @request_handler = request_handler setup_xmlrpc_handler end |
Instance Method Details
#call(env) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/pingback/server.rb', line 20 def call(env) request = Rack::Request.new(env) xml_response = @xmlrpc_handler.process(request.body) [200, {'Content-Type' => 'text/xml'}, [xml_response]] end |