Class: Quickbooks::Adapters::SpewAdapter::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/quickbooks/adapters/spew_adapter.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Connection

Returns a new instance of Connection.



7
8
# File 'lib/quickbooks/adapters/spew_adapter.rb', line 7

def initialize(*args)
end

Instance Method Details

#closeObject



15
16
# File 'lib/quickbooks/adapters/spew_adapter.rb', line 15

def close
end

#connected?Boolean

Returns true if there is an open connection to Quickbooks, false if not. Use session? to determine an open session.

Returns:



11
12
13
# File 'lib/quickbooks/adapters/spew_adapter.rb', line 11

def connected?
  @connected ||= false
end

#connectionObject

Returns the active connection to Quickbooks, or creates a new one if none exists.



25
26
27
# File 'lib/quickbooks/adapters/spew_adapter.rb', line 25

def connection
  @connected = true
end

#latest_qbxml_versionObject



33
34
35
# File 'lib/quickbooks/adapters/spew_adapter.rb', line 33

def latest_qbxml_version
  @latest_qbxml_version ||= qbxml_versions.sort.last
end

#qbxml_versionsObject

We can support any version!



30
31
32
# File 'lib/quickbooks/adapters/spew_adapter.rb', line 30

def qbxml_versions
  ['1.0','1.1','2.0','2.1','3.0','4.0','4.1','5.0','6.0','7.0','8.0']
end

#send_xml(xml) ⇒ Object

Sends a request to Quickbooks. This request should be a valid QBXML request. Use Qbxml::Request to generate valid requests.



19
20
21
22
# File 'lib/quickbooks/adapters/spew_adapter.rb', line 19

def send_xml(xml)
  warn "Quickbooks Spew:\n#{xml}" if $DEBUG
  throw :response, xml;
end