Class: QuickbooksWebConnector::SoapWrapper::QBWebConnectorSvcSoap

Inherits:
Object
  • Object
show all
Defined in:
lib/quickbooks_web_connector/soap_wrapper/defaultServant.rb,
lib/quickbooks_web_connector/soap_wrapper/QBWebConnectorSvc.rb

Constant Summary collapse

Methods =
[
  [ "http://developer.intuit.com/serverVersion",
    "serverVersion",
    [ [:in, "parameters", ["::SOAP::SOAPElement", "http://developer.intuit.com/", "serverVersion"]],
      [:out, "parameters", ["::SOAP::SOAPElement", "http://developer.intuit.com/", "serverVersionResponse"]] ],
    { :request_style =>  :document, :request_use =>  :literal,
      :response_style => :document, :response_use => :literal,
      :faults => {} }
  ],
  [ "http://developer.intuit.com/clientVersion",
    "clientVersion",
    [ [:in, "parameters", ["::SOAP::SOAPElement", "http://developer.intuit.com/", "clientVersion"]],
      [:out, "parameters", ["::SOAP::SOAPElement", "http://developer.intuit.com/", "clientVersionResponse"]] ],
    { :request_style =>  :document, :request_use =>  :literal,
      :response_style => :document, :response_use => :literal,
      :faults => {} }
  ],
  [ "http://developer.intuit.com/authenticate",
    "authenticate",
    [ [:in, "parameters", ["::SOAP::SOAPElement", "http://developer.intuit.com/", "authenticate"]],
      [:out, "parameters", ["::SOAP::SOAPElement", "http://developer.intuit.com/", "authenticateResponse"]] ],
    { :request_style =>  :document, :request_use =>  :literal,
      :response_style => :document, :response_use => :literal,
      :faults => {} }
  ],
  [ "http://developer.intuit.com/sendRequestXML",
    "sendRequestXML",
    [ [:in, "parameters", ["::SOAP::SOAPElement", "http://developer.intuit.com/", "sendRequestXML"]],
      [:out, "parameters", ["::SOAP::SOAPElement", "http://developer.intuit.com/", "sendRequestXMLResponse"]] ],
    { :request_style =>  :document, :request_use =>  :literal,
      :response_style => :document, :response_use => :literal,
      :faults => {} }
  ],
  [ "http://developer.intuit.com/receiveResponseXML",
    "receiveResponseXML",
    [ [:in, "parameters", ["::SOAP::SOAPElement", "http://developer.intuit.com/", "receiveResponseXML"]],
      [:out, "parameters", ["::SOAP::SOAPElement", "http://developer.intuit.com/", "receiveResponseXMLResponse"]] ],
    { :request_style =>  :document, :request_use =>  :literal,
      :response_style => :document, :response_use => :literal,
      :faults => {} }
  ],
  [ "http://developer.intuit.com/connectionError",
    "connectionError",
    [ [:in, "parameters", ["::SOAP::SOAPElement", "http://developer.intuit.com/", "connectionError"]],
      [:out, "parameters", ["::SOAP::SOAPElement", "http://developer.intuit.com/", "connectionErrorResponse"]] ],
    { :request_style =>  :document, :request_use =>  :literal,
      :response_style => :document, :response_use => :literal,
      :faults => {} }
  ],
  [ "http://developer.intuit.com/getLastError",
    "getLastError",
    [ [:in, "parameters", ["::SOAP::SOAPElement", "http://developer.intuit.com/", "getLastError"]],
      [:out, "parameters", ["::SOAP::SOAPElement", "http://developer.intuit.com/", "getLastErrorResponse"]] ],
    { :request_style =>  :document, :request_use =>  :literal,
      :response_style => :document, :response_use => :literal,
      :faults => {} }
  ],
  [ "http://developer.intuit.com/closeConnection",
    "closeConnection",
    [ [:in, "parameters", ["::SOAP::SOAPElement", "http://developer.intuit.com/", "closeConnection"]],
      [:out, "parameters", ["::SOAP::SOAPElement", "http://developer.intuit.com/", "closeConnectionResponse"]] ],
    { :request_style =>  :document, :request_use =>  :literal,
      :response_style => :document, :response_use => :literal,
      :faults => {} }
  ]
]

Instance Method Summary collapse

Instance Method Details

#authenticate(parameters) ⇒ Object

SYNOPSIS

authenticate(parameters)

ARGS

