lib/quickbooks/base.rb
# Instantiate a new object with just attributes, or an existing object replacing the attributes
Instantiate a new object with just attributes, or an existing object replacing the attributes
Instantiate a new object with just attributes or an existing object replacing the attributes
def instantiate(obj_or_attrs={},attrs={})
        if obj_or_attrs.is_a?(Quickbooks::Base)
          obj = obj_or_attrs
        else
          obj = allocate
          attrs = obj_or_attrs
        end
        attrs.each do |key,value|
          if obj.respond_to?(key.to_s.underscore+'=')
            obj.send(key.to_s.underscore+'=', value)
            if orig = obj.instance_variable_get('@' + key.to_s.underscore)
              obj.original_values[key.to_s.underscore] = orig.dup
            end
          end
        end if attrs
        obj 
      end
def instantiate ( obj_or_attrs = { } , attrs = { } ) if obj_or_attrs . is_a? ( Quickbooks :: Base ) obj = obj_or_attrs else obj = allocate attrs = obj_or_attrs end attrs . each do | key , value | if obj . respond_to? ( key . to_s . underscore + '=' ) obj . send ( key . to_s . underscore + '=' , value ) if orig = obj . instance_variable_get ( '@' + key . to_s . underscore ) obj . original_values [ key . to_s . underscore ] = orig . dup end end end if attrs obj end
Instantiate a new object with just attributes, or an existing object replacing the attributes
Instantiate a new object with just attributes or an existing object replacing the attributes
# Will be either a nice object, or a Qbxml::Error object.
obj_or_attrs
<not_specific>
attrs
<not_specific>