Class QBFC::Base
In: lib/qbfc/base.rb
Parent: Object

Base is the...um…"base" class from which Element, Info, and Report inherit. It defines methods that the three share.

Methods

Public Class methods

Create an instance of this Element or Report.

  • sess: An open QBFC::Session object that will recieve all requests
  • ole: An optional QBFC::OLEWrapper object representing a response to a QueryRq. It is unlikely that this will be used directly.

[Source]

    # File lib/qbfc/base.rb, line 55
55:     def initialize(sess, ole = nil)
56:       @sess, @ole = sess, ole    
57:       @ole = QBFC::OLEWrapper.new(@ole) if @ole.kind_of?(WIN32OLE)    
58:     end

The QuickBooks name for this Element or Report. It typically matches the last part of class name. Used in determining names of Requests and other OLE methods.

[Source]

    # File lib/qbfc/base.rb, line 46
46:       def qb_name
47:         self.name.split('::').last
48:       end

Protected Class methods

A convenience method for creating and returning a Query Request for this class.

[Source]

    # File lib/qbfc/base.rb, line 36
36:       def create_query(sess)
37:         QBFC::Request.new(sess, "#{qb_name}Query")
38:       end

Element::find and Info::get receive optional arguments which can include a Request object and/or an options Hash. parse_find_args gets these arguments into a set that is easier to deal with.

[Source]

    # File lib/qbfc/base.rb, line 16
16:       def parse_find_args(*args)
17:         request = args[0].kind_of?(QBFC::Request) ? args[0].dup : nil
18:         options = args[-1].kind_of?(Hash) ? args[-1].dup : {}
19:         
20:         # base classes will need to pass a subset of options to
21:         # the ChildClass.find . Also, the actually options to the
22:         # BaseClass.find Request cannot include owner_id.
23:         if is_base_class?
24:           base_options = options.dup 
25:           base_options.delete(:conditions)
26:           options.delete(:owner_id)
27:         else
28:           base_options = nil
29:         end
30:         
31:         return request, options, base_options
32:       end

Public Instance methods

Pass missing methods to OLEWrapper#qbfc_method_missing to handle checking if there is a related OLE method to run.

[Source]

    # File lib/qbfc/base.rb, line 72
72:     def method_missing(symbol, *params)
73:       @ole.qbfc_method_missing(@sess, symbol, *params)
74:     end

List the methods of the OLE object

[Source]

    # File lib/qbfc/base.rb, line 61
61:     def ole_methods
62:       @ole.ole_methods
63:     end

Name of the QuickBooks Element or Query represented by this class.

[Source]

    # File lib/qbfc/base.rb, line 77
77:     def qb_name
78:       self.class.qb_name
79:     end

Check if the OLE object responds to a given method

[Source]

    # File lib/qbfc/base.rb, line 66
66:     def respond_to_ole?(symbol)
67:       @ole.respond_to_ole?(symbol)
68:     end

[Validate]