parameters      Authenticate - {http://developer.intuit.com/}authenticate

RETURNS

parameters      AuthenticateResponse - {http://developer.intuit.com/}authenticateResponse


46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/quickbooks_web_connector/soap_wrapper/defaultServant.rb', line 46

def authenticate(parameters)
  token = SecureRandom.uuid

  user = QuickbooksWebConnector.config.users[parameters.strUserName]

  result = if user && user.valid_password?(parameters.strPassword)
    QuickbooksWebConnector.config.run_after_authenticate

    if QuickbooksWebConnector.size > 0
      # Store how many jobs are queued so we can track progress later
      QuickbooksWebConnector.store_job_count_for_session

      user.company_file_path
    else
      'none'
    end
  else
    'nvu'
  end

  AuthenticateResponse.new([token, result, nil, nil])
end

#clientVersion(parameters) ⇒ Object

SYNOPSIS

clientVersion(parameters)

ARGS

parameters      ClientVersion - {http://developer.intuit.com/}clientVersion

RETURNS

parameters      ClientVersionResponse - {http://developer.intuit.com/}clientVersionResponse


27
28
29
30
31
32
33
34
35
# File 'lib/quickbooks_web_connector/soap_wrapper/defaultServant.rb', line 27

def clientVersion(parameters)
  clientVersionResult = nil

  if QuickbooksWebConnector.config.minimum_web_connector_client_version && QuickbooksWebConnector.config.minimum_web_connector_client_version.to_s > parameters.strVersion
    clientVersionResult = "E:This version of QuickBooks Web Connector is outdated. Version #{QuickbooksWebConnector.config.minimum_web_connector_client_version} or greater is required."
  end

  ClientVersionResponse.new(clientVersionResult)
end

#closeConnection(parameters) ⇒ Object

SYNOPSIS

closeConnection(parameters)

ARGS

parameters      CloseConnection - {http://developer.intuit.com/}closeConnection

RETURNS

parameters      CloseConnectionResponse - {http://developer.intuit.com/}closeConnectionResponse


162
163
164
# File 'lib/quickbooks_web_connector/soap_wrapper/defaultServant.rb', line 162

def closeConnection(parameters)
  CloseConnectionResponse.new
end

#connectionError(parameters) ⇒ Object

SYNOPSIS

connectionError(parameters)

ARGS

parameters      ConnectionError - {http://developer.intuit.com/}connectionError

RETURNS

parameters      ConnectionErrorResponse - {http://developer.intuit.com/}connectionErrorResponse

Raises:

  • (NotImplementedError)


134
135
136
137
# File 'lib/quickbooks_web_connector/soap_wrapper/defaultServant.rb', line 134

def connectionError(parameters)
  p [parameters]
  raise NotImplementedError.new
end

#getLastError(parameters) ⇒ Object

SYNOPSIS

getLastError(parameters)

ARGS

parameters      GetLastError - {http://developer.intuit.com/}getLastError

RETURNS

parameters      GetLastErrorResponse - {http://developer.intuit.com/}getLastErrorResponse

Raises:

  • (NotImplementedError)


148
149
150
151
# File 'lib/quickbooks_web_connector/soap_wrapper/defaultServant.rb', line 148

def getLastError(parameters)
  p [parameters]
  raise NotImplementedError.new
end

#receiveResponseXML(parameters) ⇒ Object

SYNOPSIS

receiveResponseXML(parameters)

ARGS

parameters      ReceiveResponseXML - {http://developer.intuit.com/}receiveResponseXML

RETURNS

parameters      ReceiveResponseXMLResponse - {http://developer.intuit.com/}receiveResponseXMLResponse


104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/quickbooks_web_connector/soap_wrapper/defaultServant.rb', line 104

def receiveResponseXML(parameters)
  job = QuickbooksWebConnector::Job.reserve

  if parameters.message.present?
    job.fail(ReceiveResponseXMLError.new(parameters.message))
  else
    job.response_xml = parameters.response
    job.perform
  end

  progress = if QuickbooksWebConnector.size == 0
    # We're done
    QuickbooksWebConnector.clear_job_count_for_session
    100
  else
    QuickbooksWebConnector.session_progress
  end

  ReceiveResponseXMLResponse.new(progress)
end

#sendRequestXML(parameters) ⇒ Object

SYNOPSIS

sendRequestXML(parameters)

ARGS

parameters      SendRequestXML - {http://developer.intuit.com/}sendRequestXML

RETURNS

parameters      SendRequestXMLResponse - {http://developer.intuit.com/}sendRequestXMLResponse


78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/quickbooks_web_connector/soap_wrapper/defaultServant.rb', line 78

def sendRequestXML(parameters)
  if (job = QuickbooksWebConnector::Job.peek)
    case (request_xml = job.request_xml)
    when :failed
      raise RequestXMLError
    else
      SendRequestXMLResponse.new request_xml
    end
  else
    SendRequestXMLResponse.new nil
  end
rescue RequestXMLError
  # Remove the job from the queue since it fails to build. The job should have already created a failure.
  QuickbooksWebConnector.pop
  retry
end

#serverVersion(parameters) ⇒ Object

SYNOPSIS

serverVersion(parameters)

ARGS

parameters      ServerVersion - {http://developer.intuit.com/}serverVersion

RETURNS

parameters      ServerVersionResponse - {http://developer.intuit.com/}serverVersionResponse


14
15
16
# File 'lib/quickbooks_web_connector/soap_wrapper/defaultServant.rb', line 14

def serverVersion(parameters)
  ServerVersionResponse.new(QuickbooksWebConnector.config.server_version)
end