Class: Quickeebooks::Windows::Model::Account

Inherits:
IntuitType
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/quickeebooks/windows/model/account.rb

Constant Summary collapse

XML_COLLECTION_NODE =
'Accounts'
XML_NODE =
'Account'
REST_RESOURCE =
"account"

Instance Method Summary collapse

Methods included from Logging

#log

Instance Method Details

#valid_for_deletion?Boolean

To delete an account Intuit requires we provide Id and SyncToken fields

Returns:

  • (Boolean)


54
55
56
57
# File 'lib/quickeebooks/windows/model/account.rb', line 54

def valid_for_deletion?
  return false if(id.nil? || sync_token.nil?)
  id.to_i > 0 && !sync_token.to_s.empty? && sync_token.to_i >= 0
end

#valid_for_update?Boolean

Returns:

  • (Boolean)


45
46
47
48
49
50
51
# File 'lib/quickeebooks/windows/model/account.rb', line 45

def valid_for_update?
  if sync_token.nil?
    errors.add(:sync_token, "Missing required attribute SyncToken for update")
  end
  valid?
  errors.empty?
end