Sha256: 80cdc35ab53d8699dfb3f64931136a1ef16b59b276d6f8e2cc2a739366d351ee

Contents?: true

Size: 1.33 KB

Versions: 10

Compression:

Stored size: 1.33 KB

Contents

module Effective
  class QbSyncController < ApplicationController
    skip_authorization_check if defined?(CanCan)
    skip_before_filter :verify_authenticity_token

    def api
      # respond successfully to a GET which some versions of the Web Connector send to verify the url
      (render(nothing: true) and return) if request.get?

      # Examine raw post and determine which API call to process
      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
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
effective_qb_sync-1.1.4 app/controllers/effective/qb_sync_controller.rb
effective_qb_sync-1.1.3 app/controllers/effective/qb_sync_controller.rb
effective_qb_sync-1.1.2 app/controllers/effective/qb_sync_controller.rb
effective_qb_sync-1.1.1 app/controllers/effective/qb_sync_controller.rb
effective_qb_sync-1.1.0 app/controllers/effective/qb_sync_controller.rb
effective_qb_sync-1.0.4 app/controllers/effective/qb_sync_controller.rb
effective_qb_sync-1.0.3 app/controllers/effective/qb_sync_controller.rb
effective_qb_sync-1.0.2 app/controllers/effective/qb_sync_controller.rb
effective_qb_sync-1.0.1 app/controllers/effective/qb_sync_controller.rb
effective_qb_sync-1.0.0 app/controllers/effective/qb_sync_controller.rb