Class: Quickbooks::Model::Account
Constant Summary
collapse
- XML_COLLECTION_NODE =
"Account"
- XML_NODE =
"Account"
- REST_RESOURCE =
'account'
- ASSET =
'Asset'
- EQUITY =
'Equity'
- EXPENSE =
'Expense'
- LIABILITY =
'Liability'
- REVENUE =
'Revenue'
- ACCOUNT_CLASSIFICATION =
[ASSET, EQUITY, EXPENSE, LIABILITY, REVENUE]
Instance Method Summary
collapse
Methods inherited from BaseModel
attribute_names, #attributes, attrs_with_types, #ensure_line_items_initialization, #initialize, inspect, #inspect, reference_setters, resource_for_collection, resource_for_singular, to_xml_big_decimal, #to_xml_inject_ns, #to_xml_ns
Methods included from Validator
#line_item_size
Instance Method Details
#name_cannot_contain_invalid_characters ⇒ Object
52
53
54
55
56
|
# File 'lib/quickbooks/model/account.rb', line 52
def name_cannot_contain_invalid_characters
if name && (name.index(':') || name.index('"'))
errors.add('name', ":#{name} cannot contain a colon (:) or double quotes (\").")
end
end
|
#valid_for_create? ⇒ Boolean
65
66
67
68
|
# File 'lib/quickbooks/model/account.rb', line 65
def valid_for_create?
valid?
errors.empty?
end
|
#valid_for_deletion? ⇒ Boolean
70
71
72
73
|
# File 'lib/quickbooks/model/account.rb', line 70
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
58
59
60
61
62
63
|
# File 'lib/quickbooks/model/account.rb', line 58
def valid_for_update?
if sync_token.nil?
errors.add(:sync_token, "Missing required attribute SyncToken for update")
end
errors.empty?
end
|