def valid?
      @errors = []

      if !line_item_id.nil? && line_item_id !~ GUID_REGEX
        @errors << ['line_item_id', 'must be blank or a valid Xero GUID']
      end

      unless description
        @errors << ['description', "can't be blank"]
      end

      if tax_type && !TAX_TYPE[tax_type]
        @errors << ['tax_type', "must be one of #{TAX_TYPE.keys.join('/')}"]
      end

      @errors.size == 0
    end
def valid?
      @errors = []

      if !line_item_id.nil? && line_item_id !~ GUID_REGEX
        @errors << ['line_item_id', 'must be blank or a valid Xero GUID']
      end

      unless description
        @errors << ['description', "can't be blank"]
      end

      if tax_type && !TAX_TYPE[tax_type]
        @errors << ['tax_type', "must be one of #{TAX_TYPE.keys.join('/')}"]
      end

      @errors.size == 0
    end
Validate the LineItem record according to what will be valid by the gateway.

 Usage:
  line_item.valid?     # Returns true/false

  Additionally sets line_item.errors array to an array of field/error.