6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'app/controllers/effective/qb_sync_controller.rb', line 6
def api
(render(nothing: true) and return) if request.get?
doc = Nokogiri::XML(request.raw_post)
@qbwcSupervisor = QbwcSupervisor.new
api_verb = (doc.at_xpath('//soap:Body').children.first.node_name rescue '')
case api_verb
when 'serverVersion'
@version = '1.0'
when 'clientVersion'
@version = nil
when 'authenticate'
@token, @message = @qbwcSupervisor.authenticate(doc)
when 'sendRequestXML'
@message = @qbwcSupervisor.sendRequestXML(doc)
when 'receiveResponseXML'
@message = @qbwcSupervisor.receiveResponseXML(doc)
when 'getLastError'
@message = @qbwcSupervisor.getLastError(doc)
when 'connectionError'
@message = @qbwcSupervisor.connectionError(doc)
when 'closeConnection'
@message = @qbwcSupervisor.closeConnection(doc)
else
''
end
render(template: "/effective/qb_sync/#{api_verb}.erb", layout: false, content_type: 'text/xml')
end
|