Class: Qiwi::Server
- Inherits:
-
Object
- Object
- Qiwi::Server
- Defined in:
- lib/qiwi/server.rb
Instance Attribute Summary collapse
-
#handler ⇒ Object
Returns the value of attribute handler.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(login = nil, password = nil, handler = nil) ⇒ Server
constructor
Creates a new instance of Rack application.
Constructor Details
#initialize(login = nil, password = nil, handler = nil) ⇒ Server
Creates a new instance of Rack application
14 15 16 17 18 |
# File 'lib/qiwi/server.rb', line 14 def initialize(login = nil, password = nil, handler = nil) @login = login || Qiwi.config.login @password = password || Qiwi.config.password @handler = handler || Qiwi::Handler end |
Instance Attribute Details
#handler ⇒ Object
Returns the value of attribute handler.
7 8 9 |
# File 'lib/qiwi/server.rb', line 7 def handler @handler end |
Instance Method Details
#call(env) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/qiwi/server.rb', line 20 def call(env) @logger = env['rack.logger'] if env['QUERY_STRING'] == 'wsdl' body = File.read(File.join(File.dirname(__FILE__), 'IShopClientWS.wsdl')) else body = env['rack.input'].read result = handle_soap_body(body) body = <<-EOF <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:cli="http://client.ishop.mw.ru/"> <soap:Body> <cli:updateBillResponse> <updateBillResult>#{result}</updateBillResult> </cli:updateBillResponse> </soap:Body> </soap:Envelope> EOF end headers = {'Content-Type' => 'application/soap+xml', 'Cache-Control' => 'no-cache'} [200, headers, [body]] end |