Class: Quickeebooks::Online::Model::Account
- Inherits:
-
IntuitType
- Object
- IntuitType
- Quickeebooks::Online::Model::Account
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/quickeebooks/online/model/account.rb
Constant Summary collapse
- REST_RESOURCE =
"account"
- XML_NODE =
"Account"
Class Method Summary collapse
-
.resource_for_collection ⇒ Object
Class methods.
Instance Method Summary collapse
- #to_xml_ns(options = {}) ⇒ Object
-
#valid_for_deletion? ⇒ Boolean
To delete an account Intuit requires we provide Id and SyncToken fields.
- #valid_for_update? ⇒ Boolean
Methods inherited from IntuitType
Class Method Details
.resource_for_collection ⇒ Object
Class methods
50 51 52 |
# File 'lib/quickeebooks/online/model/account.rb', line 50 def self.resource_for_collection "#{self::REST_RESOURCE}s" end |
Instance Method Details
#to_xml_ns(options = {}) ⇒ Object
30 31 32 |
# File 'lib/quickeebooks/online/model/account.rb', line 30 def to_xml_ns( = {}) to_xml_inject_ns('Account', ) end |
#valid_for_deletion? ⇒ Boolean
To delete an account Intuit requires we provide Id and SyncToken fields
44 45 46 47 |
# File 'lib/quickeebooks/online/model/account.rb', line 44 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
35 36 37 38 39 40 41 |
# File 'lib/quickeebooks/online/model/account.rb', line 35 def valid_for_update? if sync_token.nil? errors.add(:sync_token, "Missing required attribute SyncToken for update") end valid? errors.empty? end |